mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
openvpn-authenticator: Avoid infinite loop when losing socket connection
This patch will gracefully terminate the daemon when it loses its connection to the OpenVPN daemon. Fixes: #12963 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
This commit is contained in:
committed by
Peter Müller
parent
9e7d4102b8
commit
92a9ce54bc
@@ -116,11 +116,16 @@ class OpenVPNAuthenticator(object):
|
|||||||
|
|
||||||
log.info("OpenVPN Authenticator started")
|
log.info("OpenVPN Authenticator started")
|
||||||
|
|
||||||
while True:
|
try:
|
||||||
line = self._read_line()
|
while True:
|
||||||
|
line = self._read_line()
|
||||||
|
|
||||||
if line.startswith(">CLIENT"):
|
if line.startswith(">CLIENT"):
|
||||||
self._client_event(line)
|
self._client_event(line)
|
||||||
|
|
||||||
|
# Terminate the daemon when it loses its connection to the OpenVPN daemon
|
||||||
|
except ConnectionResetError as e:
|
||||||
|
log.error("Connection to OpenVPN has been lost: %s" % e)
|
||||||
|
|
||||||
log.info("OpenVPN Authenticator terminated")
|
log.info("OpenVPN Authenticator terminated")
|
||||||
|
|
||||||
@@ -269,7 +274,7 @@ class OpenVPNAuthenticator(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _b64decode(s):
|
def _b64decode(s):
|
||||||
return base64.b64decode(s.encode()).decode()
|
return base64.b64decode(s.encode()).decode()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _escape(s):
|
def _escape(s):
|
||||||
return s.replace(" ", "\ ")
|
return s.replace(" ", "\ ")
|
||||||
|
|||||||
Reference in New Issue
Block a user