瀏覽代碼

Option to remove pinning for a domain from the control panel

Bob Mottram 8 年之前
父節點
當前提交
a279494766
共有 1 個檔案被更改,包括 24 行新增1 行删除
  1. 24
    1
      src/freedombone-sec

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

702
     ${PROJECT_NAME}-pin-cert all
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
 function housekeeping {
724
 function housekeeping {
706
     cmd=(dialog --separate-output \
725
     cmd=(dialog --separate-output \
707
                 --backtitle "Freedombone Security Configuration" \
726
                 --backtitle "Freedombone Security Configuration" \
715
              6 "Enable GPG based authentication (monkeysphere)" off
734
              6 "Enable GPG based authentication (monkeysphere)" off
716
              7 "Register a website with monkeysphere" off
735
              7 "Register a website with monkeysphere" off
717
              8 "Pin all TLS certificates" off
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
     choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
739
     choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
720
     clear
740
     clear
721
     for choice in $choices
741
     for choice in $choices
746
                 pin_all_tls_certs
766
                 pin_all_tls_certs
747
                 ;;
767
                 ;;
748
             9)
768
             9)
769
+                remove_pinning
770
+                ;;
771
+            10)
749
                 exit 0
772
                 exit 0
750
                 ;;
773
                 ;;
751
         esac
774
         esac