Page 1 of 1

How to configure automatic connections with OpenVPN 3.0.5

Posted: 23 Aug 2018 17:01
by Pistolero
Hi all!

Could a gentle soul please help with the correct syntax for the EXTRA values as delineated in the official OpenVPN FAQ for automatic connections: https://docs.openvpn.net/connecting/con ... or_Android

Code: Select all

1. CONNECT

a) Access Server module
Action: net.openvpn.openvpn.CONNECT
OR
Action: android.intent.action.VIEW
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME:AS {your_profile_name}
Extra: net.openvpn.openvpn.AUTOCONNECT:true
Extra: net.openvpn.openvpn.APP_SECTION:AS
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

b) OVPN Profile module
Action: net.openvpn.openvpn.CONNECT
OR
Action: android.intent.action.VIEW
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME:PC {your_profile_name}
Extra: net.openvpn.openvpn.AUTOCONNECT:true
Extra: net.openvpn.openvpn.APP_SECTION:PC
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

2. DISCONNECT
Action: net.openvpn.openvpn.DISCONNECT
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.STOP:true
Extra: {blank}
Extra: {blank}
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity
Could someone please assist in translating these commands to Automagicallese? :P

BTW, I use the OVPN Profile module.

Mil gracias!

Francisco.

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 23 Aug 2018 18:18
by Desmanto
I just answer here, since you have open a new thread, and it is more complex than the first one.

In each of the Action, you can actually see each field correspond to the same field in the automagic. Only the extra will be a bit different. All action target to activity, so you should use Automagic Action : Start Activity. For blank field, i simply skip it, as you don't have to fill it.

1. CONNECT
Action : net.openvpn.openvpn.CONNECT or android.intent.action.VIEW
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "AS {your_profile_name}");
putString("net.openvpn.openvpn.AUTOCONNECT", "true");
putString("net.openvpn.openvpn.APP_SECTION", "AS");
2. OVPN Profile Module
Action : net.openvpn.openvpn.CONNECT or android.intent.action.VIEW
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "PC {your_profile_name}");
putString("net.openvpn.openvpn.AUTOCONNECT", "true");
putString("net.openvpn.openvpn.APP_SECTION", "PC");
3. DISCONNECT
Action : net.openvpn.openvpn.DISCONNECT
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.STOP", "true");
Most of the time, the extras is injected as string. But sometimes for true/false extras, you need to use putBoolean() instead. So if

Code: Select all

putString("net.openvpn.openvpn.STOP", "true");
doesn't work. Try

Code: Select all

putBoolean("net.openvpn.openvpn.STOP", true);

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 23 Aug 2018 21:41
by Pistolero
Sir, you are true gentleman geek. I am grateful for your share of knowledge.

so, gracias!

Respect!
Desmanto wrote:I just answer here, since you have open a new thread, and it is more complex than the first one.

In each of the Action, you can actually see each field correspond to the same field in the automagic. Only the extra will be a bit different. All action target to activity, so you should use Automagic Action : Start Activity. For blank field, i simply skip it, as you don't have to fill it.

1. CONNECT
Action : net.openvpn.openvpn.CONNECT or android.intent.action.VIEW
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "AS {your_profile_name}");
putString("net.openvpn.openvpn.AUTOCONNECT", "true");
putString("net.openvpn.openvpn.APP_SECTION", "AS");
2. OVPN Profile Module
Action : net.openvpn.openvpn.CONNECT or android.intent.action.VIEW
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "PC {your_profile_name}");
putString("net.openvpn.openvpn.AUTOCONNECT", "true");
putString("net.openvpn.openvpn.APP_SECTION", "PC");
3. DISCONNECT
Action : net.openvpn.openvpn.DISCONNECT
Package Name : net.openvpn.openvpn
Class Name : net.openvpn.unified.MainActivity
Extras :

Code: Select all

putString("net.openvpn.openvpn.STOP", "true");
Most of the time, the extras is injected as string. But sometimes for true/false extras, you need to use putBoolean() instead. So if

Code: Select all

putString("net.openvpn.openvpn.STOP", "true");
doesn't work. Try

Code: Select all

putBoolean("net.openvpn.openvpn.STOP", true);

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 23 Aug 2018 21:56
by Pistolero
Sadly, the connect action just brings up the OpenVPN app interface and does nothing then...

@Desmanto, did this work for you, sir?

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 24 Aug 2018 05:44
by Desmanto
I don't use openVPN and I rarely use VPN at all, so can't test it. I simply translate the documentation to Automagic-ish

Try the VPN disconnect first. Connect to one of your VPN profile, then execute the start activity. If it doesn't work, try the putBoolean() version.

Then for the connect, try the putBoolean() version too

Code: Select all

putBoolean("net.openvpn.openvpn.AUTOCONNECT", true);
For the profile name, make sure you type it properly, including the upper/lower case. Example, if profile name is : TestAccount

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "AS TestAccount")

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 24 Aug 2018 18:03
by Pistolero
Sir, once again you have shown your great knowledge. Thank you! It was the Boolean method that did the trick.

Whenever you come to sunny Cancun, look me up, we'll go have some tequilas!
Desmanto wrote:I don't use openVPN and I rarely use VPN at all, so can't test it. I simply translate the documentation to Automagic-ish

Try the VPN disconnect first. Connect to one of your VPN profile, then execute the start activity. If it doesn't work, try the putBoolean() version.

Then for the connect, try the putBoolean() version too

Code: Select all

putBoolean("net.openvpn.openvpn.AUTOCONNECT", true);
For the profile name, make sure you type it properly, including the upper/lower case. Example, if profile name is : TestAccount

Code: Select all

putString("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "AS TestAccount")

Re: How to configure automatic connections with OpenVPN 3.0.

Posted: 25 Aug 2018 23:46
by Pistolero
Sharing my working flow. Just change the SSID list with your trusted network names.

All credit goes to Desmanto.