Page MenuHomeVyOS Platform

"show openconnect-server sessions" command does not work in the openconnect module
In progress, Requires assessmentPublicBUG

Description

"show openconnect-server sessions" command does not work in the openconnect module

[email protected]:~$ show openconnect-server sessions
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/openconnect-control.py", line 74, in <module>
    main()
  File "/usr/libexec/vyos/op_mode/openconnect-control.py", line 63, in main
    if commit_in_progress():
  File "/usr/lib/python3/dist-packages/vyos/util.py", line 626, in commit_in_progress
    raise OSError('This functions needs to be run as root to return correct results!')
OSError: This functions needs to be run as root to return correct results!

Details

Difficulty level
Easy (less than an hour)
Version
vyos-1.4-rolling-202208010217
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav changed the task status from Open to In progress.Sat, Aug 6, 9:48 AM
Viacheslav claimed this task.

PR https://github.com/vyos/vyos-1x/pull/1462

[email protected]:~$ show openconnect-server sessions 
Interface    Username    IP            Remote IP        RX         TX         State      Uptime
-----------  ----------  ------------  ---------------  ---------  ---------  ---------  --------
sslvpn0      foo         100.64.0.225  192.168.122.220  384 bytes  152 bytes  connected  13m:18s
[email protected]:~$

Raw format:

[email protected]:~$ /usr/libexec/vyos/op_mode/openconnect.py show_sessions --raw
[
    {
        "ID": 5303,
        "Username": "foo",
        "Groupname": "(none)",
        "State": "connected",
        "vhost": "default",
        "Device": "sslvpn0",
        "MTU": "1434",
        "Remote IP": "192.168.122.220",
        "Location": "unknown",
        "Local Device IP": "192.168.122.14",
        "IPv4": "100.64.0.225",
        "P-t-P IPv4": "100.64.0.1",
        "User-Agent": "OpenConnect VPN Agent (NetworkManager) v8.20-1",
        "RX": "384",
        "TX": "152",
        "_RX": "384 bytes",
        "_TX": "152 bytes",
        "Average RX": "0 bytes/sec",
        "Average TX": "0 bytes/sec",
        "DPD": "60",
        "KeepAlive": "300",
        "Hostname": "ubnt",
        "Connected at": "2022-08-06 12:52",
        "_Connected at": "13m:43s",
        "Full session": "3wd4NYDOA1OaxmDdCCJNf1RdaVE=",
        "Session": "3wd4NY",
        "TLS ciphersuite": "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-256-GCM)",
        "DTLS cipher": "(DTLS1.2)-(PSK)-(AES-256-GCM)",
        "DNS": [],
        "NBNS": [],
        "Split-DNS-Domains": [],
        "Routes": "defaultroute",
        "No-routes": [],
        "iRoutes": [],
        "Restricted to routes": "False",
        "Restricted to ports": []
    }
]
[email protected]:~$

Delete VPN:

[email protected]# delete vpn 
[edit]
[email protected]# commit
[edit]
[email protected]# /usr/libexec/vyos/op_mode/openconnect.py show_sessions
Openconnect is not configured
[edit]
[email protected]# /usr/libexec/vyos/op_mode/openconnect.py show_sessions --raw
{
    "openconnect": {
        "configured": false,
        "return_code": 1,
        "reason": "error connecting to ocserv socket '/run/ocserv/occtl.socket': No such file or directory"
    }
}
[edit]
[email protected]#