1 |
michel |
1.1 |
diff -urN smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin |
2 |
|
|
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin 2022-07-17 22:35:59.000000000 +0400 |
3 |
|
|
+++ smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin 2022-07-18 00:17:05.275000000 +0400 |
4 |
|
|
@@ -44,6 +44,7 @@ |
5 |
|
|
my $imgdir="/etc/e-smith/web/panels/manager/html/smeadmin"; |
6 |
|
|
#my $maxping=0.1; |
7 |
|
|
my $maxping=0.5; |
8 |
|
|
+my $SshPort; |
9 |
|
|
#---------------------------------------------------------------- |
10 |
|
|
#declaration des fonctions |
11 |
|
|
#webpages-funcs |
12 |
|
|
@@ -550,7 +551,9 @@ |
13 |
|
|
foreach my $key (keys(%params)){ |
14 |
|
|
$params{$key} = $smeadmindb->prop($key); |
15 |
|
|
} |
16 |
|
|
-} |
17 |
|
|
+ |
18 |
|
|
+ $SshPort = $smedb->get('sshd')->prop('TCPPort'); |
19 |
|
|
+} |
20 |
|
|
|
21 |
|
|
#---------------------------------------------------------------- |
22 |
|
|
#affiche le formulaire permettant de parametrer smeadmin |
23 |
|
|
@@ -870,7 +873,7 @@ |
24 |
|
|
$q->Tr($q->td(gettext("Test ftp service")), |
25 |
|
|
$q->td($q->a ({href => "$progname?state=advanced&service=ftp"},"telnet 21\n"))), |
26 |
|
|
$q->Tr($q->td(gettext("Test ssh service")), |
27 |
|
|
- $q->td($q->a ({href => "$progname?state=advanced&service=ssh"},"telnet 22"))), |
28 |
|
|
+ $q->td($q->a ({href => "$progname?state=advanced&service=ssh"},"telnet ${SshPort}\n"))), |
29 |
|
|
$q->Tr($q->td(gettext("Test pop service")), |
30 |
|
|
$q->td($q->a ({href => "$progname?state=advanced&service=pop"},"telnet 110\n"))), |
31 |
|
|
$q->Tr($q->td(gettext("Test smtp service")), |
32 |
|
|
@@ -933,8 +936,8 @@ |
33 |
|
|
} |
34 |
|
|
elsif ($q->param('service') eq 'ssh') |
35 |
|
|
{ |
36 |
|
|
- print $q->p($q->b(sprintf(gettext("Execution of 'echo \"hello\" | nc %s 22' (ssh opened to the external network):"),$ip))),$q->br; |
37 |
|
|
- foreach (`/bin/echo "hello" | /usr/bin/nc $ip 22 2>&1`) |
38 |
|
|
+ print $q->p($q->b(sprintf(gettext("Execution of 'echo \"hello\" | nc %s %s' (ssh opened to the external network):"),$ip,$SshPort))),$q->br; |
39 |
|
|
+ foreach (`/bin/echo "hello" | /usr/bin/nc $ip $SshPort 2>&1`) |
40 |
|
|
{ |
41 |
|
|
print $q->p($_); |
42 |
|
|
} |
43 |
|
|
@@ -1633,7 +1636,7 @@ |
44 |
|
|
"DEF:ftp=$rrddir/sessions.rrd:ftp:AVERAGE", "DEF:maxftp=$rrddir/sessions.rrd:ftp:MAX", "DEF:minftp=$rrddir/sessions.rrd:ftp:MIN", |
45 |
|
|
"DEF:netbios=$rrddir/sessions.rrd:netbios:AVERAGE", "DEF:maxnetbios=$rrddir/sessions.rrd:netbios:MAX", "DEF:minnetbios=$rrddir/sessions.rrd:netbios:MIN", |
46 |
|
|
"DEF:afp=$rrddir/sessions.rrd:afp:AVERAGE", "DEF:maxafp=$rrddir/sessions.rrd:afp:MAX", "DEF:minafp=$rrddir/sessions.rrd:afp:MIN", |
47 |
|
|
- "COMMENT: ","LINE2:ssh#0000FF:ssh (22)","LINE2:ftp#FF2222:ftp (21)","LINE2:vpn#AA3300:vpn (1723)", |
48 |
|
|
+ "COMMENT: ","LINE2:ssh#0000FF:ssh ($SshPort)","LINE2:ftp#FF2222:ftp (21)","LINE2:vpn#AA3300:vpn (1723)", |
49 |
|
|
"LINE2:netbios#33B010:netbios (139)","LINE2:afp#FFD700:afp (548)","COMMENT:\\n", |
50 |
|
|
"COMMENT:Max\\: ","GPRINT:maxssh:MAX:%4.0lf ","GPRINT:maxftp:MAX:%4.0lf ","GPRINT:maxvpn:MAX:%4.0lf ", |
51 |
|
|
"GPRINT:maxnetbios:MAX:%4.0lf ","GPRINT:maxafp:MAX:%4.0lf ","COMMENT:\\n", |
52 |
|
|
diff -urN smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind smeserver-smeadmin-1.6/root/usr/bin/smeadmind |
53 |
|
|
--- smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind 2022-07-17 22:35:59.000000000 +0400 |
54 |
|
|
+++ smeserver-smeadmin-1.6/root/usr/bin/smeadmind 2022-07-17 23:04:00.882000000 +0400 |
55 |
|
|
@@ -29,6 +29,8 @@ |
56 |
|
|
|
57 |
|
|
#variables d'environnement du serveur |
58 |
|
|
my ($DomainName,$SystemName,$SystemMode,$InternalInterface,$ExternalInterface,$InternalIP,$ExternalIP,@MailDomainsMatch); |
59 |
|
|
+my $SshPort; |
60 |
|
|
+ |
61 |
|
|
#---------------------------------- |
62 |
|
|
#hash faisant correspondre la cle (nom du param) a sa valeur [ICI, CE SONT LES VALEURS PAR DEFAUT !!] |
63 |
|
|
#idem dans le panel /etc-e-smith/web/functions/smeadmin |
64 |
|
|
@@ -372,6 +374,8 @@ |
65 |
|
|
my $InternalIP = $smedb->get("LocalIP")->value; |
66 |
|
|
$InternalInterface = $smedb->get("InternalInterface")->prop('Name'); |
67 |
|
|
|
68 |
|
|
+ $SshPort = $smedb->get("sshd")->prop('TCPPort'); |
69 |
|
|
+ |
70 |
|
|
my $smeadmindb = $smedb->get('smeadmind') || die "Error opening smeadmind db\n"; |
71 |
|
|
|
72 |
|
|
foreach my $key (keys(%params)){ |
73 |
|
|
@@ -1252,7 +1256,7 @@ |
74 |
|
|
# par contre, a surveiller le passage de samba du port 139 a 445 |
75 |
|
|
my @netstat=`/bin/netstat --inet --tcp --numeric`; |
76 |
|
|
foreach (@netstat) { |
77 |
|
|
- if (/tcp\s+\d+\s+\d+\s\S+:22\s+\S+\s+ESTABLISHED/){$sessions_ssh++;} |
78 |
|
|
+ if (/tcp\s+\d+\s+\d+\s\S+:${SshPort}\s+\S+\s+ESTABLISHED/){$sessions_ssh++;} |
79 |
|
|
if (/tcp\s+\d+\s+\d+\s\S+:21\s+\S+\s+ESTABLISHED/){$sessions_ftp++;} |
80 |
|
|
if (/tcp\s+\d+\s+\d+\s\S+:1723\s+\S+\s+ESTABLISHED/){$sessions_vpn++;} |
81 |
|
|
if (/tcp\s+\d+\s+\d+\s\S+:548\s+\S+\s+ESTABLISHED/){$sessions_afp++;} |
82 |
|
|
@@ -1640,7 +1644,7 @@ |
83 |
|
|
"\n#who\n", |
84 |
|
|
`who`, |
85 |
|
|
"#netstat -n |grep :22\n", |
86 |
|
|
- `netstat -n |grep :22`; |
87 |
|
|
+ `netstat -n |grep :${SshPort}`; |
88 |
|
|
}], |
89 |
|
|
[ |
90 |
|
|
"($params{'MaxFtp'} && $sessions_ftp >= $params{'MaxFtp'})", |