NetworkManager: Detection of Captive Portals on Debian Jessie/Stretch (self-hosted)

NetworkManager provides connectivity checking to test for captive portals since GNOME 3.14. This performs recurring checks on a configurable URL. In case this does not deliver the expected response, NetworkManager knows we are very probably behind a captive portal and opens the corresponding login page.

This connectivity checking is an optional feature and not enabled by default in Debian Jessie or Squeeze. To enable this we can simple add a configuration file in /etc/NetworkManager/conf.d containing three settings:

response=NetworkManager is online

This will check every 300 seconds and expects to find the string “NetworkManager is online” in the HTML response.

For privacy reasons you might not want to test a public URL though. We could however simply host the URL to be checked ourselves. The NetworkManager documentation gives a few more details about the three settings. We mainly need to set the URI to a web site that either returns the header “X-NetworkManager-Status” with a value of “online” or returns the string specified using “response” in its body.

Given a running Apache web server with mod_headers enabled we can simply define a vhost like this:

<VirtualHost *:80>

  ## Vhost docroot
  DocumentRoot "/var/www/empty"

  ## Directories, there should at least be a declaration for /var/www/empty

  <Directory "/var/www/empty">
    Header Set X-NetworkManager-Status "online"
    AllowOverride None
    Require all granted

  ## Logging
  ErrorLog "/var/log/apache2/connectivity-check.example.net_error.log"
  ServerSignature Off
  CustomLog "/var/log/apache2/connectivity-check.example.net_access.log" combined

and configure NetworkManager using the following in /etc/NetworkManager/conf.d/10-connectivity.conf:



  • Enabling captive portal detection in GNOME 3.14 on Debian Jessie by L Guruprasad
  • NetworkManager.conf documentation
  • Installing pine on Debian

    Before I forget it again… To install pine from the Debian sources just do the following:
    # apt-get --only-source build-dep pine
    # apt-get --only-source -b source pine
    # dpkg -i <packagefile>

    You need to have the matching deb-src lines in /etc/apt/sources.list.
    The first command will install the the dependencies needed to build, the second will get the sources and build a the package file in /usr/src/ which can be installed with the last one then.
    To choose from stable/testing/unstable just add -t stable/testing/unstable to the apt-get lines.
    An easy way to keep the latest version, is to install the pine-tracker package.