Xojo at Mac and Linux for VPN Client App


I have some questions.

[b]I have created a VPN CLient App like this :


At Windows with Visual Basic 2013.

Now some / much clients i have want that app also for MAC and Linux.
Now i startet with Xojo Trial and allready get completed the Login Etc for the App.

[b]Now i searched for a way to at VPN to MAC with Terminal or so but i found nothing working.


[b]Also for Proxy with Terminal.

At Linux there are some terminal command for adding VPN and Proxy .

I need PPTP and L2TP VPN and Socks Proxy.

[b]What can i do use a other software instead of Xojo like XCode or so for Mac have i there more option ?

I found a software of vyprvpn they get all working at mac like pptp , l2tp and openvpn and proxy but they are other VPN company and not open source.

Can anyone help / ggive me some suggestions / tipps etc ?

Ragards thanks .

Nobody can help ?

As you must know i can only buy then after trial xojo if i can realize my projekt with that.

This should get you started.

Thanks i also find that.

But with AppleScript the Users of the App see what the app does . And can read out the Username and Password of VPN of the AppleScript.

And with a terminal create vpn device its like an ethernet device there cannot be set a Username and password for connection.


The second answer shows the specific shell commands used to create/configure a VPN on OSX. Use the same commands in a Xojo shell, not Applescript. There may be a way to call the networksetup functions through an API but I’ve never tried that.

Also, a VPN will prompt for any missing credentials.

Thanks yes i tryed with networksetup but there will be create a VPN Device like a Eternet device and there is then no option do set the Username and Password.

I need to create a VPN L2TP and PPTP .

You understand what i mean ?

He understands better than you do.

That .NET tool with source that you linked just uses Windows’ built in services. You can do the same thing with Xojo. But you must learn how to setup a VPN manually on each platform before you can code it securely. @Tanner Lee gave you what you need to get there.

[b][b]When i set up VPN manually in network settings:


i can set Password / Username etc.

When i use[/b]

[b]Like here:

With Terminal Command:

networksetup -createnetworkservice VPNPPTP en0 - where en0

[b]Then i set up a VPN Device like an Ethernet Device see at screens there cannot be set a Password / Username



You know how i mean i find now way to set a VPN with networksetup like with manually setup.

Thats what i mean if you understand.

I searched yesterday over 10 hours in google etc and tested things. today also 5 hours but find nothing usefull.

Thanks at all for your help.

[b]And when i try with:

networksetup -createnetworkservice VPNPPTP PPTP

i say:[/b]

PPTP is not a valid hardware port name.
** Error: The parameters were not valid.

But when i list network serives it list the Test VPN PPTP with Hardware Port Name PPTP

(7) Test VPN PPTP
(Hardware Port: PPTP, Device: )

Someone know what i make wrong or how to do that ?

I’d read the man page for networksetup if I were you
It has a LOT of options

I’ve never had to do this so thats the best advice I can give as it sure looks like networksetup will be able to do what you want


Yes i readed all but there is nothing i found out for Create a VPN PPTP or L2TP with username and password.

Also with searching at google i found many forums where the people writed it not work with networksetup .

Is there any other option ?[/b]

Or that not work at Mac OS X ?

Make vpn-setup (vpnname) with networksetup and connect it with scutil

scutil --nc start vpnname --user yourname --password yourpass --secret qwerty

more info of scutil with:

scutil --nc help


Thanks. Mean you with that ?


networksetup -createnetworkservice VPNPPTP en0 - where en0

Because there the VPN Device is then a en0 / Ethernet Device not a VPN Device.

networksetup -createnetworkservice VPNName PPTP not work

Like at the screenshots above you see

Thats why i ask because with network setup VPN is not like VPN Device when create it Manualy without Terminal.[/b]

[b]Because when i at VPN with the networksetup

networksetup -createnetworkservice VPNPPTP en0 - where en0

It is not shown at scutil --nc list

Available network connection services in the current set (*=enabled):

  • (Disconnected) 78B956A5-7811-4AE4-9E3C-A3DB92107AE7 PPP --> Bluetooth DUN “Bluetooth DUN” [PPP:Bluetooth]
  • (Disconnected) 39759651-9E93-4DAD-9EE0-D46FCD619CA2 PPP --> Built-in Serial Port (2) “Built-in Serial Port (2)” [PPP:Modem]
  • (Disconnected) 108AD294-F4C4-4F82-B8A0-1918A3983486 PPP --> PPTP “Test VPN PPTP” [PPP:PPTP]
  • (Disconnected) 1AB245BD-30B8-4714-8457-814E763BDA76 PPP --> Built-in Serial Port (1) “Built-in Serial Port (1)” [PPP:Modem]

Only the manualy created VPN device is shown.[/b]

[b]Sry that i ask so much but all other things i need for app i found only not openvpn but that will be work then. when i find more about openvpn at mac os x.

Pnly this PPTP and l2TP thing with terminal i write not work .

Thanks at all for help.[/b]

Only need the question answerd above thank you @ all.


If You can’t do what You want with networksetup, You might want to try this commandline tool:

Creating a single L2TP over IPSec VPN Service:

macosvpn create --l2tp Atlantic --endpoint atlantic.example.com --username Alice --password p4ssw0rd --shared-secret s3same

Thanks yes that i also found.

[b]Is there realy now way with networksetup or other mac os x built in service with that it work ?

because i also want create pptp but this tool only can l2tp.[/b]

For now i make it with that . But must search for other way for PPTP

[b]Because at my MAC i get allways error that the connection to L2TP VPN not work / Server not answer only with PPTP it work at Windows / Linux both work.

At MAC also when i set manually the L2TP it also not work.

Thanks alot.

Seems that there is not option to create vpn with networksetup.
You could also try to export .networkConnect file from System Preferences.
(Create vpn interface, export it and there you have sample file)
It’s xml-file that you could generate yourself and then import to system with something like this maybe:

/usr/bin/open "/path/to/vpn_pptp.networkConnect" /usr/bin/osascript << EOF > /dev/null 2>&1 tell application "System Events" tell process "System Preferences" tell window "Network" click button "Apply" end tell end tell end tell tell application "System Events" tell application "System Preferences" to quit end tell EOF


But at this way the user also see that the app to something.

What script is this for ? i tryed with Applscript
but get error that first 2 lines not ok and in terminal it not to it automatic and i split it the first 2 lines for terminal and then the other as applescript.

But thank you very much for your fast help.

I think i need more time for this vpn thing at mac. I work again at linux more and windows version.