.ovpn file cannot be imported in Android, but works perfectly in Windows

Official client software for OpenVPN Access Server and OpenVPN Cloud.
Post Reply
Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

.ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Thu Feb 11, 2021 12:05 am

I have a .ovpn config file that works perfectly in the Windows OpenVPN GUI, but when I want to import the same file in Android it gives the following message: "Failed to parse profile: option_error: remote option not specified".
This is very strange because it is no problem in Windows and the remote option is specified (see below). Is this a bug in the Android app (OpenVPN Connect)? I obtained the .ovpn file from a Synology NAS configuration.

My .ovpn file looks like this:

Client config

dev tun
tls-client

remote my.ddns.com 1194

# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)

#float

# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)

#redirect-gateway def1

# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.

#dhcp-option DNS DNS_IP_ADDRESS

pull

# If you want to connect by Server's IPv6 address, you should use
# "proto udp6" in UDP mode or "proto tcp6-client" in TCP mode
proto udp

script-security 2



reneg-sec 0

cipher AES-256-CBC

auth SHA512

auth-user-pass

auth-nocache
<ca>
-----BEGIN CERTIFICATE-----
ABCDEFGHIJ
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
KLMNOPQRST
-----END CERTIFICATE-----

</ca>
Last edited by Joachim on Thu Feb 11, 2021 7:34 pm, edited 2 times in total.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Thu Feb 11, 2021 12:46 am

Joachim wrote:
Thu Feb 11, 2021 12:05 am
I obtained the .ovpn file from a Synology NAS configuration
Yikes .. is that a very old Synology NAS ?

Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Thu Feb 11, 2021 1:25 am

No, it is a recent one (DS218). But I don't think that this can have something to do with the error because the error comes immediately when I try to open the config file on Android (the app is clearly not taking the time to search for a server). So I would assume that there is some missing information in the file that is very important. But my VPN connection works perfect on Windows, which is really strange.

I forgot to mention that I used on Windows the software 'OpenVPN 2.5.0' from https://openvpn.net/community-downloads/. Is there a difference with the installer 'OpenVPN Connect 3.2.2' for Windows from https://openvpn.net/download-open-vpn/ ? The latter has the same name as the app for Android.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Thu Feb 11, 2021 2:15 am

Joachim wrote:
Thu Feb 11, 2021 1:25 am
I forgot to mention that I used on Windows the software 'OpenVPN 2.5.0' from https://openvpn.net/community-downloads/. Is there a difference with the installer 'OpenVPN Connect 3.2.2' for Windows from https://openvpn.net/download-open-vpn/ ? The latter has the same name as the app for Android.
OpenVPN Connect is Closed source .. not on my radar. Try Arne Schwabe's version.

Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Thu Feb 11, 2021 7:06 pm

When I try to use Arne Schwabe's version, I can choose to import the .ovpn file, but I thought that this file also contains the certificate. However, the app asks to import the certificate separately. Why is this, when it could just be read from the .ovpn? In OpenVPN 2.5.0 on Windows I just needed a .ovpn file.

Which 'type' should I choose in the app? Because I have indeed the certificate (same as in the .ovpn file) in a separate file with a .crt extension, but in most 'type' options in the app I need to choose multiple files. There is also an option 'username/password', but is that not always needed to connect to a VPN? For me this is the case on my computer. In the Windows version 'OpenVPN Connect' it is also needed to import the certificate as a separate file for some strange reason, but there also just one file is sufficient and the VPN works fine.

I am also unfamiliar with the terminology: CA certificate, cert certificate, client certificate, server certificate, root certificate, intermediate certificate. Which one is is the certificate from the .ovpn file? Is CA synonym for client certificate?

Just for my information: is there really no support platform for questions about OpenVPN Connect? This is quite confusing because the name of this subforum is 'OpenVPN Connect (Android)' :)

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Thu Feb 11, 2021 7:35 pm


Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Thu Feb 11, 2021 9:10 pm

But as you can see from my code in the first message. The CA certificate is already inline. So I don't understand the problem.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Thu Feb 11, 2021 9:52 pm

In your first post the problem was remote

Some other help:
https://community.openvpn.net/openvpn/w ... s_PKI_work

Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Fri Feb 12, 2021 9:43 am

Thank you, that seems to be an interesting article about certificates.

Sorry, if my explanation was confusing. I will summerise it again.
In my first post I gave the .ovpn config file that has an inserted CA certificate. This worked perfectly on Windows OpenVPN 2.5.0 (open source software) to establish a complete functional VPN connection. So a really simple configuration.
Then, I tried to use the same .ovpn file to configure the Android OpenVPN Connect (closed source as you said), but then I got the error "Failed to parse profile: option_error: remote option not specified" (see also first message).
Then, you said you could not help me with the closed source Android version, so as you suggested I am now trying to use the open source Android version from Arne Schwabe.

But my question now is: which settings in that app should I choose so that it is sufficient to just import the .ovpn config file as given in my first post? Is there an easy configuration method as easy as for Windows OpenVPN 2.5.0? So with other words, is there a setting in Arne Schwabe's app that prevents the recognition of the inline CA certificate from my .ovpn file?
Last edited by Joachim on Fri Feb 12, 2021 3:21 pm, edited 1 time in total.

Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Fri Feb 12, 2021 2:56 pm

Wow, I finally found the SOLUTION!!! The same .ovpn config file works now for both Windows and Android!
I now totally understand why you couldn't help me :)

Both OpenVPN Connect for Android and OpenVPN from Arne Schwabe apparently didn't find any data in my .ovpn file. When I open my file in Windows with Notepad, I can perfectly see normal text in the .ovpn file. However, when I send the file to my phone via e-mail to my own e-mail address and I open the .ovpn file with a simple text editor, the file is blank! Of course the apps cannot detect any configurations from an unreadable file and give errors like 'there is no remote chosen' or 'no CA certificate is present'.

I also did a separate test: I created a random .txt file on Windows with Notepad, then I sent it to my own e-mail and tried to open it with a texteditor. Now the file appeared not empty, but only some unreadable strange symbols were visible.

SOLUTION:
The problem is a very very very specific bug! When you send a simple text file like .txt or .ovpn with a mail address that is configured with IMAP in Microsoft Outlook 2019 to another (or your own) e-mail address that can be IMAP configured on the Gmail app on your Android phone, then the .txt attachment becomes corrupted upon opening. It becomes also unreadable in Windows when I would bring the file back to my Windows PC by transferring it via USB to my PC. So the file is permanantly corrupted.
When you would open the same received mail with another IMAP configured Android mail app, the file is not corrupted.
When the email sender uses the webmail interface of the email-provider instead of IMAP in Outlook, then there is also no problem when the receiver opens the attachment in the IMAP configured Android Gmail app.
When you use non-IMAP configured e-mail addresses as sender OR as receiver, there is also no problem.

In fact this bug should be send to both Google and Microsoft. Do you have connections? :)

I would never have encountered the problem if I would have just used a USB connection to transfer the file to my phone.

I am so happy my Open VPN finally works on Android! :) All this waste of time just because of a stupid mail bug that has nothing to do with OpenVPN :(
Last edited by Joachim on Fri Feb 12, 2021 5:20 pm, edited 2 times in total.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Fri Feb 12, 2021 5:16 pm

Joachim wrote:
Fri Feb 12, 2021 2:56 pm
when I send the file to my phone and I open the .ovpn file with a simple texteditor, it is blank!
I guess the way you send it to the phone is broken ..

Joachim
OpenVpn Newbie
Posts: 8
Joined: Wed Feb 10, 2021 11:37 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Joachim » Fri Feb 12, 2021 5:27 pm

I was just editing my previous message with the solution, while you answered it :) So you can read the solution there. It was indeed the way I sent it to my phone that caused the file to be corrupted.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by TinCanTech » Fri Feb 12, 2021 5:35 pm

Thanks for the update 8-)

DanDewey
OpenVpn Newbie
Posts: 2
Joined: Wed Aug 31, 2022 8:56 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by DanDewey » Wed Aug 31, 2022 8:58 pm

Can I just say thanks for this advice I too was having the same issue where PC worked but android didn't.

I also emailed the file, but following the advice here I saved into google drive then open on phone and it worked straight away no issues.

Pawel_71
OpenVpn Newbie
Posts: 1
Joined: Wed Jan 11, 2023 3:54 pm

Re: .ovpn file cannot be imported in Android, but works perfectly in Windows

Post by Pawel_71 » Wed Jan 11, 2023 4:01 pm

Hi mate.
I had the same problem. The solution was to install an older version of the software. The new version does not ask for permissions. I installed the old version, from 2021 - ver. 3.2.4., which asks for file permissions during installation. After its launch, the import of the profile took place without any problems. I downloaded the app from APK Mirror. After importing the profile, I updated the app. The profile works.
Simple solutions are the best



.

Post Reply