浏览代码

Allow verification of the ssh host key

Bob Mottram 8 年前
父节点
当前提交
9c2c644310
共有 2 个文件被更改,包括 28 次插入18 次删除
  1. 24
    18
      src/freedombone-sec
  2. 4
    0
      src/freedombone-utils-ssh

+ 24
- 18
src/freedombone-sec 查看文件

690
     trap "rm -f $data" 0 1 2 5 15
690
     trap "rm -f $data" 0 1 2 5 15
691
     dialog --backtitle $"Freedombone Control Panel" \
691
     dialog --backtitle $"Freedombone Control Panel" \
692
            --title $"Security Settings" \
692
            --title $"Security Settings" \
693
-           --radiolist $"Choose an operation:" 16 76 16 \
694
-           1 $"Regenerate ssh host keys" off \
695
-           2 $"Regenerate Diffie-Hellman keys" off \
696
-           3 $"Update cipersuite" off \
697
-           4 $"Create a new Let's Encrypt certificate" off \
698
-           5 $"Renew Let's Encrypt certificate" off \
699
-           6 $"Enable GPG based authentication (monkeysphere)" off \
700
-           7 $"Register a website with monkeysphere" off \
701
-           8 $"Allow ssh login with passwords" off \
702
-           9 $"Go Back/Exit" on 2> $data
693
+           --radiolist $"Choose an operation:" 17 76 17 \
694
+           1 $"Show ssh host public key" off \
695
+           2 $"Regenerate ssh host keys" off \
696
+           3 $"Regenerate Diffie-Hellman keys" off \
697
+           4 $"Update cipersuite" off \
698
+           5 $"Create a new Let's Encrypt certificate" off \
699
+           6 $"Renew Let's Encrypt certificate" off \
700
+           7 $"Enable GPG based authentication (monkeysphere)" off \
701
+           8 $"Register a website with monkeysphere" off \
702
+           9 $"Allow ssh login with passwords" off \
703
+           10 $"Go Back/Exit" on 2> $data
703
     sel=$?
704
     sel=$?
704
     case $sel in
705
     case $sel in
705
         1) exit 1;;
706
         1) exit 1;;
722
 
723
 
723
     case $(cat $data) in
724
     case $(cat $data) in
724
         1)
725
         1)
725
-            regenerate_ssh_host_keys
726
+            dialog --title $"SSH host public key" \
727
+                   --msgbox "$(get_ssh_server_key)" 6 70
728
+            exit 0
726
             ;;
729
             ;;
727
         2)
730
         2)
728
-            regenerate_dh_keys
731
+            regenerate_ssh_host_keys
729
             ;;
732
             ;;
730
         3)
733
         3)
734
+            regenerate_dh_keys
735
+            ;;
736
+        4)
731
             interactive_setup
737
             interactive_setup
732
             update_ciphersuite
738
             update_ciphersuite
733
             ;;
739
             ;;
734
-        4)
740
+        5)
735
             create_letsencrypt
741
             create_letsencrypt
736
             ;;
742
             ;;
737
-        5)
743
+        6)
738
             renew_letsencrypt
744
             renew_letsencrypt
739
             ;;
745
             ;;
740
-        6)
746
+        7)
741
             enable_monkeysphere
747
             enable_monkeysphere
742
             ;;
748
             ;;
743
-        7)
749
+        8)
744
             register_website
750
             register_website
745
             ;;
751
             ;;
746
-        8)
752
+        9)
747
             allow_ssh_passwords
753
             allow_ssh_passwords
748
             change_ssh_settings
754
             change_ssh_settings
749
             exit 0
755
             exit 0
750
             ;;
756
             ;;
751
-        9)
757
+        10)
752
             exit 0
758
             exit 0
753
             ;;
759
             ;;
754
     esac
760
     esac

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

152
     mark_completed $FUNCNAME
152
     mark_completed $FUNCNAME
153
 }
153
 }
154
 
154
 
155
+function get_ssh_server_key {
156
+    echo $(ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | awk -F ' ' '{print $2}')
157
+}
158
+
155
 # NOTE: deliberately no exit 0
159
 # NOTE: deliberately no exit 0