MapGuy11 / homeassistant-openvpn-client-addon

A Home Assistant OpenVPN client for anything you want to use it for!
MIT License
0 stars 2 forks source link

Trying to connect to your OpenVPN server using, /config/client.ovpn: No such file or directory #1

Open Izakun opened 3 weeks ago

Izakun commented 3 weeks ago

Hi,

Ill try to connect my HAOS to an OpenVPN server. I put my .ovpn in the config directory but when i start the addon i get this error :

Setting up the VPN connection with the following OpenVPN configuration: /config/client.ovpn

/run.sh: line 95: echoTrying to connect to your OpenVPN server using, /config/client.ovpn: No such file or directory

2024-08-24 15:32:22 DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305). OpenVPN ignores --cipher for cipher negotiations. 
2024-08-24 15:32:22 OpenVPN 2.6.11 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
2024-08-24 15:32:22 library versions: OpenSSL 3.3.1 4 Jun 2024, LZO 2.10
2024-08-24 15:32:22 neither stdin nor stderr are a tty device and you have neither a controlling tty nor systemd - can't ask for 'Enter Auth Username:'.  If you used --daemon, you need to use --askpass to make passphrase-protected keys work, and you can not use --auth-nocache.
2024-08-24 15:32:22 Exiting due to fatal error
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Have you any idea to fix that ? My file name is client.ovpn.

image

Thank's for help

MapGuy11 commented 3 weeks ago

Okay here is the actual issue: 2024-08-24 15:32:22 neither stdin nor stderr are a tty device and you have neither a controlling tty nor systemd - can't ask for 'Enter Auth Username:'. If you used --daemon, you need to use --askpass to make passphrase-protected keys work, and you can not use --auth-nocache.

You can lookup how to hardcode passwords onto a .ovpn file. I have while very insecure hard coded into the .ovpn file.

The file not found part is some kind of error in my code (I see the same thing on my end)

MapGuy11 commented 3 weeks ago
image
Izakun commented 3 weeks ago

I create a PR for add this feature : https://github.com/MapGuy11/homeassistant-openvpn-client-addon/pull/2

Izakun commented 3 weeks ago

But I still have an error, my vpn disconnects and reconnects every 2 min without errors image My .ovpn look's like this ;

client
remote 123.456.789.123 12345
proto udp
nobind
dev-type tap

pull
dev tap0
ping 10
ping-restart 120
auth-user-pass
auth-retry interact
mssfix 1452
explicit-exit-notify 3
cipher AES-128-CBC
remote-cert-tls server
verify-x509-name "C=FR, O=Freebox SA, CN=Freebox OpenVPN server XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# use tls-remote instead of verify-x509-name for deprecated openssl
# tls-remote "/C=FR/O=Freebox_SA/CN=Freebox_OpenVPN_server_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
...

And on my VPN server supervisor I see 2 or 3 connection for the same profil : image

Have you an idea ?

MapGuy11 commented 3 weeks ago

Hmm

MapGuy11 commented 3 weeks ago

This is what my config looks like I use OpnSense as my VPN host. But previously used just Ubuntu without any issues.

dev tun
persist-tun
persist-key
auth SHA1
client
resolv-retry infinite
remote .connorhackenberg.tech 51863 udp
lport 0
verify-x509-name "C=US, ST=, L=, O=Connor Hackenberg IT Solutions, emailAddress=, CN=opnvpntest" subject
remote-cert-tls server
compress stub
route-nopull
route 192.168.1.74 255.255.255.255
route 192.168.1.180 255.255.255.255
<ca>
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----

</ca>
<cert>
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----

-----END PRIVATE KEY-----
</key>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----

-----END OpenVPN Static key V1-----
</tls-auth>
key-direction 1