Automate strongswan VPN connection

369 views
Skip to first unread message

Janet MP

unread,
Nov 6, 2018, 4:25:06 PM11/6/18
to Automate
Hi,
I want to automate strongswan android VPN connect and disconnect based on my location and connected wifi network.

According to strongswan wiki https://wiki.strongswan.org/projects/strongswan/wiki/androidvpnclient it shall be possible to achieve with actions
"org.strongswan.android.action.START_PROFILE" and "org.strongswan.android.action.DISCONNECT" with extras filled with "org.strongswan.android.VPN_PROFILE_ID : UUID of the profile".

I use "start app" building block but stuck at at filling EXTRAS dictionary : {"org.strongswan.android.VPN_PROFILE_ID" : UUID }. I can get UUID of the profile from strongswan configuration but don't know how to correctly put in to the dictionary.

I don't see a ready made flow for the purpose. Please help me complete it.

Thanks in advance!
Janet

Janet MP

unread,
Nov 7, 2018, 4:28:06 PM11/7/18
to Automate
Hi,
It now works.

Connect to a predefined VPN: Use "start app" block -> PACKAGE: org.strongswan.android -> ACTION: "org.strongswan.android.action.START_PROFILE" -> EXTRAS: {"org.strongswan.android.VPN_PROFILE_ID" : "UUID of the profile" }

Disconnect a predefined VPN: Use "start app" block -> PACKAGE: org.strongswan.android -> ACTION: "org.strongswan.android.action.DISCONNECT" -> EXTRAS: {"org.strongswan.android.VPN_PROFILE_ID" : "UUID of the profile" }

Just put exact exact UUID string with "" to EXTRAS library will work. I did not use "" to enclose the UUID.

My flow use the "WiFi connected?" block to determine if my phone is connected to my home WiFi. When connection change, it connect or disconnect VPN accordingly.

Janet
Reply all
Reply to author
Forward
0 new messages