Which router did you use? On a single radio router a small outage during (re-)connection (not during scanning!) is normal due to wireless reloading activities. That's the reasion for the "always off" quotes ... :wink:

Good news, the telekom auto-login script has been finished today! :wink: Maybe someone is willing to test that script with travelmate 2.x, just copy it to /etc/travelmate, make it executable and select the script with a telekom hotspot. The script expects 2 parameters: the username and the password:

#!/bin/sh
# captive portal auto-login script for telekom hotspots (DE)
# Copyright (c) 2021 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.

# set (s)hellcheck exceptions
# shellcheck disable=1091,3040,3043,3057

export LC_ALL=C
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
set -o pipefail

# source function library if necessary
#
if [ -z "${_C}" ]; then
    . "/lib/functions.sh"
fi

# url encoding function
#
urlencode()
{
    local chr str="${1}" len="${#1}" pos=0

    while [ "${pos}" -lt "${len}" ]; do
        chr="${str:pos:1}"
        case "${chr}" in
            [a-zA-Z0-9.~_-])
                printf "%s" "${chr}"
                ;;
            " ")
                printf "%%20"
                ;;
            *)
                printf "%%%02X" "'${chr}"
                ;;
        esac
        pos=$((pos + 1))
    done
}

username="$(urlencode "${1}")"
password="$(urlencode "${2}")"
trm_domain="telekom.portal.fon.com"
trm_useragent="$(uci_get travelmate global trm_useragent "Mozilla/5.0 (Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0")"
trm_captiveurl="$(uci_get travelmate global trm_captiveurl "http://detectportal.firefox.com")"
trm_maxwait="$(uci_get travelmate global trm_maxwait "30")"
trm_fetch="$(command -v curl)"

# get login url
#
raw_html="$(${trm_fetch} --user-agent "${trm_useragent}" --referer "http://www.example.com" --connect-timeout $((trm_maxwait / 6)) --location --silent --show-error "${trm_captiveurl}")"
redirect_url="$(printf "%s" "${raw_html}" | awk 'match(tolower($0),/<loginurl>.*<\/loginurl>/){printf "%s",substr($0,RSTART+10,RLENGTH-21)}' 2>/dev/null | awk '{gsub("&amp;","\\&");printf "%s",$0}' 2>/dev/null)"
if [ -z "${redirect_url}" ]; then
    exit 1
fi

# final login request
#
raw_html="$("${trm_fetch}" --user-agent "${trm_useragent}" --referer "https://${trm_domain}" --connect-timeout $((trm_maxwait / 6)) --header "content-type: application/x-www-form-urlencoded" --location --silent --show-error --data "UserName=${username}&Password=${password}&FNAME=0&button=Login&OriginatingServer=http%3A%2F%2F${trm_captiveurl}" "${redirect_url}")"
login_url="$(printf "%s" "${raw_html}" | awk 'match(tolower($0),/<logoffurl>.*<\/logoffurl>/){printf "%s",substr($0,RSTART+11,RLENGTH-23)}' 2>/dev/null)"
if [ -z "${login_url}" ]; then
    exit 2
fi
2 Likes

In case anyone needs it, I made a script to auto-login into Vodafone Hotspot access points. In my case it disconnects every 30 minutes, so it is still annoying as hell, but its the only thing I have to work with. I was also a bit lazy and used jq to handle the API responses, so that has to be installed.


#!/usr/bin/env ash
# captive portal auto-login script for Vodafone Hotspot
# Copyright (c) 2021 Sven Grunewaldt (strayer@olle-orks.org)
# This is free software, licensed under the GNU General Public License v3.

# shellcheck disable=1091,2187

export LC_ALL=C
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
set -euo pipefail

if [ "$(uci_get 2>/dev/null; printf "%u" "${?}")" = "127" ]
then
	. "/lib/functions.sh"
fi

trm_useragent="$(uci_get travelmate global trm_useragent "Mozilla/5.0 (Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0")"
trm_maxwait="$(uci_get travelmate global trm_maxwait "30")"
trm_fetch="$(command -v curl)"

# get session id
SESSION_ID=$("${trm_fetch}" https://hotspot.vodafone.de/api/v4/session --user-agent "${trm_useragent}" --silent --connect-timeout $((trm_maxwait/6)) | jq -r '.session')

# login
RESULT=$("${trm_fetch}" -H 'Content-Type: application/json' --user-agent "${trm_useragent}" --silent --connect-timeout $((trm_maxwait/6)) --request POST --data "{\"loginProfile\": 2, \"accessType\": \"termsOnly\", \"session\": \"${SESSION_ID}\"}" https://hotspot.vodafone.de/api/v4/login 2>/dev/null | jq -r '.message')

if [ "$RESULT" = "OK" ]; then
  exit 0
else
  echo "$RESULT"
  exit 1
fi

# vim: ft=sh

Thanks, meanwhile I've opened a PR for travelmate 2.0.4 which includes a vodafone auto-login script as well (without any disconnect problems so far). See https://github.com/openwrt/packages/pull/16221 for reference.

Interesting! In think the two are only loosely related though. Looks like the script you have in that PR is for people with Vodafone contracts sharing their own wifi and in turn getting unlimited access to other shared wifis. I’m using a free wifi hotspot provided by my hotel that is limited to 30 minutes:

It may be possible to reuse the code that gets the session ID without jq, but I don’t intend to spend more time on this since it works fine, apart from the forced Wifi disconnect I can’t do anything about (apart from adding a USB wifi dongle to get another radio and do some kind of automatic failover, but I also want to have some bit of vacation here :D)

1 Like

That may be it! I was using a TP-Link TL-WR802N v4 ... expect issues with that one?

FYI, now trying my RAVPower RP-WD009 ... can't get that to work at all, after 15 min, Wi-Fi (AP) still up and down :frowning_face:.

Thanks!

I don't know such devices. Please connect via cable ethernet to the boxes (if possible), enable debug logging and check the logs.

1 Like

I'm setting up a new router for travel. How does Travelmate(1.5.5) handle captive portals with mac address in the url?
I thought I could clone my notebook MAC so the correct MAC gets in the URL to authenticate the router.
There's lots of places to set it manually (19.07.7) , but it never actually changes any wifi MAC (MT7621) including the Travelmate one.
Windows drivers don't let me spoof the notebook mac either unless it has 2,6,A,E so I can't do it that either.
Maybe I'm chasing my tail, is this already something Travelmate will do ?

Travelmate 2.x supports mac randomization (use a different mac address with every re-connect). To set a hardcoded mac address just add the option 'macaddr' in the relevant STA section of your wireless config, e.g.:

config wifi-iface 'trm_uplink5'
	option device 'radio0'
	option mode 'sta'
	option network 'trm_wwan'
	option ssid 'blackhole.nl'
	option bssid '...'
	option encryption 'sae-mixed'
	option key '...'
	option macaddr '62:9D:BB:61:EF:DA'

I have 1.5.5, I don't have any random function, although that's opposite what I need :slight_smile:
I tried mac in config wifi-iface already , it caused failed connection. I just did it again now, as follows, using a previously working connection:

config wifi-iface 'radio1_Beast_AC_'
        option network 'trm_wwan'
        option device 'radio1'
        option mode 'sta'
        option ssid 'Beast-AC'
        option key '*******'
        option encryption 'psk2'
        option macaddr '62:9D:BB:61:EF:DA'
        option disabled '0'

I saved that, reboot, I get this:

[  197.547804] wlan1: send auth to 04:a1:f1:bc:f6:15 (try 1/3)
[  197.690689] wlan1: send auth to 04:a1:f1:bc:f6:15 (try 2/3)
[  197.820151] wlan1: send auth to 04:a1:f1:bc:f6:15 (try 3/3)
[  197.969735] wlan1: authentication with 04:a1:f1:bc:f6:15 timed out
[  207.423704] wlan1: authenticate with 04:a1:f1:bc:f6:15
[  207.428923] wlan1: capabilities/regulatory prevented using AP HT/VHT configuration, downgraded

I changed every country code to "world" and rebooted again, same thing.

The router "BEAST_AC" is dd-wrt, it has regulatory mode turned off. Then also tried with my Arcadyn mesh ,
also connecting first, making sure it works, THEN adding the mac, then I get this:

[   65.049617] wlan1: authenticate with 94:fa:b0:4f:1e:cb
[   65.068306] wlan1: send auth to 94:fa:b0:4f:1e:cb (try 1/3)
[   65.296633] wlan1: send auth to 94:fa:b0:4f:1e:cb (try 2/3)
[   65.588658] wlan1: send auth to 94:fa:b0:4f:1e:cb (try 3/3)
[   65.897156] wlan1: authentication with 94:fa:b0:4f:1e:cb timed out

Then I removed just the MAC line, reboot, connect no problem again.

[   38.056701] wlan1: send auth to 04:a1:f1:bc:f6:15 (try 1/3)
[   38.063188] wlan1: authenticated

Question, that DOES work for you, for sure? Do you think the same issue that prevents me from changing the MAC manually on this router, causes Travelmate to fail too?

I just noticed everything above is lower case, except my mac override. Hmm Trying again....

nope, I took all the letters out of the MAC override, just numbers. same thing

Yep, for almost two years ...:wink: Maybe you should give 21.x (the forthcoming stable release) a chance.

P.S. Please make sure to use always valid unicast mac addresses.

OK, I have 21.02.0 rc3 running. This router is MT6721.
Page 1 gives a link the to package names, but they are x86...
Openwrt is "ramips-mt7621" , I don't see a directory for "ramips"
https://downloads.openwrt.org/releases/packages-21.02/

My newb is showing, where do I get Travelmate + Luci app for this router?

https://downloads.openwrt.org/snapshots/packages/ ..... lots of mips, no ramips ?

mipsel_24kc, but opkg install <package> should find everything itself after opkg update (if you have internet access for the initial setup).

slh - Cool, yes it did. I thought that pointed at stable 1.55, I didn't think it would be that easy, lol. TY

Is this for the telekom,portal.fon.com hotspot?

Yep, 'telekom.portal.fon.com' to be precise. It looks like this ... and it's included in travelmate 2.0.4.

Yes. I set mine up. But it is not working. It still redirects to that page and gets me to login.

Maybe because mine looks like this

What's your username? Your t-mobile number? If so, please add the suffix "@t-mobile.de" to your phone number.