-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Viscosity OTP uses macOS preferences (defaults) to map each VPN connection to a shell command that fetches the OTP code.
defaults write net.skycmd.viscosity-otp "<connection-name>" "<otp-command>"-
<connection-name>— the name of your VPN connection exactly as it appears in Viscosity (case-sensitive) -
<otp-command>— a shell command that outputs your OTP code to stdout
defaults write net.skycmd.viscosity-otp "My Work VPN" "/usr/local/bin/op item get abc123 --otp"See Providers for commands for specific OTP tools.
To see all configured connections:
defaults read net.skycmd.viscosity-otpTo see the command for a specific connection:
defaults read net.skycmd.viscosity-otp "<connection-name>"defaults delete net.skycmd.viscosity-otp "<connection-name>"defaults delete net.skycmd.viscosity-otpBefore connecting, verify your OTP command works by running it directly:
defaults read net.skycmd.viscosity-otp "<connection-name>" | shThis should output a 6-digit OTP code. If it doesn't, fix the command before connecting.
Each connection has its own command. You can use different providers for different connections:
defaults write net.skycmd.viscosity-otp "Work VPN" "/usr/local/bin/op item get abc123 --otp"
defaults write net.skycmd.viscosity-otp "Client VPN" "/usr/local/bin/bw get totp my-client-vpn"All connections share the same BeforeConnect.applescript — the script reads the connection name from Viscosity at runtime and looks up the appropriate command.
Configuration is stored in a standard macOS preferences plist:
~/Library/Preferences/net.skycmd.viscosity-otp.plistYou can also edit this file directly with a plist editor, but using defaults is recommended.