Consider using GNOME's captive portal handling
See https://help.gnome.org/misc/release-notes/3.14/. It might be good for us, but it might as well be dangerous so to start with it is disabled in Tails/Jessie (#10526 (closed)).
This is implemented via the “connectivity” feature, see e.g.
contrib/fedora/rpm/20-connectivity-fedora.conf
in NM’s Git
tree
to see what kind of parameters it can take: basically, it just calls
home via a HTTP request, and checks if it gets the expected response —
see NetworkManager.conf(5)
for details.
It also seems that another component of this feature (the “login agent”)
was implemented in GNOME Shell (see
https://bugzilla.gnome.org/show_bug.cgi?id=609870, that gives a little
bit more details); see e.g. grep -iE (connectivity|portal)
in Jessie’s
GNOME Shell source => we should have a close look there too. Frederic
Peters wrote that “Up in the stack GNOME Shell will automatically popup
a window embedding a webkit widget set on the given URI (and thus,
displaying the captive portal)”.
How to test on Debian
Note: NetworkManager's connectivity check does not work well with the strict, default, rp_filter
settings. Hence the more relaxed policy set below.
- Set things up
sudo apt install network-manager-config-connectivity-debian
sudo tee /etc/sysctl.d/network-manager-connectivity.conf <<EOF
net.ipv4.conf.default.rp_filter=2
net.ipv4.conf.all.rp_filter=2
net.ipv4.conf.*.rp_filter=2
EOF
- Reboot.
- Connect to a network without a captive portal
- You should see the Wi-Fi/ethernet icon on the top right briefly include a "?", while connectivity is checked.
- Connect to a network with a captive portal
- You should see a webkit popup with the captive portal web page