UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    OpenVPN setup does not offer what i need for my vpn server....

    Scheduled Pinned Locked Moved Unsolved Support
    50 Posts 8 Posters 1.0k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • G Online
        gpatel-fr @Vlad Nirky
        last edited by

        @Vlad-Nirky said in OpenVPN setup does not offer what i need for my vpn server....:

        Authenticate/Decrypt packet error: packet HMAC authentication failed

        looks like a mismatch for the ta.key file.

        @Vlad-Nirky said in OpenVPN setup does not offer what i need for my vpn server....:

        'auth' is used inconsistently, local='auth SHA256', remote='auth SHA1'

        should have the same value for client and server...how that can be possible if you generated the config for the phone from the working config on the PC ?

        1 Reply Last reply Reply Quote 0
        • G Online
          gpatel-fr @zakafx
          last edited by

          @zakafx

          I don't know if you are still struggling with this OpenVpn configuration, it seems that the default configuration generated with PIVpn assumes that every access should be routed by the server, if you have as a symptom that all Internet access is lost after launching the VPN this could be a reason, routing everything through the server is often not what is wanted anyway. Try to use easy-openvpn-server instead, from what I remember it generates a more usable configuration.

          Vlad NirkyV 2 Replies Last reply Reply Quote 0
          • Vlad NirkyV Online
            Vlad Nirky @gpatel-fr
            last edited by Vlad Nirky

            @gpatel-fr
            Solved.
            Add this in nmconnection file before import.
            cipher AES-256-CBC
            cipher AES-256-GCM
            auth SHA256
            ncp-disable

            Critical lines in your Ubuntu Touch log
            WARNING: ‘auth’ is used inconsistently, local=‘auth SHA256’, remote=‘auth SHA1’
            phde/188.5.220.190:1210 Authenticate/Decrypt packet error: packet HMAC authentication failed
            The server uses SHA256 authentication
            The Ubuntu Touch client uses SHA1 authentication
            Result: the HMACs of the data packets do not match → rejection.

            Why does Fedora work?

            Fedora (OpenVPN 2.6.15 with AEAD/DCO) does not need separate “auth” because AES-256-GCM mode already includes authentication in the encryption.
            Ubuntu Touch, on the other hand, still forces an older mode (AES-256-CBC + SHA1 authentication).

            G 1 Reply Last reply Reply Quote 0
            • Vlad NirkyV Online
              Vlad Nirky @gpatel-fr
              last edited by

              @gpatel-fr @OtaDr @gpatel-fr

              Thanks for your help !

              1 Reply Last reply Reply Quote 0
              • G Online
                gpatel-fr @Vlad Nirky
                last edited by

                @Vlad-Nirky said in OpenVPN setup does not offer what i need for my vpn server....:

                Fedora (OpenVPN 2.6.15 with AEAD/DCO) does not need separate “auth” because AES-256-GCM mode already includes authentication in the encryption.

                probably a mismatch in Openvpn versions, they have this habit of changing some parameters meaning. Nice wrap-up, thanks for the explanation.

                1 Reply Last reply Reply Quote 0
                • J Online
                  jagdtigger @Vlad Nirky
                  last edited by jagdtigger

                  @Vlad-Nirky
                  Did your method with the nmcli import command (only had to add the user+pass in the UT GUI), still get timeout on the phone and the same errors in openvpn log. And i think i know why. Seems like nmcli has its own mind and omitted settings from the imported config....
                  Original

                  client
                  remote '<domain>'
                  tun-ipv6
                  cert '/home/phablet/Documents/vpn/phone.crt'
                  key '/home/phablet/Documents/vpn/phone.key'
                  ca '/home/phablet/Documents/vpn/server.crt'
                  auth-user-pass
                  dev tun
                  dev-type tun
                  proto udp
                  port <port>
                  tls-crypt '/home/phablet/Documents/vpn/tls.key'
                  tls-version-min '1.3' or-highest
                  nobind
                  auth-nocache
                  script-security 2
                  persist-key
                  persist-tun
                  user nm-openvpn
                  group nm-openvpn
                  
                  

                  Imported:

                  root@ubuntu-phablet:/home/phablet/Documents/vpn# cat /etc/netplan/90-NM-f1365f35-54fb-432f-8a95-fd811aafd906.yaml 
                  network:
                    version: 2
                    nm-devices:
                      NM-f1365f35-54fb-432f-8a95-fd811aafd906:
                        renderer: NetworkManager
                        networkmanager:
                          uuid: "f1365f35-54fb-432f-8a95-fd811aafd906"
                          name: "main-vpn"
                          passthrough:
                            connection.type: "vpn"
                            vpn.ca: "/home/phablet/Documents/vpn/server.crt"
                            vpn.cert: "/home/phablet/Documents/vpn/phone.crt"
                            vpn.cert-pass-flags: "1"
                            vpn.connection-type: "password-tls"
                            vpn.dev: "tun"
                            vpn.dev-type: "tun"
                            vpn.key: "/home/phablet/Documents/vpn/phone.key"
                            vpn.password-flags: "1"
                            vpn.port: "<port>"
                            vpn.remote: "<domain>"
                            vpn.username: "<user>"
                            vpn.service-type: "org.freedesktop.NetworkManager.openvpn"
                            ipv4.method: "auto"
                            ipv6.addr-gen-mode: "default"
                            ipv6.method: "auto"
                            proxy._: ""
                  
                  

                  No wonder the server has tls errors, the tls-crypt option is missing.

                  Vlad NirkyV G 2 Replies Last reply Reply Quote 0
                  • Vlad NirkyV Online
                    Vlad Nirky @jagdtigger
                    last edited by Vlad Nirky

                    @jagdtigger
                    I imagine it also depends on the VPN server and its configuration...
                    This works for me.

                    phablet@ubuntu-phablet:~$ cat /home/phablet/Documents/KeePass/phde.nmconnection 
                    client
                    remote '<my_server>.ddns.net' 1194
                    cert '/home/phablet/.cert/nm-openvpn/phde-cert.pem'
                    key '/home/phablet/.cert/nm-openvpn/phde-key.pem'
                    ca '/home/phablet/.cert/nm-openvpn/phde-ca.pem'
                    cipher AES-256-GCM
                    auth SHA256
                    ncp-disable
                    dev tun
                    proto udp
                    remote-cert-tls server
                    verify-x509-name rpi3_9b0ae2d9-f297-4706-ab24-8b9d63b3a51f name
                    tls-crypt '/home/phablet/.cert/nm-openvpn/phde-tls-crypt.pem'
                    tls-version-min '1.2'
                    nobind
                    auth-nocache
                    script-security 2
                    persist-key
                    persist-tun
                    user nm-openvpn
                    group nm-openvpn
                    route 192.168.128.0 255.255.254.0
                    
                    J 1 Reply Last reply Reply Quote 0
                    • G Online
                      gpatel-fr @jagdtigger
                      last edited by

                      @jagdtigger

                      oh well TIL that Ubuntu is patching network-manager to backup the network configuration changes to netplan. I was sticking to the old advice 'either netplan OR network-manager'.

                      For your information, network manager is a Gnome thing and wants nothing to do with netplan that is an Ubuntu thing. Since Ubuntu mostly uses Gnome, this patching tries to make for a better config since network manager is deeply integrated into Gnome. Adding OpenVpn and Ubuntu Touch (that don't use Gnome) is not making things much clearer in the corner cases unfortunately.
                      So I don't find the idea of getting a netplan config invalid or fighting with Network Manager particularly surprising.
                      I have no idea if just editing the netplan file and restarting netplan with sudo netplan apply will 'stick' in UT.

                      1 Reply Last reply Reply Quote 0
                      • J Online
                        jagdtigger @Vlad Nirky
                        last edited by jagdtigger

                        @Vlad-Nirky
                        Every other client, including this phone with the openvpn app when it was running android connected just fine so i have doubts about the server causing it.
                        Server log:

                        Oct 26 11:23:17	openvpn	68034	openvpn server 'ovpns1' user '<phone>' address '<phone_ip>:2866' - connected
                        Oct 26 11:23:17	openvpn	89539	MULTI_sva: push_ifconfig_ipv6 <ip6>
                        Oct 26 11:23:16	openvpn	63105	openvpn server 'ovpns1' user '<phone>' address '<phone_ip>:2866' - connecting
                        Oct 26 11:23:16	openvpn	89539	phone/<phone_ip>:2866 MULTI_sva: push_ifconfig_ipv6 <ip6>
                        Oct 26 11:23:16	openvpn	89539	phone/<phone_ip>:2866 MULTI_sva: pool returned IPv4=10.125.220.2, IPv6=<ip6>
                        Oct 26 11:23:15	openvpn	5699	user '<phone>' authenticated
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 [phone] Peer Connection Initiated with [AF_INET]<phone_ip>:2866
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_COMP_STUBv2=1
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_COMP_STUB=1
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_LZO_STUB=1
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_PROTO=990
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_CIPHERS=AES-256-GCM:CHACHA20-POLY1305
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_MTU=1600
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_TCPNL=1
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_PLAT=linux
                        Oct 26 11:23:15	openvpn	89539	<phone_ip>:2866 peer info: IV_VER=2.6.14
                        

                        Phone console output (usb adb shell):

                        phablet@ubuntu-phablet:~/Documents/vpn$ sudo openvpn --config ./main-vpn.ovpn
                        2025-10-26 11:23:09 Unrecognized option or missing or extra parameter(s) in ./main-vpn.ovpn:11: block-outside-dns (2.6.14)
                        2025-10-26 11:23:09 OpenVPN 2.6.14 aarch64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] [DCO]
                        2025-10-26 11:23:09 library versions: OpenSSL 3.0.13 30 Jan 2024, LZO 2.10
                        2025-10-26 11:23:09 DCO version: N/A
                        Enter Auth Username: <phone>
                        Enter Auth Password: ••••••••••              
                        2025-10-26 11:23:15 TCP/UDP: Preserving recently used remote address: [AF_INET]<server>
                        2025-10-26 11:23:15 UDPv4 link local: (not bound)
                        2025-10-26 11:23:15 UDPv4 link remote: [AF_INET]<server>
                        2025-10-26 11:23:15 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
                        2025-10-26 11:23:15 [openvpn_server-cr] Peer Connection Initiated with [AF_INET]<server>
                        2025-10-26 11:23:17 Options error: Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:3: block-outside-dns (2.6.14)
                        2025-10-26 11:23:17 Options error: Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:4: register-dns (2.6.14)
                        2025-10-26 11:23:17 WARNING: You have specified redirect-gateway and redirect-private at the same time (or the same option multiple times). This is not well supported and may lead to unexpected results
                        2025-10-26 11:23:17 WARNING: You have specified redirect-gateway and redirect-private at the same time (or the same option multiple times). This is not well supported and may lead to unexpected results
                        2025-10-26 11:23:17 WARNING: You have specified redirect-gateway and redirect-private at the same time (or the same option multiple times). This is not well supported and may lead to unexpected results
                        2025-10-26 11:23:17 sitnl_send: rtnl: generic error (-101): Network is unreachable
                        2025-10-26 11:23:17 TUN/TAP device tun0 opened
                        2025-10-26 11:23:17 net_iface_mtu_set: mtu 1500 for tun0
                        2025-10-26 11:23:17 net_iface_up: set tun0 up
                        2025-10-26 11:23:17 net_addr_v4_add: <ip4> dev tun0
                        2025-10-26 11:23:17 net_iface_mtu_set: mtu 1500 for tun0
                        2025-10-26 11:23:17 net_iface_up: set tun0 up
                        2025-10-26 11:23:17 net_addr_v6_add: <ip6> dev tun0
                        2025-10-26 11:23:17 Initialization Sequence Completed
                        

                        The network unreachable error is odd, but right now the main issue is that the nmcli+ntplan combo is royally screwing up the config itself when imported or when forced to add user+pass in the gui....

                        @gpatel-fr
                        I was aware from the getgo ubuntu does stupid things like NM+NP, not to mention their obsession with their failing app packaging format.....
                        Anyway as i said above i think it does something iffy with the config. The tls-crypt option missing inside the netplan yaml even though it was there before import i think is a pretty good indicator of that.

                        LuksusL 1 Reply Last reply Reply Quote 0
                        • LuksusL Offline
                          Luksus @jagdtigger
                          last edited by

                          @jagdtigger do you have VoLTE enabled? For me, it somehow affects VPN connections and I need to disable it for VPN to work.

                          Devices: BQ e4.5, Fairphone 2, Fairphone 3, Lenovo X605F, Pinephone, Moto Z2 Force, OnePlus5T

                          Vlad NirkyV 1 Reply Last reply Reply Quote 0
                          • Vlad NirkyV Online
                            Vlad Nirky @Luksus
                            last edited by Vlad Nirky

                            @Luksus
                            voLTE is always enabled for me (Xiaomi Redi Note 9 Pro 24.04 Stable (at the moment))
                            No effect on VPN connections

                            LuksusL 1 Reply Last reply Reply Quote 0
                            • LuksusL Offline
                              Luksus @Vlad Nirky
                              last edited by

                              @Vlad-Nirky thanks for the info, then it may be my mobile provider which causes the issue.

                              Devices: BQ e4.5, Fairphone 2, Fairphone 3, Lenovo X605F, Pinephone, Moto Z2 Force, OnePlus5T

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post