How to configure automatic connections with OpenVPN 3.0.5

Post your questions and help other users.

Moderator: Martin

Post Reply
Pistolero
Posts: 6
Joined: 22 Aug 2018 14:34

How to configure automatic connections with OpenVPN 3.0.5

Post by Pistolero » 23 Aug 2018 17:01

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.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Desmanto » 23 Aug 2018 18:18

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);
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Pistolero
Posts: 6
Joined: 22 Aug 2018 14:34

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Pistolero » 23 Aug 2018 21:41

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);

Pistolero
Posts: 6
Joined: 22 Aug 2018 14:34

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Pistolero » 23 Aug 2018 21:56

Sadly, the connect action just brings up the OpenVPN app interface and does nothing then...

@Desmanto, did this work for you, sir?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Desmanto » 24 Aug 2018 05:44

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")
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Pistolero
Posts: 6
Joined: 22 Aug 2018 14:34

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Pistolero » 24 Aug 2018 18:03

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")

Pistolero
Posts: 6
Joined: 22 Aug 2018 14:34

Re: How to configure automatic connections with OpenVPN 3.0.

Post by Pistolero » 25 Aug 2018 23:46

Sharing my working flow. Just change the SSID list with your trusted network names.

All credit goes to Desmanto.
Attachments
flow_OpenVPN_20180825_183419.xml
Sharing my working autoconnect flow for openvpn.

All credit goes to Desmanto.

Thanks, sir!
(5.06 KiB) Downloaded 826 times

Post Reply