Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lab Login

login.sh logs in to the lab network gateway without requiring Python.

Requirements

  • /bin/sh
  • awk
  • curl or wget

These tools are available on most default Linux installations. If both curl and wget are missing, install one of them before running the script.

Configuration

Set credentials in the environment:

export LAB_NET_USER='your-user'
export LAB_NET_PWD='your-password'
./login.sh

Or use the default config file:

mkdir -p ~/.config/lab-login
cat > ~/.config/lab-login/env <<'EOF'
LAB_NET_USER='your-user'
LAB_NET_PWD='your-password'
EOF
chmod 600 ~/.config/lab-login/env
./login.sh

The config file must not be readable or writable by group or others on Linux.

Optional Settings

  • LAB_LOGIN_CONFIG: config file path. Default: ~/.config/lab-login/env
  • LAB_LOGIN_LOG_DIR: log directory. Default: ~/.scripts/.log/login
  • LAB_LOGIN_URL: gateway login URL. Default: http://1.1.1.3/ac_portal/login.php
  • LAB_LOGIN_CONNECT_TEST_URL: connectivity check URL.

Checks

Run the built-in RC4 test:

sh login.sh --self-test

systemd Timer

Install as a system service that runs once after boot and then every 5 minutes:

sudo ./install-systemd.sh install

The installer asks for your lab network username and password, writes them to /etc/lab-login/env, enables the timer, and starts one immediate login check.

For non-interactive install:

sudo LAB_NET_USER='your-user' LAB_NET_PWD='your-password' ./install-systemd.sh install

The installer creates:

  • /usr/local/bin/lab-login
  • /etc/lab-login/env
  • /etc/systemd/system/lab-login.service
  • /etc/systemd/system/lab-login.timer
  • /var/log/lab-login

If /etc/lab-login/env already exists, it is preserved. You can edit it later:

sudo sh -c 'umask 077; vi /etc/lab-login/env'
sudo systemctl restart lab-login.timer

Check status:

systemctl status lab-login.timer lab-login.service
journalctl -u lab-login.service -n 100 --no-pager

Uninstall the timer and service:

sudo ./install-systemd.sh uninstall

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages