summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/connman_dmenu
diff options
context:
space:
mode:
authorrafa_99 <raroma09@gmail.com>2022-04-10 15:28:03 +0100
committerrafa_99 <raroma09@gmail.com>2022-04-10 15:28:03 +0100
commit00d9a2b120387ba104586955833d16c842945a24 (patch)
treef8b835cbd0124df4f568dafe296978a4f54057b9 /scripts/.local/bin/connman_dmenu
parent266fff4e5e87341ef3684232d87a10bfb41f1eee (diff)
Password secrecy in connman script
Diffstat (limited to 'scripts/.local/bin/connman_dmenu')
-rwxr-xr-xscripts/.local/bin/connman_dmenu12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/.local/bin/connman_dmenu b/scripts/.local/bin/connman_dmenu
index 0d09240..2d35e0a 100755
--- a/scripts/.local/bin/connman_dmenu
+++ b/scripts/.local/bin/connman_dmenu
@@ -86,6 +86,14 @@ dmenu_ask() {
fi
}
+dmenu_ask_pass() {
+ IFS= read -r "$2" < <(: | dmenu -P -p "$1")
+ if [[ ! "${!2}" ]]; then
+ dmenu_notify "invalid $2"
+ exit 1
+ fi
+}
+
if (( EUID != 0 )); then
dmenu_notify 'please run it as root'
exit 1
@@ -100,7 +108,7 @@ if [[ "$index" == setup ]] ; then
name="${name// /_}"
dmenu_ask 'please provide VPN domain' domain
dmenu_ask 'please provide identity' identity
- dmenu_ask 'please provide password' password
+ dmenu_ask_pass 'please provide password' password
cat > "$VPN_STORAGE_PATH/$name.config" <<-EOF
[provider_$name]
Type = PPTP
@@ -134,7 +142,7 @@ if [[ "$security" =~ ^(ieee8021x|psk|wep)$ ]]; then
if [[ -f "$config_file" && no != "$(echo -e 'yes\nno' | dmenu -p 'use previous profile?')" ]]; then
echo "use old profile: $config_file"
else
- dmenu_ask 'please provide password' password
+ dmenu_ask_pass 'please provide password' password
case "$security" in
ieee8021x)
dmenu_ask 'please provide identity' identity