3 # save user and group related sshd options
5 require './sshd-lib.pl';
7 &error_setup($text{'users_err'});
8 &lock_file($config{'sshd_config'});
9 $conf = &get_sshd_config();
11 if ($version{'type'} eq 'ssh' && $version{'number'} < 2) {
12 if ($in{'expire_def'}) {
13 &save_directive("AccountExpireWarningDays", $conf);
16 $in{'expire'} =~ /^\d+$/ || &error($text{'users_eexpire'});
17 &save_directive("AccountExpireWarningDays", $conf,
22 if ($version{'type'} eq 'ssh' || $version{'number'} < 3.1) {
23 &save_directive("CheckMail", $conf, $in{'mail'} ? 'yes' : 'no');
26 #&save_directive("ForcedEmptyPasswdChange", $conf, $in{'empty'} ? 'yes' : 'no');
28 #&save_directive("ForcedPasswdChange", $conf, $in{'passwd'} ? 'yes' : 'no');
30 if ($version{'type'} eq 'ssh' && $version{'number'} < 2) {
31 if ($in{'pexpire_def'}) {
32 &save_directive("PasswdExpireWarningDays", $conf);
35 $in{'pexpire'} =~ /^\d+$/ || &error($text{'users_eexpire'});
36 &save_directive("PasswdExpireWarningDays", $conf,
41 if ($version{'type'} ne 'ssh' || $version{'number'} < 3) {
42 &save_directive("PasswordAuthentication", $conf,
43 $in{'auth'} ? 'yes' : 'no');
46 &save_directive("PermitEmptyPasswords", $conf, $in{'pempty'} ? 'yes' : 'no');
48 &save_directive("PermitRootLogin", $conf, $in{'root'});
50 if ($version{'type'} ne 'ssh' || $version{'number'} < 3) {
51 &save_directive("RSAAuthentication", $conf, $in{'rsa'} ? 'yes' : 'no');
53 if ($version{'type'} eq 'openssh' && $version{'number'} >= 3) {
54 &save_directive("PubkeyAuthentication", $conf,
55 $in{'dsa'} ? 'yes' : 'no');
58 &save_directive("StrictModes", $conf, $in{'strict'} ? 'yes' : 'no');
60 &save_directive("PrintMotd", $conf, $in{'motd'} ? 'yes' : 'no');
62 if ($version{'type'} eq 'openssh') {
63 &save_directive("IgnoreUserKnownHosts", $conf,
64 $in{'known'} ? 'yes' : 'no');
66 if ($version{'number'} > 2.3) {
67 if ($in{'banner_def'}) {
68 &save_directive("Banner", $conf);
71 -r $in{'banner'} || &error($text{'users_ebanner'});
72 &save_directive("Banner", $conf, $in{'banner'});
76 elsif ($version{'type'} eq 'ssh' && $version{'number'} >= 2) {
77 if ($in{'banner_def'}) {
78 &save_directive("BannerMessageFile", $conf);
81 -r $in{'banner'} || &error($text{'users_ebanner'});
82 &save_directive("BannerMessageFile", $conf, $in{'banner'});
86 if ($version{'type'} eq 'openssh' && $version{'number'} >= 3) {
87 if ($in{'authkeys_def'}) {
88 &save_directive("AuthorizedKeysFile", $conf);
91 $in{'authkeys'} =~ /^\S+$/ || &error($text{'users_eauthkeys'});
92 &save_directive("AuthorizedKeysFile", $conf, $in{'authkeys'});
96 if ($version{'type'} eq 'openssh' && $version{'number'} >= 5) {
97 if ($in{'maxauthtries_def'}) {
98 &save_directive("MaxAuthTries", $conf);
101 $in{'maxauthtries'} =~ /^\d+$/ && $in{'maxauthtries'} > 0 ||
102 &error($text{'users_emaxauthtries'});
103 &save_directive("MaxAuthTries", $conf, $in{'maxauthtries'});
107 if ($version{'type'} eq 'openssh' && $version{'number'} < 3.7 ||
108 $version{'type'} eq 'ssh' && $version{'number'} < 2) {
109 &save_directive("RhostsAuthentication", $conf,
110 $in{'rhostsauth'} ? 'yes' : 'no');
112 &save_directive("RhostsRSAAuthentication", $conf,
113 $in{'rhostsrsa'} ? 'yes' : 'no');
116 &save_directive("IgnoreRhosts", $conf, $in{'rhosts'} ? 'yes' : 'no');
118 if ($version{'type'} eq 'ssh') {
119 if ($in{'rrhosts'} == -1) {
120 &save_directive("IgnoreRootRhosts", $conf);
123 &save_directive("IgnoreRootRhosts", $conf,
124 $in{'rrhosts'} ? 'yes' : 'no');
129 &unlock_file($config{'sshd_config'});
130 &webmin_log("users");