Skip to content
Snippets Groups Projects
Unverified Commit 4c5fbd10 authored by meskio's avatar meskio :tent:
Browse files

[feat] bitmask-root: search for the system commands in the common paths

Find the right path of the system commands looking into /sbin, /usr/sbin
and /usr/local/sbin

- Resolves: #254
parent fc304c91
No related branches found
No related tags found
No related merge requests found
......@@ -100,10 +100,23 @@ LOCAL_INTERFACE = "lo"
IMAP_PORT = "1984"
SMTP_PORT = "2013"
IP = "/sbin/ip"
IPTABLES = "/sbin/iptables"
IP6TABLES = "/sbin/ip6tables"
SYSCTL = "/sbin/sysctl"
def swhich(binary):
"""
Find the path to binary in sbin
:rtype: str
"""
for folder in ["/sbin", "/usr/sbin", "/usr/local/sbin"]:
path = os.path.join(folder, binary)
if os.path.isfile(path):
return path
raise Exception("Can't find %s" % (binary,))
IP = swhich("ip")
IPTABLES = swhich("iptables")
IP6TABLES = swhich("ip6tables")
SYSCTL = swhich("sysctl")
OPENVPN_USER = "nobody"
OPENVPN_GROUP = get_no_group_name()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment