Malav Soni
Malav Soni

Reputation: 2848

Creating L2TP VPN on Mac OS X Programatically

I am trying to make application which can be use to connect to VPN using L2TP Protocol for Mac OSX Application using Objective C.

I search a lot regarding this but couldn't find any proper example or tutorial.

I Found halo/macosvpn for mac os vpn connection but it is command line tool i would like to make it in my application.

For E.g If i pass Server id, Shared Secret Key, username, password then my mac should be automatically connect to that VPN Server.

Any help will be appreciated...

Upvotes: 6

Views: 1711

Answers (1)

neskafesha
neskafesha

Reputation: 184

No, you need use SCNetwork and Helper Tool (to get root access) With this link you will be able to create L2TP Protocol and connect with it.

This works even on the latest version MacOS 11 "Big Sure"

The helper tool is needed to get root access so you can make changes to the system keychain. You will put the password and shared secret there, because the configuration will not be able to perceive them from other places. Having created a vpn configuration with the help of SCNetwork, the mac will not be able to automatically connect.

To connect to the created profile, you need to programmatically execute the terminal command

networksetup -connectpppoeservice "name VPN profile"

Upvotes: 0

Related Questions