Kaynağa Gözat

Option to remove pinning for a domain from the control panel

Bob Mottram 8 yıl önce
ebeveyn
işleme
a279494766
1 değiştirilmiş dosya ile 24 ekleme ve 1 silme
  1. 24
    1
      src/freedombone-sec

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

@@ -702,6 +702,25 @@ function pin_all_tls_certs {
702 702
     ${PROJECT_NAME}-pin-cert all
703 703
 }
704 704
 
705
+function remove_pinning {
706
+    data=$(tempfile 2>/dev/null)
707
+    trap "rm -f $data" 0 1 2 5 15
708
+    dialog --title $"Remove pinning for a domain" \
709
+           --backtitle $"Freedombone Security Settings" \
710
+           --inputbox $"Enter the website domain name (without https://)" 8 60 2>$data
711
+    sel=$?
712
+    case $sel in
713
+        0)
714
+            domain=$(<$data)
715
+            ${PROJECT_NAME}-pin-cert "$domain" remove
716
+            if [ ! "$?" = "0" ]; then
717
+                dialog --title $"Removed pinning from $domain" \
718
+                       --msgbox "$?" 6 40
719
+            fi
720
+            ;;
721
+    esac
722
+}
723
+
705 724
 function housekeeping {
706 725
     cmd=(dialog --separate-output \
707 726
                 --backtitle "Freedombone Security Configuration" \
@@ -715,7 +734,8 @@ function housekeeping {
715 734
              6 "Enable GPG based authentication (monkeysphere)" off
716 735
              7 "Register a website with monkeysphere" off
717 736
              8 "Pin all TLS certificates" off
718
-             9 "Go Back/Exit" on)
737
+             9 "Remove pinning for a domain" off
738
+             10 "Go Back/Exit" on)
719 739
     choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
720 740
     clear
721 741
     for choice in $choices
@@ -746,6 +766,9 @@ function housekeeping {
746 766
                 pin_all_tls_certs
747 767
                 ;;
748 768
             9)
769
+                remove_pinning
770
+                ;;
771
+            10)
749 772
                 exit 0
750 773
                 ;;
751 774
         esac