Add clacks from control panel

This commit is contained in:
Bob Mottram 2017-11-03 19:36:40 +00:00
parent 2080b7a8f1
commit d96c098141
2 changed files with 45 additions and 9 deletions

View File

@ -542,6 +542,7 @@ function install_stunnel {
echo "accept = $VPN_TLS_PORT" >> $prefix/etc/stunnel/stunnel.conf
echo 'connect = localhost:1194' >> $prefix/etc/stunnel/stunnel.conf
echo 'cert = /etc/stunnel/stunnel.pem' >> $prefix/etc/stunnel/stunnel.conf
echo 'protocol = socks' >> $prefix/etc/stunnel/stunnel.conf
sed -i 's|ENABLED=.*|ENABLED=1|g' $prefix/etc/default/stunnel4
@ -550,6 +551,7 @@ function install_stunnel {
echo "accept = $STUNNEL_PORT" >> $prefix/etc/stunnel/stunnel-client.conf
echo "connect = $DEFAULT_DOMAIN_NAME:$VPN_TLS_PORT" >> $prefix/etc/stunnel/stunnel-client.conf
echo 'cert = stunnel.pem' >> $prefix/etc/stunnel/stunnel-client.conf
echo 'protocol = socks' >> $prefix/etc/stunnel/stunnel-client.conf
echo '[Unit]' > $prefix/etc/systemd/system/stunnel.service
echo 'Description=SSL tunnel for network daemons' >> $prefix/etc/systemd/system/stunnel.service

View File

@ -2102,6 +2102,38 @@ function wifi_enable {
${PROJECT_NAME}-wifi --disable $disable_wifi
}
function add_clacks {
clacks=
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Add Clacks Overhead" \
--backtitle $"Freedombone Control Panel" \
--inputbox $"" 7 60 2>$data
sel=$?
case $sel in
0)
clacks=$(<$data)
if [ ${#clacks} -gt 1 ]; then
WEB_FILES=/etc/nginx/sites-available/*
for f in $WEB_FILES
do
if grep -q "X-Clacks-Overhead" $f; then
sed -i "s|X-Clacks-Overhead .*|X-Clacks-Overhead \"GNU $clacks\";|g" $f
else
sed -i "/X-Content-Type-Options/a add_header X-Clacks-Overhead \"GNU $clacks\";" $f
fi
done
dialog --title $"Add Clacks Overhead" \
--msgbox $"\nAdded for $clacks" 10 60
fi
;;
esac
rm $data
}
function menu_wifi {
if [[ "$(wifi_exists)" == "0" ]]; then
dialog --title $"Wifi" \
@ -2191,7 +2223,7 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Control Panel" \
--radiolist $"Choose an operation:" 29 70 21 \
--radiolist $"Choose an operation:" 30 70 22 \
1 $"About this system" off \
2 $"Passwords" off \
3 $"Backup and Restore" off \
@ -2209,10 +2241,11 @@ function menu_top_level {
15 $"Change the name of this system" off \
16 $"Set a static local IP address" off \
17 $"Wifi menu" off \
18 $"Check for updates" off \
19 $"Power off the system" off \
20 $"Restart the system" off \
21 $"Exit" on 2> $data
18 $"Add Clacks" off \
19 $"Check for updates" off \
20 $"Power off the system" off \
21 $"Restart the system" off \
22 $"Exit" on 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -2242,10 +2275,11 @@ function menu_top_level {
15) change_system_name;;
16) set_static_IP;;
17) menu_wifi;;
18) check_for_updates;;
19) shut_down_system;;
20) restart_system;;
21) break;;
18) add_clacks;;
19) check_for_updates;;
20) shut_down_system;;
21) restart_system;;
22) break;;
esac
done
}