Kaynağa Gözat

Show sha256 ssh kost key hashes

Bob Mottram 8 yıl önce
ebeveyn
işleme
a64644181f
3 değiştirilmiş dosya ile 13 ekleme ve 4 silme
  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 Dosyayı Görüntüle

@@ -184,7 +184,9 @@ function restore_remote_vim {
184 184
 }
185 185
 
186 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 190
     update-alternatives --set editor /usr/bin/nano
189 191
     sed -i '/install_vim/d' $COMPLETION_FILE
190 192
 

+ 1
- 1
src/freedombone-sec Dosyayı Görüntüle

@@ -724,7 +724,7 @@ function menu_security_settings {
724 724
     case $(cat $data) in
725 725
         1)
726 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 728
             exit 0
729 729
             ;;
730 730
         2)

+ 9
- 2
src/freedombone-utils-ssh Dosyayı Görüntüle

@@ -78,7 +78,7 @@ function configure_ssh {
78 78
         echo "KexAlgorithms $SSH_KEX" >> /etc/ssh/sshd_config
79 79
     fi
80 80
 
81
-    apt-get -yq install fail2ban
81
+    apt-get -yq install fail2ban vim-common
82 82
 
83 83
     function_check configure_firewall_for_ssh
84 84
     configure_firewall_for_ssh
@@ -153,7 +153,14 @@ function configure_firewall_for_ssh {
153 153
 }
154 154
 
155 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 166
 # NOTE: deliberately no exit 0