Anchoring
For better security out of the box, always perform exact matching unless a more lenient pattern is explicitly provided by the administrator. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
67f5059b36
commit
3bed7bad11
@ -40,7 +40,7 @@ if ($ssh_cmd) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
my %cmds = map { qr{$_} => 1 } @{$config{$user}};
|
my %cmds = map { qr/^$_$/ => 1 } @{$config{$user}};
|
||||||
|
|
||||||
if ( any { $cmd =~ $_ } keys %cmds ) {
|
if ( any { $cmd =~ $_ } keys %cmds ) {
|
||||||
exec $cmd;
|
exec $cmd;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: authorized-exec
|
Name: authorized-exec
|
||||||
Version: 1.0
|
Version: 1.1
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Health check
|
Summary: Health check
|
||||||
License: EUPL-1.2
|
License: EUPL-1.2
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
# the patterns are read as regular expressions and anchored with ^ and $ by default
|
||||||
(
|
(
|
||||||
'georg' => [
|
'georg' => [
|
||||||
'^echo hi$',
|
'echo hi',
|
||||||
'^true$',
|
'true',
|
||||||
'^printf %s [a-z0-9 ]+$',
|
'printf %s [a-z0-9 ]+',
|
||||||
],
|
],
|
||||||
'root' => [
|
'root' => [
|
||||||
'^ls -a /root$',
|
'ls -a /root',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user