Skip to content
Snippets Groups Projects
Commit 0136efa9 authored by Bob Mottram's avatar Bob Mottram
Browse files

Remove proxy settings which are not in the web ui

parent 96596d57
No related branches found
No related tags found
No related merge requests found
......@@ -609,72 +609,6 @@ function remove_ssh_key {
rm -f "$data"
}
function smtp_proxy {
MUTTRC_FILE=/home/$USER/.muttrc
if [ ! -f "$MUTTRC_FILE" ]; then
return
fi
SMTP_PROXY_ENABLE=$'no'
SMTP_PROXY_PROTOCOL='smtps'
SMTP_PROXY_SERVER='mail.myispdomain'
SMTP_PROXY_PORT=465
SMTP_PROXY_USERNAME=''
SMTP_PROXY_PASSWORD=''
if grep -q "set smtp_url" "$MUTTRC_FILE"; then
if grep -q "#set smtp_url" "$MUTTRC_FILE"; then
SMTP_PROXY_ENABLE=$'no'
else
SMTP_PROXY_ENABLE=$'yes'
fi
SMTP_PROXY_PROTOCOL=$(grep "set smtp_url" "$MUTTRC_FILE" | awk -F '"' '{print $2}' | awk -F ':' '{print $1}')
SMTP_PROXY_SERVER=$(grep "set smtp_url" "$MUTTRC_FILE" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $2}' | awk -F '@' '{print $2}')
SMTP_PROXY_PORT=$(grep "set smtp_url" "$MUTTRC_FILE" | awk -F ':' '{print $4}' | awk -F '/' '{print $1}')
SMTP_PROXY_USERNAME=$(grep "set smtp_url" "$MUTTRC_FILE" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')
SMTP_PROXY_PASSWORD=$(grep "set smtp_url" "$MUTTRC_FILE" | awk -F '"' '{print $2}' | awk -F '/' '{print $3}' | awk -F ':' '{print $2}' | awk -F '@' '{print $1}')
fi
data=$(mktemp 2>/dev/null)
dialog --backtitle $"Freedombone Control Panel" \
--title $"SMTP Proxy for $USER" \
--form $"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below." 14 75 6 \
$"Enable proxy:" 1 1 "$SMTP_PROXY_ENABLE" 1 24 5 5 \
$"Protocol (smtp/smtps):" 2 1 "$SMTP_PROXY_PROTOCOL" 2 24 5 5 \
$"ISP mail server:" 3 1 "$SMTP_PROXY_SERVER" 3 24 40 10000 \
$"Port:" 4 1 "$SMTP_PROXY_PORT" 4 24 5 5 \
$"Username:" 5 1 "$SMTP_PROXY_USERNAME" 5 24 40 10000 \
$"Password:" 6 1 "$SMTP_PROXY_PASSWORD" 6 24 40 10000 \
2> "$data"
sel=$?
case $sel in
1) rm -f "$data"
return;;
255) rm -f "$data"
return;;
esac
SMTP_PROXY_ENABLE=$(sed -n 1p < "$data")
SMTP_PROXY_PROTOCOL=$(sed -n 2p < "$data")
SMTP_PROXY_SERVER=$(sed -n 3p < "$data")
SMTP_PROXY_PORT=$(sed -n 4p < "$data")
SMTP_PROXY_USERNAME=$(sed -n 5p < "$data")
SMTP_PROXY_PASSWORD=$(sed -n 6p < "$data")
# change muttrc
if [ "$SMTP_PROXY_ENABLE" != $'no' ]; then
if ! grep -q "set smtp_url" "$MUTTRC_FILE"; then
echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> "$MUTTRC_FILE"
else
sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" "$MUTTRC_FILE"
fi
sed -i 's|#set smtp_url|set smtp_url|g' "$MUTTRC_FILE"
else
if grep -q "set smtp_url" "$MUTTRC_FILE"; then
sed -i 's|set smtp_url|#set smtp_url|g' "$MUTTRC_FILE"
fi
fi
rm -f "$data"
}
function sign_gpg_key {
data=$(mktemp 2>/dev/null)
dialog --title $"Sign a PGP/GPG key or website domain" \
......@@ -899,12 +833,11 @@ function menu_top_level {
4 $"Run an App"
5 $"Browse the Web"
6 $"My Encryption Keys"
7 $"Set an outgoing email proxy"
8 $"Administrator controls"
9 $"Exit to the command line")
7 $"Administrator controls"
8 $"Exit to the command line")
# shellcheck disable=SC2068
selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"User Control Panel" --menu $"Choose an operation, or ESC to log out:" 20 60 13 "${W[@]}" 3>&2 2>&1 1>&3)
selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"User Control Panel" --menu $"Choose an operation, or ESC to log out:" 20 60 12 "${W[@]}" 3>&2 2>&1 1>&3)
if [ ! "$selection" ]; then
kill -HUP "$(pgrep -s 0 -o)"
fi
......@@ -916,9 +849,8 @@ function menu_top_level {
4) menu_run_client_app;;
5) torify elinks -no-home;;
6) menu_encryption_keys;;
7) smtp_proxy;;
8) menu_admin;;
9) break;;
7) menu_admin;;
8) break;;
esac
done
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment