소스 검색

Show sha256 ssh kost key hashes

Bob Mottram 8 년 전
부모
커밋
a64644181f
3개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  1. 3
    1
      src/freedombone-app-vim
  2. 1
    1
      src/freedombone-sec
  3. 9
    2
      src/freedombone-utils-ssh

+ 3
- 1
src/freedombone-app-vim 파일 보기

184
 }
184
 }
185
 
185
 
186
 function remove_vim {
186
 function remove_vim {
187
-    apt-get -yq remove --purge vim
187
+    # Don't remove vim because vim-common is needed for showing ssh host keys
188
+    # This may change with Debian Stretch
189
+    # apt-get -yq remove --purge vim
188
     update-alternatives --set editor /usr/bin/nano
190
     update-alternatives --set editor /usr/bin/nano
189
     sed -i '/install_vim/d' $COMPLETION_FILE
191
     sed -i '/install_vim/d' $COMPLETION_FILE
190
 
192
 

+ 1
- 1
src/freedombone-sec 파일 보기

724
     case $(cat $data) in
724
     case $(cat $data) in
725
         1)
725
         1)
726
             dialog --title $"SSH host public key" \
726
             dialog --title $"SSH host public key" \
727
-                   --msgbox "\n$(get_ssh_server_key)" 7 60
727
+                   --msgbox "\n$(get_ssh_server_key)" 12 60
728
             exit 0
728
             exit 0
729
             ;;
729
             ;;
730
         2)
730
         2)

+ 9
- 2
src/freedombone-utils-ssh 파일 보기

78
         echo "KexAlgorithms $SSH_KEX" >> /etc/ssh/sshd_config
78
         echo "KexAlgorithms $SSH_KEX" >> /etc/ssh/sshd_config
79
     fi
79
     fi
80
 
80
 
81
-    apt-get -yq install fail2ban
81
+    apt-get -yq install fail2ban vim-common
82
 
82
 
83
     function_check configure_firewall_for_ssh
83
     function_check configure_firewall_for_ssh
84
     configure_firewall_for_ssh
84
     configure_firewall_for_ssh
153
 }
153
 }
154
 
154
 
155
 function get_ssh_server_key {
155
 function get_ssh_server_key {
156
-    echo $(ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | awk -F ' ' '{print $2}')
156
+    if [ -f /etc/ssh/ssh_host_rsa_key.pub ]; then
157
+        echo "RSA Md5:$(ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | awk -F ' ' '{print $2}')"
158
+        echo "RSA SHA256:$(awk '{print $2}' /etc/ssh/ssh_host_rsa_key.pub | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64)"
159
+    fi
160
+    if [ -f /etc/ssh/ssh_host_ed25519_key.pub ]; then
161
+        echo "ED25519 Md5:$(ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub | awk -F ' ' '{print $2}')"
162
+        echo "ED25519 SHA256:$(awk '{print $2}' /etc/ssh/ssh_host_ed25519_key.pub | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64)"
163
+    fi
157
 }
164
 }
158
 
165
 
159
 # NOTE: deliberately no exit 0
166
 # NOTE: deliberately no exit 0