浏览代码

More ssh server settings

Bob Mottram 7 年前
父节点
当前提交
bbae177910
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17
    1
      src/freedombone-utils-ssh

+ 17
- 1
src/freedombone-utils-ssh 查看文件

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
17
 #
17
 #
18
 # This program is free software: you can redistribute it and/or modify
18
 # This program is free software: you can redistribute it and/or modify
19
 # it under the terms of the GNU Affero General Public License as published by
19
 # it under the terms of the GNU Affero General Public License as published by
40
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
40
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
41
         return
41
         return
42
     fi
42
     fi
43
+
44
+    if ! grep -q 'RhostsRSAAuthentication' /etc/ssh/sshd_config; then
45
+        echo 'RhostsRSAAuthentication yes' >> /etc/ssh/sshd_config
46
+    else
47
+        sed -i 's|#RhostsRSAAuthentication.*|RhostsRSAAuthentication yes|g' /etc/ssh/sshd_config
48
+    fi
49
+    sed -i 's|#StrictModes.*|StrictModes yes|g' /etc/ssh/sshd_config
50
+    sed -i 's|StrictModes.*|StrictModes yes|g' /etc/ssh/sshd_config
51
+    sed -i 's|#KerberosAuthentication.*|KerberosAuthentication no|g' /etc/ssh/sshd_config
52
+    sed -i 's|KerberosAuthentication.*|KerberosAuthentication no|g' /etc/ssh/sshd_config
53
+    sed -i 's|#GSSAPIAuthentication.*|GSSAPIAuthentication no|g' /etc/ssh/sshd_config
54
+    sed -i 's|GSSAPIAuthentication.*|GSSAPIAuthentication no|g' /etc/ssh/sshd_config
55
+    sed -i 's|#IgnoreUserKnownHosts.*|IgnoreUserKnownHosts yes|g' /etc/ssh/sshd_config
56
+    sed -i 's|IgnoreUserKnownHosts.*|IgnoreUserKnownHosts yes|g' /etc/ssh/sshd_config
57
+    sed -i 's|#Compression.*|Compression delayed|g' /etc/ssh/sshd_config
58
+    sed -i 's|Compression.*|Compression delayed|g' /etc/ssh/sshd_config
43
     if ! grep -q 'HostbasedAuthentication' /etc/ssh/sshd_config; then
59
     if ! grep -q 'HostbasedAuthentication' /etc/ssh/sshd_config; then
44
         echo 'HostbasedAuthentication no' >> /etc/ssh/sshd_config
60
         echo 'HostbasedAuthentication no' >> /etc/ssh/sshd_config
45
     fi
61
     fi