Commit a6e9c6d2 authored by Rémi Duraffort's avatar Rémi Duraffort

lava-slave: add an option to use a socks proxy

This will allow the zmq connection to cross some firewalls.
Signed-off-by: Rémi Duraffort's avatarRémi Duraffort <remi.duraffort@linaro.org>
parent 7a18fc02
Pipeline #3974 passed with stages
in 9 minutes and 15 seconds
......@@ -7,6 +7,9 @@
# Enable IPv6 to connect to the master and logger
# IPV6="--ipv6"
# Use a socks proxy
# SOCKS_PROXY="--socks-proxy localhost:8081"
# Slave hostname
# Should be set for host that have random hostname (containers, ...)
# The hostname can be any unique string, except "lava-logs" which is reserved
......
......@@ -7,7 +7,7 @@ Type=simple
Environment=MASTER_URL=tcp://localhost:5556 LOGGER_URL=tcp://localhost:5555 LOGLEVEL=DEBUG
EnvironmentFile=-/etc/default/lava-slave
EnvironmentFile=-/etc/lava-dispatcher/lava-slave
ExecStart=/usr/bin/lava-slave --level $LOGLEVEL --master $MASTER_URL --socket-addr $LOGGER_URL $IPV6 $ENCRYPT $MASTER_CERT $SLAVE_CERT $HOSTNAME
ExecStart=/usr/bin/lava-slave --level $LOGLEVEL --master $MASTER_URL --socket-addr $LOGGER_URL $IPV6 $SOCKS_PROXY $ENCRYPT $MASTER_CERT $SLAVE_CERT $HOSTNAME
TimeoutStopSec=20
Restart=always
KillMode=process
......
......@@ -405,6 +405,10 @@ def create_context(options):
# "Immediately readies that connection for data transfer with the master"
sock.setsockopt(zmq.CONNECT_RID, b"master")
if options.socks_proxy:
LOG.info("[INIT] Using a socks proxy")
sock.setsockopt(zmq.SOCKS_PROXY, b(options.socks_proxy))
if options.ipv6:
LOG.info("[INIT] Enabling IPv6")
sock.setsockopt(zmq.IPV6, 1)
......@@ -841,6 +845,8 @@ def setup_parser():
help="Main master socket")
net.add_argument("--socket-addr", type=str, required=True,
help="Log socket")
net.add_argument("--socks-proxy", type=str, default=None,
help="Connect using a socks proxy")
net.add_argument("--ipv6", default=False,
action="store_true",
help="Enable IPv6")
......
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