Skip to content

Commit

Permalink
ns-api: ovpntunnel multiple fixes
Browse files Browse the repository at this point in the history
Changes:
- list: display remote network also for subnet clients
- import: fix cipher and auth
  • Loading branch information
gsanchietti committed Nov 8, 2023
1 parent e2e666e commit 8bf9386
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/ns-api/files/ns.ovpntunnel
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def import_client(tunnel):
u.set("openvpn", iname, "enabled", 1)
u.set("openvpn", iname, "nobind", "1")
u.set("openvpn", iname, "dev", tun)
u.set("openvpn", iname, "ns_client", "1")

if tunnel['Topology'] == 'p2p':
psk = f"{cert_dir}psk.key"
Expand Down Expand Up @@ -181,10 +182,10 @@ def import_client(tunnel):
u.set("openvpn", iname, "compress", tunnel['Compression'])

if tunnel.get('Digest',''):
u.set("openvpn", iname, "digest", tunnel['Digest'])
u.set("openvpn", iname, "auth", tunnel['Digest'])

if tunnel.get('Cipher',''):
u.set("openvpn", iname, "digest", tunnel['Cipher'])
u.set("openvpn", iname, "cipher", tunnel['Cipher'])

if tunnel.get('TlsVersionMin', ''):
u.set("openvpn", iname, "tls_version_min", tunnel['TlsVersionMin'])
Expand Down Expand Up @@ -372,9 +373,11 @@ def list_tunnels():
remote = []
if vpn.get("ifconfig", "") != "":
record["topology"] = "p2p"
if record["topology"] == "p2p":
try:
for r in u.get_all("openvpn", section, "route"):
remote.append(opt2cidr(r))
remote.append(opt2cidr(r))
except:
pass
client = record | {
"port": vpn.get("port", ""),
"remote_host": vpn.get("remote", ""),
Expand Down

0 comments on commit 8bf9386

Please sign in to comment.