Update automated login script
authorJoerg Jaspert <joerg@debian.org>
Mon, 24 Jul 2017 07:32:45 +0000 (09:32 +0200)
committerJoerg Jaspert <joerg@debian.org>
Thu, 27 Jul 2017 08:18:48 +0000 (10:18 +0200)
_posts/2017-07-24-automated-wifi-login-update.md [new file with mode: 0644]

diff --git a/_posts/2017-07-24-automated-wifi-login-update.md b/_posts/2017-07-24-automated-wifi-login-update.md
new file mode 100644 (file)
index 0000000..76a9482
--- /dev/null
@@ -0,0 +1,40 @@
+---
+layout: post
+title: "Automated wifi login, update"
+published: true
+categories:
+- tech
+tags:
+- wifi
+- network-manager
+- dispatcher.d
+- script
+- bash
+date: '2017-07-24 09:24:42 +0200'
+---
+With recent changes the [automated login script]({{ site.baseurl }}{% post_url 2017-07-24-automated-wifi-login-update %})
+for WifiOnICE stopped working. Fortunately a fix is easy, it is enough
+to add a referrer header to the call.
+
+{% highlight bash %}
+#!/bin/bash
+
+# (Some) docs at
+# https://wiki.ubuntuusers.de/NetworkManager/Dispatcher/
+
+IFACE=${1:-"none"}
+ACTION=${2:-"up"}
+
+case ${ACTION} in
+    up)
+        CONID=${CONNECTION_ID:-$(iwconfig $IFACE | grep ESSID | cut -d":" -f2 | sed 's/^[^"]*"\|"[^"]*$//g')}
+        if [[ ${CONID} == WIFIonICE ]]; then
+            /usr/bin/timeout -k 20 15 /usr/bin/wget -q -O - --referer http://www.wifionice.de/de/ http://www.wifionice.de/?login > /dev/null
+        fi
+        ;;
+    *)
+        # We are not interested in this
+        :
+        ;;
+esac
+{% endhighlight %}