A
A
arseniylebedev2018-12-03 13:32:25
openvpn
arseniylebedev, 2018-12-03 13:32:25

Why doesn't connect to openvpn server when connect/disconnect scripts are enabled?

Here is the openvpn server configuration:

server.conf
auth-user-pass-verify /etc/openvpn/verify.py via-file
client-connect /etc/openvpn/connect.py
client-disconnect /etc/openvpn/disconnect.py

script-security 2

port 1194
proto udp
dev tun
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 1.0.0.1"
push "dhcp-option DNS 1.1.1.1"
push "redirect-gateway def1 bypass-dhcp" 
dh none
ecdh-curve prime256v1
tls-crypt tls-crypt.key 0
crl-verify crl.pem
ca ca.crt
cert server_9z8PW46XfvUdFxZR.crt
key server_9z8PW46XfvUdFxZR.key 
auth SHA256
cipher AES-128-GCM
ncp-ciphers AES-128-GCM
tls-server
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
status /var/log/openvpn/status.log
verb 3


If you comment out ;client-connect and ;client-disconnect, then it connects to the vpn.
connect.py code
connect.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import json

f = open('/etc/openvpn/connect.log', 'w')
f.write(json.dumps(sys.argv))
f.close()

sys.exit(0)


disconnect.py code
disconnect.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import json

f = open('/etc/openvpn/disconnect.log', 'w')
f.write(json.dumps(sys.argv))
f.close()

sys.exit(0)


The login/password check script works fine without script-security 2.
What could be the reason? at connect.py/disconnect.py chmod +rwx. On verify.py chmod +x

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
arseniylebedev, 2018-12-03
@arseniylebedev

The script did not have write permissions. Looked at the error in /var/log/syslog

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question