You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
15 KiB

  1. <!-- markdownlint-disable -->
  2. # travelmate, a wlan connection manager for travel router
  3. ## Description
  4. If you’re planning an upcoming vacation or a business trip, taking your laptop, tablet or smartphone give you the ability to connect with friends or complete work on the go. But many hotels don’t have a secure wireless network setup or you’re limited on using a single device at once. Investing in a portable, mini travel router is a great way to connect all of your devices at once while having total control over your own personalized wireless network.
  5. A logical combination of AP+STA mode on one physical radio allows most of OpenWrt supported router devices to connect to a wireless hotspot/station (STA) and provide a wireless access point (AP) from that hotspot at the same time. Downside of this solution: whenever the STA interface looses the connection it will go into an active scan cycle which renders the radio unusable for AP mode operation, therefore the AP is taken down if the STA looses its association.
  6. To avoid these kind of deadlocks, travelmate will set all station interfaces to an "always off" mode and connects automatically to available/configured hotspots.
  7. ## Main Features
  8. * STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible
  9. * easy setup within normal OpenWrt environment
  10. * strong LuCI-Support with builtin interface wizard and a wireless station manager
  11. * render the QR-Code of the selected Access Point in LuCI to comfortably transfer the WLAN credentials to your mobile devices
  12. * fast uplink connections
  13. * support all kinds of uplinks, incl. hidden and enterprise uplinks (WEP-based uplinks are no longer supported!)
  14. * continuously checks the existing uplink connection (quality), e.g. for conditional uplink (dis-) connections
  15. * automatically add open uplinks to your wireless config, e.g. hotel captive portals
  16. * captive portal detection with internet online check and a 'heartbeat' function to keep the uplink connection up & running
  17. * captive portal auto-login hook (configured via uci/LuCI), you are able to reference an external script for captive portal auto-logins (see example below)
  18. * includes a vpn hook with support for 'wireguard' or 'openvpn' client setups to handle VPN (re-) connections automatically
  19. * includes an email hook to 'msmtp' to send notification e-mails after every succesful uplink connect
  20. * proactively scan and switch to a higher prioritized uplink, despite of an already existing connection
  21. * connection tracking which keeps start and end date of an uplink connection
  22. * automatically disable the uplink after n minutes, e.g. for timed connections
  23. * automatically (re-)enable the uplink after n minutes, e.g. after failed login attempts
  24. * option to generate a random unicast MAC address for each uplink connection
  25. * ntp time sync before sending emails
  26. * support devices with multiple radios in any order
  27. * procd init and ntp-hotplug support
  28. * runtime information available via LuCI & via 'status' init command
  29. * status & debug logging to syslog
  30. ## Prerequisites
  31. * [OpenWrt](https://openwrt.org), only compatible with the forthcoming stable 20.x or the latest OpenWrt snapshot
  32. * 'dnsmasq' as dns backend
  33. * 'iwinfo' for wlan scanning
  34. * 'curl' for connection checking and all kinds of captive portal magic, e.g. cp detection and auto-logins
  35. * a 'wpad' variant to support various WPA encrypted networks (WEP-based uplinks are no longer supported!)
  36. * optional: 'qrencode' for AP QR code support
  37. * optional: 'wireguard' or 'openvpn' for vpn client connections
  38. * optional: 'msmtp' to send out travelmate related status messages via email
  39. ## Installation & Usage
  40. * **Please note:** before you start with travelmate ...
  41. * you should setup at least one Access Point, ideally on a separate radio,
  42. * if you're updating from a former 1.x release, please use the '--force-reinstall --force-maintainer' options in opkg,
  43. * and remove any existing travelmate related uplink stations in your wireless config manually
  44. * download [travelmate](https://downloads.openwrt.org/snapshots/packages/x86_64/packages)
  45. * download [luci-app-travelmate](https://downloads.openwrt.org/snapshots/packages/x86_64/luci)
  46. * install both packages (_opkg install travelmate_, _opkg install luci-app-travelmate_)
  47. * the LuCI application is located under the 'Services' menu
  48. * start the travelmate 'Interface Wizard' once
  49. * add multiple uplink stations as you like via the 'Wireless Stations' tab
  50. * happy traveling ...
  51. ## Travelmate config options
  52. * usually the pre-configured travelmate setup works quite well and no manual config overrides are needed, all listed options apply to the 'global' section:
  53. | Option | Default | Description/Valid Values |
  54. | :----------------- | :--------------------------------- | :---------------------------------------------------------------------------------------------------- |
  55. | trm_enabled | 0, disabled | set to 1 to enable the travelmate service (this will be done by the Interface Wizard as well!) |
  56. | trm_debug | 0, disabled | set to 1 to get the full debug output (logread -e "trm-") |
  57. | trm_iface | -, not set | uplink- and procd trigger network interface, configured by the 'Interface Wizard' |
  58. | trm_radio | -, not set | restrict travelmate to a single radio or change the overall scanning order ('radio1 radio0') |
  59. | trm_captive | 1, enabled | check the internet availability and handle captive portal redirections |
  60. | trm_netcheck | 0, disabled | treat missing internet availability as an error |
  61. | trm_proactive | 1, enabled | proactively scan and switch to a higher prioritized uplink, despite of an already existing connection |
  62. | trm_autoadd | 0, disabled | automatically add open uplinks like hotel captive portals to your wireless config |
  63. | trm_randomize | 0, disabled | generate a random unicast MAC address for each uplink connection |
  64. | trm_triggerdelay | 2 | additional trigger delay in seconds before travelmate processing begins |
  65. | trm_maxretry | 3 | retry limit to connect to an uplink |
  66. | trm_minquality | 35 | minimum signal quality threshold as percent for conditional uplink (dis-) connections |
  67. | trm_maxwait | 30 | how long should travelmate wait for a successful wlan uplink connection |
  68. | trm_timeout | 60 | overall retry timeout in seconds |
  69. | trm_scanbuffer | 1024 | buffer size in bytes to prepare nearby scan results |
  70. | trm_captiveurl | http://captive.apple.com | four pre-configured provider URLs that will be used for connectivity- and captive portal checks |
  71. | trm_useragent | Mozilla/5.0 (X11; Linux x86_64... | five pre-configured user agents that will be used for connectivity- and captive portal checks |
  72. | trm_nice | 0, normal priority | change the priority of the travelmate background processing |
  73. | trm_vpn | 0, disabled | automatically handle VPN (re-) connections |
  74. | trm_vpnservice | -, not set | reference the already configured 'wireguard' or 'openvpn' client instance as vpn provider |
  75. | trm_vpniface | -, not set | the logical vpn interface, e.g. 'wg0' or 'tun0' |
  76. | trm_laniface | -, not set | the logical lan network interface, e.g. 'br-lan' |
  77. | trm_mail | 0, disabled | sends notification e-mails after every succesful uplink connect |
  78. | trm_mailreceiver | -, not set | e-mail receiver address for travelmate notifications |
  79. | trm_mailsender | no-reply@travelmate | e-mail sender address for travelmate notifications |
  80. | trm_mailtopic | travelmate connection to '<sta>' | topic for travelmate notification E-Mails |
  81. | trm_mailprofile | trm_notify | profile used by 'msmtp' for travelmate notification E-Mails |
  82. * per uplink exist an additional 'uplink' section in the travelmate config, with the following options:
  83. | Option | Default | Description/Valid Values |
  84. | :----------------- | :--------------------------------- | :---------------------------------------------------------------------------------------------------- |
  85. | enabled | 1, enabled | enable or disable the uplink, automatically set if the retry limit or the conn. expiry was reached |
  86. | device | -, not set | match the 'device' in the wireless config section |
  87. | ssid | -, not set | match the 'ssid' in the wireless config section |
  88. | bssid | -, not set | match the 'bssid' in the wireless config section |
  89. | con_start | -, not set | connection start (will be automatically set after a successful ntp sync) |
  90. | con_end | -, not set | connection end (will be automatically set after a successful ntp sync) |
  91. | con_start_expiry | 0, disabled | automatically disable the uplink after n minutes, e.g. for timed connections |
  92. | con_end_expiry | 0, disabled | automatically (re-)enable the uplink after n minutes, e.g. after failed login attempts |
  93. | script | -, not set | reference to an external auto login script for captive portals |
  94. | script_args | -, not set | optional runtime args for the auto login script |
  95. ## VPN client setup
  96. Please follow one of the following guides to get a working vpn client setup on your travel router:
  97. * [Wireguard client setup guide](https://openwrt.org/docs/guide-user/services/vpn/wireguard/client)
  98. * [OpenVPN client setup guide](https://openwrt.org/docs/guide-user/services/vpn/openvpn/client)
  99. Once your vpn client connection is running, you can reference to that setup in travelmate to handle VPN (re-) connections automatically.
  100. ## E-Mail setup
  101. To use E-Mail notifications you have to setup the package 'msmtp'.
  102. Modify the file '/etc/msmtprc', e.g. for gmail:
  103. <pre><code>
  104. [...]
  105. defaults
  106. auth on
  107. tls on
  108. tls_certcheck off
  109. timeout 5
  110. syslog LOG_MAIL
  111. [...]
  112. account trm_notify
  113. host smtp.gmail.com
  114. port 587
  115. from xxx@gmail.com
  116. user yyy
  117. password zzz
  118. </code></pre>
  119. Finally enable E-Mail support in travelmate and add a valid E-Mail receiver address.
  120. ## Captive Portal auto-logins
  121. For automated captive portal logins you can reference an external shell script per uplink. All login scripts should be executable and located in '/etc/travelmate' with the extension '.login'. Currently the package ships five ready to run auto-login scripts:
  122. * 'wifionice.login' for german ICE hotspots
  123. * 'db-bahn.login' for german DB railway hotspots via portal login API (still WIP, only tested at Hannover central station)
  124. * 'chs-hotel.login' for german chs hotels
  125. * 'h-hotels.login' for Telekom hotspots in german h+hotels
  126. * 'generic-user-pass.login' a template to demonstrate the optional parameter handling in login scripts
  127. A typical and successful captive portal login looks like this:
  128. <pre><code>
  129. [...]
  130. Thu Sep 10 13:30:16 2020 user.info trm-2.0.0[26222]: captive portal domain 'www.wifionice.de' added to to dhcp rebind whitelist
  131. Thu Sep 10 13:30:19 2020 user.info trm-2.0.0[26222]: captive portal login '/etc/travelmate/wifionice.login ' for 'www.wifionice.de' has been executed with rc '0'
  132. Thu Sep 10 13:30:19 2020 user.info trm-2.0.0[26222]: connected to uplink 'radio1/WIFIonICE/-' with mac 'B2:9D:F5:96:86:A4' (1/3)
  133. [...]
  134. </code></pre>
  135. Hopefully more scripts for different captive portals will be provided by the community!
  136. ## Runtime information
  137. **receive travelmate runtime information:**
  138. <pre><code>
  139. root@2go_ar750s:~# /etc/init.d/travelmate status
  140. ::: travelmate runtime information
  141. + travelmate_status : connected (net ok/100)
  142. + travelmate_version : 2.0.0
  143. + station_id : radio1/WIFIonICE/-
  144. + station_mac : B2:9D:F5:96:86:A4
  145. + station_interface : trm_wwan
  146. + wpa_flags : sae: ✔, owe: ✔, eap: ✔, suiteb192: ✔
  147. + run_flags : captive: ✔, proactive: ✔, netcheck: ✘, autoadd: ✘, randomize: ✔
  148. + ext_hooks : ntp: ✔, vpn: ✘, mail: ✘
  149. + last_run : 2020.09.10-15:21:19
  150. + system : GL.iNet GL-AR750S (NOR/NAND), OpenWrt SNAPSHOT r14430-2dda301d40
  151. </code></pre>
  152. To debug travelmate runtime problems, please always enable the 'trm\_debug' flag, restart travelmate and check the system log afterwards (_logread -e "trm-"_)
  153. ## Support
  154. Please join the travelmate discussion in this [forum thread](https://forum.lede-project.org/t/travelmate-support-thread/5155) or contact me by [mail](mailto:dev@brenken.org)
  155. ## Removal
  156. * stop the travelmate daemon with _/etc/init.d/travelmate stop_
  157. * optional: remove the travelmate package (_opkg remove luci-app-travelmate_, _opkg remove travelmate_)
  158. Have fun!
  159. Dirk