protocol
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,23 @@
|
|||||||
|
openconnect --protocol=anyconnect --user ex08802409 --script 'vpn-slice gitops.apps.ocp-dev01.wgn.wuerth.com console-openshift-console.apps.ocp-dev01.wgn.wuerth.com oauth-openshift.apps.ocp-dev01.wgn.wuerth.com apm-dev.wgn.wuerth.com odatang9.wgn.wuerth.com fs.wgn.wuerth.com fahrzeugeinrichtung.apps.ocp-dev01.wgn.wuerth.com api.ocp-dev01.wgn.wuerth.com console-openshift-console.apps.ocp-01.wgn.wuerth.com gitops.apps.ocp-01.wgn.wuerth.com oauth-openshift.apps.ocp-01.wgn.wuerth.com api.ocp-01.wgn.wuerth.com proxy.wgs.wuerth.com odatang8.wgn.wuerth.com fahrzeugeinrichtung.apps.ocp-01.wgn.wuerth.com' https://loki.witglobal.net
|
||||||
|
|
||||||
|
[sudo] password for marcuh: POST https://loki.witglobal.net/
|
||||||
|
Connected to 185.101.5.240:443
|
||||||
|
SSL negotiation with loki.witglobal.net
|
||||||
|
Connected to HTTPS on loki.witglobal.net with ciphersuite (TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)
|
||||||
|
Got HTTP response: HTTP/1.1 404 Not Found
|
||||||
|
Unexpected 404 result from server
|
||||||
|
GET https://loki.witglobal.net/
|
||||||
|
Connected to 185.101.5.240:443
|
||||||
|
SSL negotiation with loki.witglobal.net
|
||||||
|
Connected to HTTPS on loki.witglobal.net with ciphersuite (TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)
|
||||||
|
Got HTTP response: HTTP/1.0 302 Object Moved
|
||||||
|
GET https://loki.witglobal.net/+webvpn+/index.html
|
||||||
|
SSL negotiation with loki.witglobal.net
|
||||||
|
Connected to HTTPS on loki.witglobal.net with ciphersuite (TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)
|
||||||
|
Please enter your username and password.
|
||||||
|
POST https://loki.witglobal.net/+webvpn+/index.html
|
||||||
|
Login failed.
|
||||||
|
Please enter your username and password.
|
||||||
|
Password:
|
||||||
|
fgets (stdin): Inappropriate ioctl for device
|
||||||
|
|
||||||
+27
-21
@@ -132,27 +132,31 @@ class VpnWorker(QObject):
|
|||||||
if not server.startswith("https://"):
|
if not server.startswith("https://"):
|
||||||
server = "https://" + server
|
server = "https://" + server
|
||||||
|
|
||||||
cmd_str = (
|
cmd = [
|
||||||
f"printf '%s\\n%s\\n' '{self.sudo_pw}' '{self.vpn_pw}'"
|
"sudo", "-kS", "openconnect",
|
||||||
f" | sudo -kS openconnect"
|
"--protocol=anyconnect",
|
||||||
f" --protocol=anyconnect"
|
"--user", self.user,
|
||||||
f" --user {self.user}"
|
"--passwd-on-stdin",
|
||||||
f" --passwd-on-stdin"
|
"--pid-file", PIDFILE,
|
||||||
f" --pid-file {PIDFILE}"
|
"--force-dpd", "0",
|
||||||
f" --force-dpd 0"
|
"--script", vpn_slice_arg,
|
||||||
f" --script '{vpn_slice_arg}'"
|
server,
|
||||||
f" {server}"
|
]
|
||||||
)
|
|
||||||
|
|
||||||
self.log(f"$ openconnect --protocol=anyconnect --user {self.user} --script '{vpn_slice_arg}' {server}\n\n")
|
self.log(f"$ openconnect --protocol=anyconnect --user {self.user} --script '{vpn_slice_arg}' {server}\n\n")
|
||||||
|
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
cmd_str,
|
cmd,
|
||||||
shell=True,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
bufsize=0,
|
bufsize=0,
|
||||||
)
|
)
|
||||||
|
# wie die funktionierende printf-Pipe: sudo liest Zeile 1, openconnect
|
||||||
|
# Zeile 2 (--passwd-on-stdin); stdin schließen, damit openconnect EOF sieht
|
||||||
|
p.stdin.write(f"{self.sudo_pw}\n{self.vpn_pw}\n".encode())
|
||||||
|
p.stdin.flush()
|
||||||
|
p.stdin.close()
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
results_seen = 0
|
results_seen = 0
|
||||||
@@ -187,10 +191,12 @@ class VpnWorker(QObject):
|
|||||||
self.done.emit(False, "")
|
self.done.emit(False, "")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
sudo_in = (self.sudo_pw + "\n").encode()
|
||||||
|
|
||||||
self.log(f"Sending SIGINT to pid {pid}...\n")
|
self.log(f"Sending SIGINT to pid {pid}...\n")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f"echo '{self.sudo_pw}' | sudo -S kill -INT {pid}",
|
["sudo", "-S", "kill", "-INT", str(pid)],
|
||||||
shell=True,
|
input=sudo_in,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -198,8 +204,8 @@ class VpnWorker(QObject):
|
|||||||
while time.time() - start < 12:
|
while time.time() - start < 12:
|
||||||
if not _pid_is_openconnect(pid):
|
if not _pid_is_openconnect(pid):
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f"echo '{self.sudo_pw}' | sudo -S rm -f {PIDFILE}",
|
["sudo", "-S", "rm", "-f", PIDFILE],
|
||||||
shell=True,
|
input=sudo_in,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
self.log("Disconnected.\n")
|
self.log("Disconnected.\n")
|
||||||
@@ -210,15 +216,15 @@ class VpnWorker(QObject):
|
|||||||
if 3.0 < elapsed < 3.5:
|
if 3.0 < elapsed < 3.5:
|
||||||
self.log("Escalating: SIGTERM\n")
|
self.log("Escalating: SIGTERM\n")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f"echo '{self.sudo_pw}' | sudo -S kill -TERM {pid}",
|
["sudo", "-S", "kill", "-TERM", str(pid)],
|
||||||
shell=True,
|
input=sudo_in,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
if 8.0 < elapsed < 8.5:
|
if 8.0 < elapsed < 8.5:
|
||||||
self.log("Escalating: SIGKILL\n")
|
self.log("Escalating: SIGKILL\n")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f"echo '{self.sudo_pw}' | sudo -S kill -KILL {pid}",
|
["sudo", "-S", "kill", "-KILL", str(pid)],
|
||||||
shell=True,
|
input=sudo_in,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|||||||
Reference in New Issue
Block a user