0

I'm trying to add to my current lines of Code if possible to Continue to Open my webpage in Kiosk on Chromium during startup, which I've managed with the code below, however I'm trying to make a Username and Password be entered automatically, and press the login button into the Webpage that follows. This is what I have so Far, Stored in /home/pi/kiosk.sh

#!bin/bash
xset s noblank
xset s off
xset -dpms

unclutter -idle 0 -root &

chromium-browser --noerrdiaglogs --disable-infobars --kiosk https://192.168.0.1/webconsole

I then have another set of Code stored in SystemD that I've enabled so it Executes on Startup. located as: /lib/systemd/system/kiosk.service:

[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target

[Service]
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/pi/.Xauthority
Type=simple
ExecStart=/bin/bash /home/pi/kiosk.sh
Restart=on-abort
User=pi
Group=pi

[Install]
WantedBy=graphical.target

This all works great, However my only issue is trying to add something to make my login details for this page open automatically. Any Advice? I tried looking into cURL but have no idea with it. And sometimes I'd get a SSL error, which I assume is because the Internal webpage won't have a security Certificate. Thanks for anyone's time who reads this.

4
  • 1
    If all else fails, you can use xdotool to simulate keyboard strokes (and fill in username/password that way). What authentication method is use here? Basic Auth? Does it store a cookie?
    – Panki
    Commented Jun 16, 2021 at 10:09
  • It looks like basic Auth but without Storing Cookies. Sadly even the web based console doesn't allow created used to be remembered either. I'll checkout xdotool though, is there a way to make it delay before inputting the details as I believe the Webpage often takes a moment to load up. And would I put said code into my kiosk.sh or..? Commented Jun 16, 2021 at 10:37
  • 1
    If its basic authentication you can use: https://user:[email protected]/webconsole Commented Jun 16, 2021 at 10:40
  • Oddly enough it seemed to intially work, Starting showing the logo for the Webconsole as it loaded, but then presented a White Screen instead of the Login Screen or Post-Login Page (That shares the same URL) Commented Jun 16, 2021 at 10:47

2 Answers 2

0

It will be very difficult to do this with any user-agent other than the same one which will be handling the user interaction; you have the issue of extracting the cookies from the user-agent which carried out the authentication and injecting these into Chromium.

I can see 2 possible solutions.

  1. Use chromedriver to control the browser initially from a script, injecting the credentials via the DOM

  2. configure the browser to use a proxy and MITM the connection on the proxy to establish the session

But it might be easier still to provision a client certificate on the browser and rewrite the application to accept authentication usingclient certificates.

0

So I eventually managed to get this to work. I ran the "Chromium-browser" and my password enter Script using xdotool, however I ran them Simultaneously using & and moved my xdotool to a different script and It's worked for me Now.

chromium-browser --noerrdiaglogs --disable-infobars --kiosk https://192.168.0.1/webconsole & /bin/bash /home/pi/test.sh

With the Test.sh containing:

#!bin/bash

xdotool search --onlyvisible --class "chromium" windowfocus key Tab
xdotool key Tab
xdotool type password
xdotool key Return
sleep 9999999h

The Sleep command was added as when this Script completed, it essentially ended the whole Task. Thanks all for your advice and time! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .