Option to remove pinning for a domain from the control panel

This commit is contained in:
Bob Mottram 2016-08-09 12:07:53 +01:00
parent eae33f69d6
commit a279494766
1 changed files with 24 additions and 1 deletions

View File

@ -702,6 +702,25 @@ function pin_all_tls_certs {
${PROJECT_NAME}-pin-cert all
}
function remove_pinning {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Remove pinning for a domain" \
--backtitle $"Freedombone Security Settings" \
--inputbox $"Enter the website domain name (without https://)" 8 60 2>$data
sel=$?
case $sel in
0)
domain=$(<$data)
${PROJECT_NAME}-pin-cert "$domain" remove
if [ ! "$?" = "0" ]; then
dialog --title $"Removed pinning from $domain" \
--msgbox "$?" 6 40
fi
;;
esac
}
function housekeeping {
cmd=(dialog --separate-output \
--backtitle "Freedombone Security Configuration" \
@ -715,7 +734,8 @@ function housekeeping {
6 "Enable GPG based authentication (monkeysphere)" off
7 "Register a website with monkeysphere" off
8 "Pin all TLS certificates" off
9 "Go Back/Exit" on)
9 "Remove pinning for a domain" off
10 "Go Back/Exit" on)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
clear
for choice in $choices
@ -746,6 +766,9 @@ function housekeeping {
pin_all_tls_certs
;;
9)
remove_pinning
;;
10)
exit 0
;;
esac