Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
6d26186e
Commit
6d26186e
authored
May 18, 2016
by
Ad Schellevis
Committed by
Franco Fichtner
May 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(auth/gui) make gui auth fallback explicit (instead of silently accepting local)
(cherry picked from commit
2578e763
)
parent
f5596d78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
authgui.inc
src/etc/inc/authgui.inc
+20
-3
system_usermanager_settings.php
src/www/system_usermanager_settings.php
+24
-0
No files found.
src/etc/inc/authgui.inc
View file @
6d26186e
...
...
@@ -182,14 +182,31 @@ function session_auth(&$Login_Error)
/* Validate incoming login request */
if
(
isset
(
$_POST
[
'login'
])
&&
!
empty
(
$_POST
[
'usernamefld'
])
&&
!
empty
(
$_POST
[
'passwordfld'
]))
{
$authcfg
=
auth_get_authserver
(
"Local Database"
);
$authcfg_fallback
=
auth_get_authserver
(
"Local Database"
);
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'authmode'
]))
{
$authcfg
=
auth_get_authserver
(
$config
[
'system'
][
'webgui'
][
'authmode'
]);
}
else
{
$authcfg
=
null
;
}
if
(
!
empty
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]))
{
if
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]
==
"__NO_FALLBACK__"
)
{
// no fallback
$authcfg_fallback
=
false
;
}
else
{
$authcfg_fallback
=
auth_get_authserver
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]);
}
}
if
(
$authcfg
==
$authcfg_fallback
)
{
// it doesn't make sense to fallback to the same authenticator
$authcfg_fallback
=
false
;
}
// authenticate using config settings, or local if failed
if
(
authenticate_user
(
$_POST
[
'usernamefld'
],
$_POST
[
'passwordfld'
],
$authcfg
)
||
authenticate_user
(
$_POST
[
'usernamefld'
],
$_POST
[
'passwordfld'
]))
{
(
$authcfg_fallback
!==
false
&&
authenticate_user
(
$_POST
[
'usernamefld'
],
$_POST
[
'passwordfld'
],
$authcfg_fallback
))
)
{
// Generate a new id to avoid session fixation
session_regenerate_id
();
$_SESSION
[
'Logged_In'
]
=
"True"
;
...
...
src/www/system_usermanager_settings.php
View file @
6d26186e
...
...
@@ -35,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig
=
array
();
$pconfig
[
'session_timeout'
]
=
$config
[
'system'
][
'webgui'
][
'session_timeout'
];
$pconfig
[
'authmode'
]
=
$config
[
'system'
][
'webgui'
][
'authmode'
];
$pconfig
[
'authmode_fallback'
]
=
!
empty
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
])
?
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]
:
"Local Database"
;
$pconfig
[
'backend'
]
=
$config
[
'system'
][
'webgui'
][
'backend'
];
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$pconfig
=
$_POST
;
...
...
@@ -65,6 +66,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset
(
$config
[
'system'
][
'webgui'
][
'authmode'
]);
}
if
(
!
empty
(
$pconfig
[
'authmode_fallback'
]))
{
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]
=
$pconfig
[
'authmode_fallback'
];
}
elseif
(
isset
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]))
{
unset
(
$config
[
'system'
][
'webgui'
][
'authmode_fallback'
]);
}
write_config
();
}
}
...
...
@@ -123,6 +130,23 @@ endif;?>
</select>
</td>
</tr>
<tr>
<td><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Authentication Server (fallback)"
);
?>
</td>
<td>
<select
name=
"authmode_fallback"
class=
"selectpicker"
data-style=
"btn-default"
>
<?php
foreach
(
auth_get_authserver_list
()
as
$auth_key
=>
$auth_server
)
:?>
<
option
value
=
"<?=
$auth_key
; ?>"
<?=
$auth_key
==
$pconfig
[
'authmode_fallback'
]
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
htmlspecialchars
(
$auth_server
[
'name'
]);
?>
</option>
<?php
endforeach
;
?>
<option
value=
"__NO_FALLBACK__"
<?=
$pconfig
[
'authmode_fallback'
]
==
"__NO_FALLBACK__"
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"--No Fallback--"
);
?>
</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment