halo / macosvpn

:wrench: Create macOS VPNs programmatically (L2TP & Cisco)
Other
442 stars 72 forks source link

Add nil check for VPN password and shared secret #15

Closed steve-jansen closed 9 years ago

steve-jansen commented 9 years ago

Fixes an issue where below would fail to create the shared IPSec secret due to a lack of the --password CLI argument:

macosvpn create --l2tp example --endpoint vpn.example.com \
  --username user@example.com --shared-secret mysecret

Without this patch, the final 5 lines --debug lines are missing from the end of the debug output:

   Succeeded opening System Keychain
   Unlocking System Keychain
   Succeeded unlocking System Keychain
-  Created empty Keychain access object
-  Successfully created Keychain Item
-  Successfully created L2TP over IPSec VPN example with ID
:some_random_uuid
-
-  Finished.

This patch enables creation of a VPN Service which requires a shared secret but will prompt the end user for their password. This is helpful for Single Sign On (SSO) situations where the user is forced to change their passphrase every X days, and saving the password in the VPN Service will likely lead to account lockouts due to repeated attempts to use an old passphrase.

halo commented 9 years ago

Smart!