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.

125 lines
5.5 KiB

  1. ![ApFreeWiFiDog](https://github.com/liudf0716/apfree_wifidog/blob/master/logo.png)
  2. [![license][1]][2]
  3. [![PRs Welcome][3]][4]
  4. [![Issue Welcome][5]][6]
  5. [![Release Version][7]][8]
  6. [![OpenWRT][11]][12]
  7. [![Join the QQ Group][15]][16]
  8. [1]: https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic
  9. [2]: https://github.com/liudf0716/apfree_wifidog/blob/master/COPYING
  10. [3]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=plastic
  11. [4]: https://github.com/liudf0716/apfree_wifidog/pulls
  12. [5]: https://img.shields.io/badge/Issues-welcome-brightgreen.svg?style=plastic
  13. [6]: https://github.com/liudf0716/apfree_wifidog/issues/new
  14. [7]: https://img.shields.io/badge/release-3.11.1716-red.svg?style=plastic
  15. [8]: https://github.com/liudf0716/apfree_wifidog/releases
  16. [11]: https://img.shields.io/badge/Platform-%20OpenWRT%7C%20LEDE%20-brightgreen.svg?style=plastic
  17. [12]: https://github.com/KunTengRom/kunteng-lede-17.01.4
  18. [13]: https://img.shields.io/badge/KunTeng-Inside-blue.svg?style=plastic
  19. [14]: https://www.kunteng.org.cn
  20. [15]: https://img.shields.io/badge/chat-qq%20group-brightgreen.svg
  21. [16]: https://jq.qq.com/?_wv=1027&k=4ADDSev
  22. ## ApFree WiFiDog: A high performance captive portal solution for HTTP(s)
  23. ApFree WiFiDog is a high performance captive portal solution for HTTP(s), which mainly used in ([LEDE](https://github.com/lede-project/source)&[Openwrt](https://github.com/openwrt/openwrt)) platform.
  24. **[中文介绍](https://github.com/liudf0716/apfree_wifidog/blob/master/README_ZH.md)**
  25. ## Enhancement of apfree-wifidog
  26. In fact, the title should be why we choose apfree-wifidog, the reason was the following:
  27. > Stable
  28. apfree-wifidog was widely used in tens of thousands device, which were running in business scene. In order to improve its stable, we rewrite all iptables rule by api instead of fork call, which will easily cause deadlock in multithread-fork running environment. we also re-write the code and replace libhttpd (which unmaitained for years) with libevent
  29. > Performance
  30. apfree-wifidog's http request-response is more quick, u can find statistic data in our test document
  31. > HTTPs redirect
  32. apfree-wifidog support https redirect, in current internet environment, captive portal solution without supporting https redirect will become unsuitable gradually
  33. > More features
  34. apfree-wifidog support mac temporary-pass, ip,domain,pan-domain,white-mac,black-mac rule and etc. all these rules can be applied without restarting wifidog
  35. > MQTT support
  36. by enable mqtt support, u can remotely deliver such as trusted ip, domian and pan-domain rules to apfree wifidog
  37. > Compitable with wifidog protocol
  38. u don't need to modify your wifidog authentication server to adapt apfree-wifidog; if u have pression on server-side, apfree wifidog's improved protocol can greatly relieve it, which disabled by default
  39. ## Getting started
  40. before starting apfree-wifidog, we must know how to configure it. apfree-wifidog use OpenWrt standard uci config system, all your apfree-wifidog configure information stored in `/etc/confg/wifidogx`, which will be parsed by `/etc/init.d/wifidogx` to /tmp/wifidog.conf, apfree-wifidog's real configure file is `/tmp/wifidog.conf`
  41. The default apfree-wifidog UCI configuration file like this:
  42. ```
  43. config wifidog
  44. option gateway_interface 'br-lan'
  45. option auth_server_hostname 'wifidog.kunteng.org.cn'
  46. option auth_server_port 443
  47. option auth_server_path '/wifidog/'
  48. option check_interval 60
  49. option client_timeout 5
  50. option apple_cna 1
  51. option thread_number 5
  52. option wired_passed 0
  53. option enable 0
  54. ```
  55. > auth_server_hostname was apfree-wifidog auth server, it can be domain or ip; wifidog.kunteng.org.cn is a free auth server we provided, it was also [open source](https://github.com/wificoin-project/wwas)
  56. > apple_cna 1 apple captive detect deceive; 2 apple captive detect deceive to disallow portal page appear
  57. > wired_passed means whether LAN access devices need to auth or not, value 1 means no need to auth
  58. > enable means whether start apfree-wifidog when we executed `/etc/init.d/wifidogx start`, if u wanted to start apfree-wifidog, you must set enable to 1 before executing `/etc/init.d/wifidogx start`
  59. ### How to support https redirect
  60. In order to support https redirect, apfree-wifidog need x509 pem cert and private key, u can generate youself like this:
  61. ```
  62. PX5G_BIN="/usr/sbin/px5g"
  63. OPENSSL_BIN="/usr/bin/openssl"
  64. APFREE_CERT="/etc/apfree.crt"
  65. APFREE_KEY="/etc/apfree.key"
  66. generate_keys() {
  67. local days bits country state location commonname
  68. # Prefer px5g for certificate generation (existence evaluated last)
  69. local GENKEY_CMD=""
  70. local UNIQUEID=$(dd if=/dev/urandom bs=1 count=4 | hexdump -e '1/1 "%02x"')
  71. [ -x "$OPENSSL_BIN" ] && GENKEY_CMD="$OPENSSL_BIN req -x509 -sha256 -outform pem -nodes"
  72. [ -x "$PX5G_BIN" ] && GENKEY_CMD="$PX5G_BIN selfsigned -pem"
  73. [ -n "$GENKEY_CMD" ] && {
  74. $GENKEY_CMD \
  75. -days ${days:-730} -newkey rsa:${bits:-2048} -keyout "${APFREE_KEY}.new" -out "${APFREE_CERT}.new" \
  76. -subj /C="${country:-CN}"/ST="${state:-localhost}"/L="${location:-Unknown}"/O="${commonname:-ApFreeWiFidog}$UNIQUEID"/CN="${commonname:-ApFreeWiFidog}"
  77. sync
  78. mv "${APFREE_KEY}.new" "${APFREE_KEY}"
  79. mv "${APFREE_CERT}.new" "${APFREE_CERT}"
  80. }
  81. }
  82. ```
  83. or when u start `/etc/init.d/wifidogx start`, it will generate it automatically
  84. For more information, please refer to the upstream [project page](https://github.com/liudf0716/apfree_wifidog)