Skip to content

Commit 253e876

Browse files
committed
Added a blacklist for not allowed shell user names.
1 parent 525a731 commit 253e876

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

interface/lib/shelluser_blacklist

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
root
2+
daemon
3+
bin
4+
sys
5+
sync
6+
games
7+
man
8+
lp
9+
mail
10+
news
11+
uucp
12+
proxy
13+
www-data
14+
wwwrun
15+
apache
16+
backup
17+
list
18+
irc
19+
gnats
20+
nobody
21+
Debian-exim
22+
statd
23+
identd
24+
sshd
25+
mysql
26+
postgres
27+
postfix
28+
clamav
29+
amavis
30+
vmail
31+
getmail
32+
ispconfig
33+
courier
34+
dovecot

interface/web/sites/shell_user_edit.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ function onShowNew() {
7272
parent::onShowNew();
7373
}
7474

75+
function onBeforeInsert() {
76+
global $app, $conf;
77+
78+
// check if the username is not blacklisted
79+
$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
80+
foreach($blacklist as $line) {
81+
if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))) $app->tform->errorMessage .= 'The username is not allowed.';
82+
}
83+
unset($blacklist);
84+
}
85+
7586
function onAfterInsert() {
7687
global $app, $conf;
7788

@@ -86,6 +97,17 @@ function onAfterInsert() {
8697

8798
}
8899

100+
function onBeforeUpdate() {
101+
global $app, $conf;
102+
103+
// check if the username is not blacklisted
104+
$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
105+
foreach($blacklist as $line) {
106+
if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))) $app->tform->errorMessage .= 'The username is not allowed.';
107+
}
108+
unset($blacklist);
109+
}
110+
89111
function onAfterUpdate() {
90112
global $app, $conf;
91113

0 commit comments

Comments
 (0)