Commit a68ced7c authored by Michal Horejsek's avatar Michal Horejsek

No root needed

parent 6246b6d7
......@@ -39,9 +39,9 @@ lint:
python3 -m pylint --rcfile=pylintrc haas_proxy haas_proxy/twisted/plugins/haas_proxy_plugin.py
run-py2:
sudo python2 ${TWISTD_CMD} ${TWISTD_RUN_ARGS}
python2 ${TWISTD_CMD} ${TWISTD_RUN_ARGS}
run-py3:
sudo python3 ${TWISTD_CMD} ${TWISTD_RUN_ARGS}
python3 ${TWISTD_CMD} ${TWISTD_RUN_ARGS}
release: build
rm -rf release
......
......@@ -17,13 +17,12 @@ Store it in some path and then pass it as arguments:
Example usage:
$ sudo python -m haas_proxy [TWISTED OPTIONS] haas_proxy [HAAS OPTIONS]
$ sudo python -m haas_proxy -l /tmp/haas.log --pidfile /tmp/haas.pid haas_proxy --device-token XXX
$ python -m haas_proxy [TWISTED OPTIONS] haas_proxy [HAAS OPTIONS]
$ python -m haas_proxy -l /tmp/haas.log --pidfile /tmp/haas.pid haas_proxy --device-token XXX
Note that there is not used script `twistd` but `python -m haas_proxy`. It's
because you would need to pass PYTHONPATH by hand which is not comfortable.
The rest of arguments works the same way. Also note that running of proxy
needs root privileges.
The rest of arguments works the same way.
"""
from haas_proxy import constants
......
......@@ -4,8 +4,6 @@ Implementation of SSH proxy using Twisted.
import fcntl
import json
import os
import pwd
import struct
import tty
......@@ -114,7 +112,6 @@ class ProxySSHSession(SSHSessionForUnixConchUser):
"""
Custom implementation of shell - proxy to real SSH to honeypot.
"""
user = pwd.getpwuid(os.getuid())
# pylint: disable=no-member
self.pty = reactor.spawnProcess(
proto,
......@@ -122,8 +119,8 @@ class ProxySSHSession(SSHSessionForUnixConchUser):
args=self.honeypot_ssh_arguments,
env=self.environ,
path='/',
uid=user.pw_uid,
gid=user.pw_gid,
uid=None,
gid=None,
usePTY=self.ptyTuple,
)
fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ, struct.pack('4H', *self.winSize))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment