move sdnotify after setting up firewall rules

This commit is contained in:
Becz Tamás 2017-12-15 15:14:16 +01:00 committed by Brian May
parent be90cc8abd
commit 6b48301b86
2 changed files with 3 additions and 4 deletions

View File

@ -8,7 +8,6 @@ import os
import sshuttle.ssnet as ssnet import sshuttle.ssnet as ssnet
import sshuttle.ssh as ssh import sshuttle.ssh as ssh
import sshuttle.ssyslog as ssyslog import sshuttle.ssyslog as ssyslog
import sshuttle.sdnotify as sdnotify
import sys import sys
import platform import platform
from sshuttle.ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper from sshuttle.ssnet import SockWrapper, Handler, Proxy, Mux, MuxWrapper
@ -533,9 +532,6 @@ def _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,
debug1('seed_hosts: %r\n' % seed_hosts) debug1('seed_hosts: %r\n' % seed_hosts)
mux.send(0, ssnet.CMD_HOST_REQ, str.encode('\n'.join(seed_hosts))) mux.send(0, ssnet.CMD_HOST_REQ, str.encode('\n'.join(seed_hosts)))
sdnotify.send(sdnotify.ready(),
sdnotify.status('Connected to %s.' % remotename))
while 1: while 1:
rv = serverproc.poll() rv = serverproc.poll()
if rv: if rv:

View File

@ -7,6 +7,7 @@ import sys
import os import os
import platform import platform
import traceback import traceback
import sshuttle.sdnotify as sdnotify
from sshuttle.helpers import debug1, debug2, Fatal from sshuttle.helpers import debug1, debug2, Fatal
from sshuttle.methods import get_auto_method, get_method from sshuttle.methods import get_auto_method, get_method
@ -219,6 +220,8 @@ def main(method_name, syslog):
user) user)
stdout.write('STARTED\n') stdout.write('STARTED\n')
sdnotify.send(sdnotify.ready(),
sdnotify.status('Connected'))
try: try:
stdout.flush() stdout.flush()