瀏覽代碼

Disable host based ssh authentication

Bob Mottram 7 年之前
父節點
當前提交
2763247509
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. 6
    0
      src/freedombone-utils-ssh

+ 6
- 0
src/freedombone-utils-ssh 查看文件

@@ -40,6 +40,12 @@ function configure_ssh {
40 40
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
41 41
         return
42 42
     fi
43
+    if ! grep 'HostbasedAuthentication' /etc/ssh/sshd_config; then
44
+        echo 'HostbasedAuthentication no' >> /etc/ssh/sshd_config
45
+    else
46
+        sed 's|#HostbasedAuthentication.*|HostbasedAuthentication no|g' /etc/ssh/sshd_config
47
+        sed 's|HostbasedAuthentication.*|HostbasedAuthentication no|g' /etc/ssh/sshd_config
48
+    fi
43 49
     sed -i 's|#IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config
44 50
     sed -i 's|IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config
45 51
     sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config