File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ export LAZY_CONNECT_TOTP_QUERY=<name of the issuer>
56
56
57
57
### Warning
58
58
59
- - The secret key to generate TOTP is stored as plain text in ` ~/.config/lazy-connect/secret `
59
+ - The secret key to generate TOTP is stored in Keychain on Mac under default ` login ` keychain. You may need to
60
+ enter your login password to allow access to Keychain.
60
61
- You need to add your Termainal emulator app that invokes the function to ` Security & Privacy -> Accessibility ` . It is
61
62
necesssary because the script interacts with the UI. There are other ways via CLI to avoid UI interaction but
62
63
they are all broken in OS X 10.12+.
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ function _lazy_connect_init() {
11
11
echo -n " Secret Key: "
12
12
read -s secret_key
13
13
echo " **********"
14
- echo $secret_key > $_lazy_connect_config_dir /secret
14
+
15
+ echo ' Storing secret in keychain.'
16
+ security add-generic-password -a lazy-connect -p " $secret_key " -s lazy-connect
15
17
;;
16
18
esac
17
19
_lazy_connect_vpn_refresh
@@ -171,7 +173,13 @@ function lazy-connect() {
171
173
esac
172
174
done
173
175
174
- secret=$( cat $_lazy_connect_config_dir /secret)
176
+ local secret=$( security find-generic-password -a lazy-connect -w 2> /dev/null | tr -d ' \n' )
177
+ if [ -z " $secret " ];
178
+ then
179
+ echo " Secret not found in keychain. Initialize lazy-connect and try again."
180
+ return 1
181
+ fi
182
+
175
183
vpn_name=$( cat $_lazy_connect_config_dir /vpns \
176
184
| fzf --height=10 --ansi --reverse --query " $* " --select-1)
177
185
[ -z " $vpn_name " ] || _lazy_connect " $vpn_name " " $secret "
You can’t perform that action at this time.
0 commit comments