Commit Graph

411 Commits

Author SHA1 Message Date
Rob White
2876dbbc7b url-encode gatewayname on startup
Allow special characters in gatewayname to be passed to fas/preauth

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-12 14:33:04 +00:00
Rob White
f8936e7d2c Add htmlentities "&" and "+"
Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-12 13:07:58 +00:00
Rob White
beb316166a Shorten MHD version check
Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-10 23:21:53 +00:00
Rob White
15ba5ea4c8 Add option use_outdated_mhd
See issue #515

MHD_get_version is used to determine the installed (runtime) version of
libmicrohttpd (MHD).
If the version is earlier than 0.9.69, then by default, NDS will terminate.

However, if option use_outdated_mhd is set to 1, NDS starts normally
but logs an error.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-10 20:58:40 +00:00
Rob White
dd3d33cbc8 Encode gatewayname at startup
Reduces overhead slightly for templated splash page

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-08 00:58:51 +00:00
Rob White
d9f8d9fe8c Minor cosmetic fixes
Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-08 00:58:51 +00:00
Rob White
d28a80fbff Remove unused constant, multiple cosmetic improvements
Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-08 00:58:51 +00:00
Rob White
9bcc21d723 BinAuth: Prevent ndsctl from running if called from a Binauth script.
See issue #503

If ndsctl is called within a Binauth script it deadlocks as NDS is in
the middle of its client authentication logic when BinAuth is called.
It should not be necessary to run ndsctl from Binauth anyway as it does not
provide any useful post authentation functionality.

This commit prevents ndsctl from being run using a modified version of
the existing ndsctl.lock logic.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-05 19:41:50 +00:00
Rob White
9fb70f3ce2 Add option: option unescape_callback_enabled
Disabled is 0 (default)
Enabled is 1

This allows custom unescape  in MHD.

MHD needs to unescape characters sent in query strings by browsers.
When this option is disabled, MHD uses its builtin unescape.
When enabled, MHD uses /usr/lib/nodogsplash/unescape.sh

The unescape.sh library is safe as all incoming queries are escaped
by the client browser and the argument containing string to be unescaped
is quoted by NDS.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-05 19:41:50 +00:00
Rob White
9a636527e8 Add htmlentityencode function, encode gatewayname in templated splash page
Note on characters in gatewayname:
# ' and " are invalid in both uci config and nodogsplash.conf so cannot be used.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-05 19:41:49 +00:00
Rob White
271f823b3c Preauth: Add missing "=" and add utf-8 to header
Signed-off-by: Rob White <rob@blue-wave.net>
2020-02-05 19:39:49 +00:00
Rob White
0751790030 Fix: Add missing NULL parameter in MHD_OPTION_UNESCAPE_CALLBACK
This caused a subtle memory corruption resulting in MHD failing to start,
starting NDS from the command line to fail unless argument -d2 was used
and probably other strange anomalies. But only some targets eg RPi/Raspian,
but probably not seen on OpenWrt.

Fix was found by @skra72, many thanks.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-27 16:22:10 +00:00
Rob White
07fae43757 Remove unnecessary characters causing script execution failure in Debian
Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-18 20:15:33 +00:00
Rob White
112547a7aa bump to v4.4.1beta
Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-09 11:14:21 +00:00
Rob White
7d6ccf73e5 Ignore trusted mac if invalid
Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-09 09:34:27 +00:00
Rob White
766db1388e Bump to version 4.4.0
Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-09 09:34:27 +00:00
Rob White
494d6e4deb Update copyright dates
Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-09 09:34:26 +00:00
Rob White
36f94f4972 Implement unescape callback for MHD (libmicrohttpd)
This is a fix to allow "+" and "&" characters in user data passed to MHD in get requests.
Reported in issue #476, this effected PreAuth and Binauth.
"+" and "&" characters can now be used in form data, eg passwords etc.

Signed-off-by: Rob White <rob@blue-wave.net>
2020-01-01 15:57:45 +00:00
Rob White
423e328fab fas: get the client interface connections.
When option fas_secure_enabled '2' is set, get the client interface connections.

The client interface connections string is of the form:
[localif] [remotemeshnodemac] [localmeshif]
This is added to the query string as "clientif".
[remotemeshnodemac] and [localmeshif] will be null if  the client is connected
to a local interface or 802.11s mesh networking is not active.

This can be used to change the response of the FAS captive portal login page,
depending on the interface the client is connected to.

Connections to local wireless interfaces and
remote 802.11s mesh node connections are detected.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-12-29 21:48:18 +00:00
Rob White
ab10da729e Bump to v4.3.4
Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-20 07:25:20 +01:00
Rob White
e995d59e92 Version 4.3.3
Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-19 14:16:15 +01:00
Rob White
b040820407 Fix: Memory corruption at high loads.
*  Symptom was spontaneous restart of NDS often with no errors.
  *  Caused by coding error introduced by previous changes.
  *  Added improved checking and debuglevel logging when calling MHD.
  *  Added debuglevel logging for case of firewall restart.
  *  Return error 403(forbidden) rather than 503(internal server error) when client attempts to use a forbidden http method.
  *  Return error 403(forbidden) rather than 503(internal server error) when client attempts to use an invalid ip or mac address.
  *  Revert QUERYMAXLEN to 4096 bytes to prevent query string truncation when a client session deauthenticates whilst client is using some types of vpn software.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-17 10:57:25 +01:00
Alexander Couzens
5e6c228709 ndsctl_auth(): ensure client->id does not change between search and modify
To ensure nodogsplash does not authenticate the wrong user, hold the
client list lock across between searching a client and authenticating it.
2019-10-11 11:57:40 +02:00
Alexander Couzens
1a7a9d2441 fw_iptables: extend the client list lock across iptables execution
iptables uses a lock file (xtables.lock). iptables holds this lock as long the
executable is running which means as long we haven't read all the input.
When iterating over the input lines nodogsplash might run into a dead lock if
another thread of nodogsplash executes iptables.
2019-10-11 11:53:57 +02:00
Rob White
44186e103f Bump to v4.3.3beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-10 14:29:40 +01:00
Rob White
9aadd17e57 nodogsplash: Version 4.3.2
This release Fixes a Debian package build error

This did not effect the OpenWrt package.

There are no other changes from v4.3.1

Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-10 13:05:33 +01:00
Rob White
539aee87f9 Bump to version 4.3.2beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-09 17:05:35 +01:00
Rob White
0a4f84863d nodogsplash: Version 4.3.1
This version provides the fix to an issue in Makefile, introduced in the previous version, that prevents the Debian package from being created.

This does not effect the OpenWrt package.

There are no other changes from v4.3.0

Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-09 15:03:20 +01:00
Rob White
3c4382f10b Bump to v4.3.1beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-08 12:35:13 +01:00
Rob White
9f25ba9f85 Release 4.3.0
* Create switch option to select preinstalled templated splash or preauth login [bluewavenet]
  * Limit PreAuth and BinAuth log size in example scripts [bluewavenet]
  * Reduce memory requirements and autoselect logfile location [bluewavenet]
  * Create fas-hid example script [bluewavenet]
  * Update FAS, PreAuth and BinAuth example scripts [bluewavenet]
  * Hash client token (hid) for remote FAS enabling secure FAS for legacy/low-flash/low-ram hardware [bluewavenet]
  * Fix NDS Uptime if NTP client is enabled [bluewavenet]
  * Documentation updates for this release [bluewavenet]
  * Fix numerous compiler warnings [mwarning]
  * Fix openwrt fw_mark option type [mwarning]

Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-08 08:08:08 +01:00
Rob White
389f845061 Create option login_option_enabled
Allows simple switch between templated splash page and preauth login script.
Disabled:
option login_option_enabled '0'
use config options for FAS if set, or Templated Splash

Enabled:
option login_option_enabled '1'
use preauth login script providing username/email login with access log

Signed-off-by: Rob White <rob@blue-wave.net>
2019-10-06 16:27:24 +01:00
Rob White
2b4e73f31e Fix typo 2019-09-27 19:30:37 +01:00
Rob White
3ea251beec Reduce memory requirements and fix log file location
Save a little memory, useful for legacy devices with low ram.

Default the example script log file to /tmp if on NDS router,
or script file location if elsewhere.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-26 20:06:32 +01:00
Rob White
8694cca00f Create fas-hid script example, update fas-aes and add missing gatewayaddress.
Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-25 22:33:22 +01:00
Rob White
22637a47ad FAS: Introduce hash_id mode.
Enhances security and mitigates issues accessing ndsctl remotely to obtain the client token.

In addition, no additional packages are required allowing legacy low flash/ram devices to be used.

For option fas_secure_enabled '1', NDS adds the hash of the client token (hid) to the query string.
FAS concatenates hid and the fas key and hashes the result.
This new hash is added to the query string returned to NDS instead of the client token.
NDS then compares this hash with one it calculates itself from the client token and the pre-shared key.

For option fas_secure_enabled '2', the FAS can return either the client token in clear text
or can return the concatenated hash as for fas_secure_enabled '1', NDS will detect which is used.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-22 22:45:02 +01:00
Moritz Warning
ce413eab9f suppress warning for unused return value 2019-09-21 20:44:18 +02:00
Moritz Warning
a57b5b1316 Merge branch 'master' of github.com:nodogsplash/nodogsplash 2019-09-21 20:41:05 +02:00
Moritz Warning
3badcecc26 fix compiler warnings 2019-09-21 20:40:42 +02:00
Rob White
baf495ce3c fix: NDS uptime if NTP client enabled
NDS uptime may be from seconds to years (!!) too large if NTP client is
enabled when the system starts and there is no hardware RTC.

NDS started_time is deliberately left untouched, uptime discrepancy is
logged when debuglevel is >1 but uptime is correctly calculated.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-18 15:29:00 +01:00
Rob White
764faf09f7 Bump to version 4.2.1beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-13 21:52:25 +01:00
Rob White
8f7b32906d Bump to version 4.2.0
Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-13 21:16:03 +01:00
Rob White
51f36950bf PreAuth and BinAuth: Pass user agent string to scripts.
Binauth: Pass clientip to script.
Update example scripts
Update documentation

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-13 20:51:30 +01:00
Rob White
4028cc030c Bump to v4.1.1beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-02 20:58:58 +01:00
Rob White
ed36e50b61 Bump to v4.1.0
Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-02 20:25:20 +01:00
Rob White
4ded1a17ee ndsctl: delete lock file if NDS is not started
docs: minor update

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-02 17:25:24 +01:00
Rob White
8fbeee7261 BinAuth: Send redir variable to the binauth script
This enhancement allows custom variables generated by FAS
to be sent to Binauth.

FAS can embed custom variables into redir, allowing
local post authentication processing to take place.

Two example scripts are provided.

The first provides sitewide username/password login for two user groups,
Staff and Guest in the example.
Staff has unlimited access, Guest is limited to 10 minutes per session.

The second provides local logging of NDS logins, even with a remote FAS.

The documentation is fully updated.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-09-02 12:29:05 +01:00
Rob White
9a6c644761 faskey: exit gracefully if not set and fas_secure_enabled =2
Signed-off-by: Rob White <rob@blue-wave.net>
2019-08-23 16:25:37 +01:00
Rob White
6af872bffd Deprecate RedirectURL
redirectURL is now redundant as most CPD implementations immediately close the "splash" page
as soon as NDS authenticates, thus redirectURL will not be shown.
This functionality, ie displaying a particular web page as a final "Landing Page"
can be achieved reliably using FAS, with NDS calling the previous "redirectURL" as the FAS page.

Signed-off-by: Rob White <rob@blue-wave.net>
2019-08-23 15:10:56 +01:00
Rob White
b357f6716d Bump to v4.0.3beta
Signed-off-by: Rob White <rob@blue-wave.net>
2019-08-15 16:06:17 +01:00
Rob White
89a0aadc5b Bump to version 4.0.2
Signed-off-by: Rob White <rob@blue-wave.net>
2019-08-15 15:20:14 +01:00