Commit Graph

61 Commits

Author SHA1 Message Date
Neil Lathwood
14a143a6a7 fix: Fixed http-auth not honouring http_auth_guest (#6699)
* fix: Fixed http-auth not honouring http_auth_guest

* Always fall back to http_auth_guest.
Make sure $username is set, otherwise, we won't try to authenticate.

* reverted elseif to default to http-auth-guest

* Update authenticate.inc.php

simplify logic
2017-05-23 08:40:57 +01:00
Tony Murray
4d0c75343e fix: Two-Factor Authentication (#6672)
* fix: Two-Factor Auth
Moved library to a class to take advantage of namespacing and auto loading.
Update the two factor code to use the AuthenticationException for error messages.
Fix remember me to work with 2fa.

* missing change
2017-05-18 22:08:10 +01:00
Tony Murray
155d9de8dc fix: two-factor auth and restore some auth speed regressions (#6649) 2017-05-15 23:13:07 -05:00
Tony Murray
683a10e723 fix: Improve authentication load time and security (#6615)
* fix: minimize session open time
page/graphs speedup part 2

Write close the session as soon as we no longer need to write to it. Prevents the session from blocking other requests.
Do not run through full authentication functions if the session is already authenticated.
Removes password from the session as well as some items to prevent session fixation from #4608.

WARNING: This will cause issues for ad/ldap users who do not have a bind user configured!

* Do no erase username when using cookie auth.
Properly close the session in ajax_setresolution.php

* write close the session as soon as possible in ajax_setresolution.php

* Remove session regeneration. It is not compatible with the current code and would require more changes.

* Totally refactor authentication.  Extract code to functions for re-use and improved readability

* Use exceptions for authentication and error logging
Tested: mysql, ad_auth with and without bind user

* fix a couple scrutinizer issues

* fix reauthenticate in radius
2017-05-15 22:18:23 -05:00
Chris Putnam
02017068e7 Fix redirect on login for instances behind reverse proxies (#6371)
* Fix redirect on login for instances

On instances where base_url has been set for use behind a reverse proxy, logins are incorrectly redirected.

This happens because REQUEST_URI is set by the proxy:
  1. librenms has base_url set to http://site.com/nms/
  2. Browser requests http://site.com/nms/
  3. nginx reverse proxies /nms/ to librenms at http://somehost:1234/
  4. librenms sees REQUEST_URI as "/"
  5. librenms logs the user in, but sends "Location: /" to the browser. This redirects to the wrong location.

To resolve, concatenate REQUEST_URI (which is relative) to base_url. As base_url is slash-terminated, crop the trailing slash. This should have no effect on users with default settings and will correctly redirect instances behind reverse proxies.

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

* Adding comment explaining redirect logic on login

* Use rtrim instead of substr
2017-04-06 09:11:39 +00:00
Tony Murray
1ea7af424b feature: bind user for active_directory auth (#6255)
* feature: bind user for active_directory auth
Optional, allows the use of "remember me", API, and alerting.

* missing global (but still may not be working)

* always return a value from reauthenticate()

* Make sure the ldapbind credentials are correct on reauth.
Do not send output if they are incorrect (use d_echo) this breaks ajax calls, etc.
Add scripts/auth_test.php, to make it easier to debug authentication.

* Refine auth_test.php a bit more
A few small cleanups in other places of the auth

* Add auth_test.php to docs
Some more improvements in the auth_test.php output.

* Update Authentication.md
2017-03-29 08:22:02 -05:00
Neil Lathwood
c4ca5023a7 fixed auth when proxy is involved #6183 (#6192) 2017-03-14 08:04:47 +00:00
Neil Lathwood
e2962adac8 fix: Updated http-auth to work with nginx http auth #6102 (#6174) 2017-03-12 07:54:59 -05:00
Tony Murray
e20a242785 refactor: use Composer to manage php dependencies (#5216) 2017-01-01 09:37:15 +00:00
Neil Lathwood
f5ce3c509a Revert "Trust PHP session and remove remember me cookie" (#5252) 2016-12-27 20:37:03 +00:00
Eldon Koyle
3b198243d5 refactor: Trust PHP session and remove remember me cookie (#4608) 2016-12-26 23:11:00 +00:00
Neil Lathwood
d3c6d82b21 fix: Fixed broken http-auth auth module #5053 (#5146) 2016-12-12 14:25:30 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
a2f2ccfd2c security: Fix some reported security issues (#4807) 2016-10-15 20:45:18 +01:00
Neil Lathwood
a8efda8f30 Revert "Updated to remove passwords from sessions" (#4422) 2016-09-13 09:10:42 -05:00
Neil Lathwood
deb4b74bc9 webui: remove passwords from sessions, 'remember me' works for all auth types (#4134)
* Updated to remove passwords from sessions

* Remove users sessions when user deleted

* Updated when cookies are set

* Updated setcookies to always contain a value

* Added destroy_cookies() to remove users cookies on failed login

* Removed debug line

* Fixed graph issues
2016-09-12 21:41:19 -05:00
Tony Murray
956e18ffcd feature: Better error messages for ad_auth (#4385) 2016-09-09 08:04:03 -05:00
Tony Murray
b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00
Tony Murray
8c639aa5a4 PSR2 Cleanup: /html edition
Travis tests for code conformance. Ignore warnings for now.
Fixed all errors, left most warnings.
2016-08-18 21:29:30 -05:00
Tony Murray
bf2c522c89 Move third party software to html/lib form html/includes 2016-08-15 13:16:10 -05:00
laf
c80d9d8a59 Removed gc_maxlifetime setting 2016-05-03 22:53:09 +00:00
laf
b31cbd8dae Code for Radius authentication added 2015-12-13 15:37:55 +00:00
Michael Newton
f77c712bfc changes needed to run under web server subdirectory 2015-08-11 14:54:05 -07:00
Neil Lathwood
945ca7f2ea Revert "changes needed to run under web server subdirectory" 2015-08-11 21:25:23 +01:00
Michael Newton
cc0f449fc9 changes needed to run under web server subdirectory 2015-08-07 11:10:43 -07:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
laf
52004231a2 added exit after redirect 2015-04-12 09:22:08 +01:00
laf
cd5d18fa36 Added redirect when a POST value is found 2015-04-11 21:01:33 +01:00
laf
86a3019e89 Updated include to include_once 2015-04-08 10:52:44 +01:00
laf
791fa19a88 Updated the use of REMOTE_ADDR to a function then replaced its use 2015-03-18 19:14:51 +00:00
laf
12fc20f8a2 Removed un-needed header redirect 2015-02-01 17:34:06 +00:00
f0o
d66cec7017 Added TwoFactor Authentication (RFC4226)
Tested against Google-Authenticator app on Android 4.4.4

Made `verify_hotp` more efficient.

Added autofocus on twofactor input

Added GUI Unlock and Remove for TwoFactor credentials in /edituser/

Allow additional tries after elapsed time from last try exceeds configured parameter `$config['twofactor_lock']`.
If `$config['twofactor_lock']` is not defined or is set to `0`, administrators have to unlock accounts that exceed 3 failures via GUI.

Added Documentation

Moved TwoFactor form to logon.inc.php
Disabled autocomplete on twofactor input field
Updated Docs to include link to Google-Authenticator's install-guides

Moved authentication logic from authenticate.inc.php to twofactor.lib.php

typo in docblock for `twofactor_auth()`

Fixed scrutinizer bugs

To please scrutinizer
2014-12-28 15:40:40 +00:00
laf
b563b8425d Updated null to false for secure cookie 2014-08-20 16:42:09 +01:00
laf
183c69e304 Removed session regeneration 2014-08-20 16:24:27 +01:00
laf
41c3baaa6a Restore _GET login ability 2014-05-01 14:08:13 +01:00
laf
18f9b89639 Removed code that was previously commented out 2014-02-23 17:55:07 +00:00
laf
005504ae6d Updated session / cookie support 2014-02-03 22:39:37 +00:00
laf
04a9f4a2f3 Updated mysql auth to use PHPass 2014-02-03 12:10:06 +00:00
laf
b10ae234ac Moved the header call to after setcookie, also added an exit statement. 2014-01-09 10:41:40 +00:00
Adam Amstrong
850359711c add memcached application graphing support. move applications to <<<app-$name>>> for easier detection. add connection tracking to mysql application. move logout to /logout/ not
/?logout=yes.


git-svn-id: http://www.observium.org/svn/observer/trunk@3096 61d68cd4-352d-0410-923a-c4978735b2b8
2012-04-27 17:18:26 +00:00
Adam Amstrong
4a7fe31add typo tmp -> temp
git-svn-id: http://www.observium.org/svn/observer/trunk@2850 61d68cd4-352d-0410-923a-c4978735b2b8
2012-01-25 05:51:12 +00:00
Adam Amstrong
4bb69ef697 fix password
git-svn-id: http://www.observium.org/svn/observer/trunk@2374 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-26 21:50:27 +00:00
Adam Amstrong
842eb28fdd fix topnav and authenticate
git-svn-id: http://www.observium.org/svn/observer/trunk@2285 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-12 20:01:24 +00:00
Adam Amstrong
c5aee9205b more auth fixes from lenwe.
git-svn-id: http://www.observium.org/svn/observer/trunk@2222 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-03 14:10:21 +00:00
Adam Amstrong
6f26110c7d patches from lenwe (remove crappy tiny if and fix auth)
git-svn-id: http://www.observium.org/svn/observer/trunk@2221 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-03 12:22:04 +00:00
Adam Amstrong
cbbd3bfa04 kludge from lenwe
git-svn-id: http://www.observium.org/svn/observer/trunk@2188 61d68cd4-352d-0410-923a-c4978735b2b8
2011-04-27 19:35:15 +00:00
Tom Laermans
7ffefc0d57 move authenticate to a little later, update CHANGELOG for VMware support, minor cleanups, prettify message- and errorboxes
git-svn-id: http://www.observium.org/svn/observer/trunk@1979 61d68cd4-352d-0410-923a-c4978735b2b8
2011-03-26 19:28:39 +00:00
Tom Laermans
2afb522333 just another cleanup commit, don't mind me...
git-svn-id: http://www.observium.org/svn/observer/trunk@1885 61d68cd4-352d-0410-923a-c4978735b2b8
2011-03-16 18:28:52 +00:00
Tom Laermans
30bdd952ee Minor fixes, some cleanups, and standardising on echo("x") instead of echo "x"
git-svn-id: http://www.observium.org/svn/observer/trunk@1728 61d68cd4-352d-0410-923a-c4978735b2b8
2010-11-20 14:04:07 +00:00
Adam Amstrong
e1b3f25d94 can auth via _GET
git-svn-id: http://www.observium.org/svn/observer/trunk@1634 61d68cd4-352d-0410-923a-c4978735b2b8
2010-08-03 12:09:38 +00:00