iitj-login keeps the IIT Jodhpur hostel Ethernet session alive by logging back into the FortiGate captive portal before the session expires.
It is built for the actual failure modes that make this network annoying to use in practice: expiring sessions, Docker subnet conflicts, MAC randomization, WiFi stealing portal traffic, and DNS returning the wrong address for the gateway.
The current release line is a cross-platform Go binary with support for Linux, macOS, and Windows.
IITJ hostel LAN does not stay authenticated permanently. If you are on Ethernet, the session typically expires after about 10,000 seconds, which is roughly 2 hours and 46 minutes.
That leads to predictable breakage:
- SSH sessions drop
- downloads fail halfway through
- package managers hang
- long builds die silently
- headless machines become painful to use
This tool runs in the background and re-authenticates automatically so the connection stays usable.
- single self-contained binary
- Linux, macOS, and Windows support
- background service installation
- Linux and macOS man page installation during setup
- encrypted local credential storage with AES-256-GCM
- automatic Ethernet interface detection
- FortiGate login flow with DNS and routing workarounds
- installer checks for Docker subnet conflicts
- installer fixes the captive portal hostname for browsers
- runtime health metadata for recent login state
logsanddoctorcommands for troubleshooting
curl -fsSL https://raw.githubusercontent.com/xevrion/iitj-lan-autologin/main/bootstrap.sh | bashThe bootstrap script downloads the latest matching release binary. If no release asset exists for your platform, it falls back to building from source when go and git are available.
Run the bootstrap in PowerShell as Administrator:
irm https://raw.githubusercontent.com/xevrion/iitj-lan-autologin/main/bootstrap.ps1 | iexThe PowerShell bootstrap downloads the latest matching release binary. If no release asset exists for your platform, it falls back to building from source when go and git are available.
After installation is complete, use iitj-login from a normal Command Prompt or normal PowerShell window for day-to-day commands such as:
iitj-login status
iitj-login start
iitj-login stopRequires Go 1.21 or newer.
git clone https://github.com/xevrion/iitj-lan-autologin
cd iitj-lan-autologin
go build -o iitj-login .
./iitj-login installOn Windows:
git clone https://github.com/xevrion/iitj-lan-autologin
cd iitj-lan-autologin
go build -o iitj-login.exe .
.\iitj-login.exe installAfter installation:
iitj-login installThat setup flow:
- detects the active Ethernet interface
- applies the network fixes that are needed on the current machine
- asks for IITJ LDAP credentials, or lets you keep the stored ones during a reinstall or update
- stores credentials locally in encrypted form
- installs the background service
Available commands:
iitj-login install
iitj-login uninstall
iitj-login login
iitj-login start
iitj-login stop
iitj-login status
iitj-login logs
iitj-login logs --lines 50
iitj-login doctor
iitj-login version
On Linux and macOS, setup also installs a man page:
man iitj-loginiitj-login status prints a readable summary of installation state, service state, configured interface, data location, recent logs, and the last recorded login health signals for the current platform.
iitj-login logs prints recent service logs directly.
iitj-login doctor runs local diagnostics for the most common real-world failures: missing credentials, stopped service, interface problems, hosts entry issues, Docker conflicts, and recent login-loop failures.
The installer is opinionated because the network problems are specific and repeatable.
The login requests must leave through Ethernet, not WiFi. The tool detects the active wired interface and binds requests to that path.
FortiGate authentication is tied to the device MAC address. If the operating system keeps changing the MAC, the session becomes unreliable.
On Linux systems using NetworkManager, the installer attempts to switch the connection to a permanent MAC address.
Docker commonly uses 172.17.0.0/16 for docker0. The captive portal network also uses 172.17.x.x, which can cause the kernel to route portal traffic locally into Docker instead of the real gateway.
The installer detects this and warns about it.
The captive portal hostname is pinned to:
172.17.0.3 gateway.iitj.ac.in
This avoids DNS races where browsers or other tools resolve the public address instead of the internal captive portal address.
When WiFi and Ethernet are both active, the route to the portal can go out through the wrong interface. The installer adds a static route so portal traffic stays on Ethernet.
Credentials are encrypted locally using AES-256-GCM and stored in the user data directory. They are not sent anywhere except the IITJ captive portal.
Platform-specific service setup:
- Linux: systemd user service
- macOS: launchd agent
- Windows: Task Scheduler task
On Windows, the scheduled background login runs without opening a recurring console window during reconnect checks.
FortiGate intercepts a normal HTTP request from an unauthenticated client and returns a redirect flow that eventually exposes a one-time authentication token.
The login loop works like this:
- flush DNS cache where possible
- request
http://neverssl.com - detect captive portal interception
- fetch the FortiGate auth page
- extract the
magicvalue needed for login - POST IITJ LDAP credentials to
https://gateway.iitj.ac.in:1003/ - verify the response indicates a live session
- sleep and repeat
All login traffic is bound to the Ethernet interface and the tool bypasses unreliable name resolution by using the resolved portal IP directly.
If FortiGate is intercepting HTTPS before you are authenticated, the bootstrap curl command may fail with an SSL error.
Options:
- log in once in a browser, then run the bootstrap again
- use
curl -kfor the bootstrap only - clone the repository and build locally
If Docker is using an overlapping 172.17.x.x bridge network, portal traffic may never reach FortiGate.
One fix is to move Docker onto a different default pool:
sudo mkdir -p /etc/docker
echo '{"default-address-pools":[{"base":"10.200.0.0/16","size":24}]}' \
| sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
docker network prune -fIf both WiFi and Ethernet are active, route selection can be wrong. The installer tries to pin the captive portal route to the Ethernet gateway.
| Platform | Data directory |
|---|---|
| Linux | ~/.local/share/iitj-login/ |
| macOS | ~/Library/Application Support/iitj-login/ |
| Windows | %APPDATA%\iitj-login\ |
Typical files:
credentials.enckey.binconfig.jsonservice.logon Windows for background login output
| Platform | Service integration | Status |
|---|---|---|
| Linux with systemd | systemd user service | supported |
| macOS | launchd agent | supported |
| Windows 10 and 11 | Task Scheduler | supported |
| Platform | Environment | Status |
|---|---|---|
| Linux | Fedora 39+ | tested |
| Linux | Ubuntu 22.04+ | tested |
| macOS | Intel and Apple Silicon code paths | not yet verified on real hardware |
| Windows | Windows 11 | tested |
| Windows | Windows 10 code paths | not yet verified on real hardware |
Architectures currently released:
linux/amd64linux/arm64darwin/amd64darwin/arm64windows/amd64windows/arm64
- credentials are encrypted locally with AES-256-GCM
- the encryption key stays on the machine
- there is no telemetry
- there are no external services involved
- everything is open source and reviewable
This project still handles real credentials on your machine, so treat it like any other local automation tool with secrets access.
Release history is tracked in CHANGELOG.md.
Release process for maintainers is documented in RELEASING.md.
This project is not affiliated with IIT Jodhpur.