3 # save user and group related sshd options
5 require './sshd-lib.pl';
7 &error_setup($text{'access_err'});
8 &lock_file($config{'sshd_config'});
9 $conf = &get_sshd_config();
11 if ($version{'type'} eq 'ssh') {
12 if ($in{'allowh_def'}) {
13 &save_directive("AllowHosts", $conf);
16 $in{'allowh'} =~ /\S/ || &error($text{'access_eallowh'});
17 &save_directive("AllowHosts", $conf, $in{'allowh'});
20 if ($in{'denyh_def'}) {
21 &save_directive("DenyHosts", $conf);
24 $in{'denyh'} =~ /\S/ || &error($text{'access_edenyh'});
25 &save_directive("DenyHosts", $conf, $in{'denyh'});
29 $commas = $version{'type'} eq 'ssh' && $version{'number'} >= 3.2;
30 if ($in{'allowu_def'}) {
31 &save_directive("AllowUsers", $conf);
34 $in{'allowu'} =~ /\S/ || &error($text{'access_eallowu'});
35 &save_directive("AllowUsers", $conf,
36 $commas ? join(",", split(/\s+/, $in{'allowu'})) : $in{'allowu'});
38 if ($in{'denyu_def'}) {
39 &save_directive("DenyUsers", $conf);
42 $in{'denyu'} =~ /\S/ || &error($text{'access_edenyu'});
43 &save_directive("DenyUsers", $conf,
44 $commas ? join(",", split(/\s+/, $in{'denyu'})) : $in{'denyu'});
47 if ($in{'allowg_def'}) {
48 &save_directive("AllowGroups", $conf);
51 $in{'allowg'} =~ /\S/ || &error($text{'access_eallowg'});
52 &save_directive("AllowGroups", $conf,
53 $commas ? join(",", split(/\s+/, $in{'allowg'})) : $in{'allowg'});
55 if ($in{'denyg_def'}) {
56 &save_directive("DenyGroups", $conf);
59 $in{'denyg'} =~ /\S/ || &error($text{'access_edenyg'});
60 &save_directive("DenyGroups", $conf,
61 $commas ? join(",", split(/\s+/, $in{'denyg'})) : $in{'denyg'});
64 if ($version{'type'} eq 'ssh' && $version{'number'} < 2) {
65 &save_directive("SilentDeny", $conf, $in{'silent'} ? 'yes' : 'no');
69 &unlock_file($config{'sshd_config'});
70 &webmin_log("access");