vlaci / openconnect-sso

Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs
GNU General Public License v3.0
294 stars 127 forks source link

Ctrl + C fails to cleanly kill program. Result is an exception within an exception: "PermissionError: [Errno 1] Operation not permitted" #115

Open ElectricRCAircraftGuy opened 1 year ago

ElectricRCAircraftGuy commented 1 year ago

Tested in Ubuntu 18.04 by following my own instructions here: How to use "openconnect" (via the openconnect-sso wrapper) with SAML and Duo two-factor authentication via Okta Single-Sign-on (SSO)

After successfully connecting via openconnect-sso, the last line I see is this:

Established DTLS connection (using GnuTLS). Ciphersuite (DTLS0.9)-(DHE-RSA-4294967237)-(AES-256-CBC)-(SHA1).

I then press Ctrl + C to cleanly kill and exit the program, but "During handling of the above exception, another exception occurred", resulting in a PermissionError: [Errno 1] Operation not permitted.

Here is the total output starting just before I pressed Ctrl + C:

Established DTLS connection (using GnuTLS). Ciphersuite (DTLS0.9)-(DHE-RSA-4294967237)-(AES-256-CBC)-(SHA1).
^CSend BYE packet: Aborted by caller
User canceled (SIGINT); exiting;
Traceback (most recent call last):
  File "/usr/lib/python3.6/subprocess.py", line 425, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.6/subprocess.py", line 855, in communicate
    self.wait()
  File "/usr/lib/python3.6/subprocess.py", line 1477, in wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.6/subprocess.py", line 1424, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gabriel/.local/bin/openconnect-sso", line 8, in <module>
    sys.exit(main())
  File "/home/gabriel/.local/lib/python3.6/site-packages/openconnect_sso/cli.py", line 169, in main
    return app.run(args)
  File "/home/gabriel/.local/lib/python3.6/site-packages/openconnect_sso/app.py", line 75, in run
    auth_response, selected_profile, args.proxy, args.openconnect_args
  File "/home/gabriel/.local/lib/python3.6/site-packages/openconnect_sso/app.py", line 188, in run_openconnect
    return subprocess.run(command_line).returncode
  File "/usr/lib/python3.6/subprocess.py", line 432, in run
    process.kill()
  File "/usr/lib/python3.6/subprocess.py", line 1610, in kill
    self.send_signal(signal.SIGKILL)
  File "/usr/lib/python3.6/subprocess.py", line 1600, in send_signal
    os.kill(self.pid, sig)
PermissionError: [Errno 1] Operation not permitted