From 827cefbcbfa22b42c8f144a41d6a2d3825268755 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 1 May 2022 18:40:57 +0200 Subject: conserver: T4353: fix Jinja2 linting errors --- data/templates/conserver/conserver.conf.j2 | 37 +++++++++++++++++++++++++ data/templates/conserver/conserver.conf.tmpl | 37 ------------------------- data/templates/conserver/dropbear@.service.j2 | 4 +++ data/templates/conserver/dropbear@.service.tmpl | 4 --- src/conf_mode/service_console-server.py | 4 +-- 5 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 data/templates/conserver/conserver.conf.j2 delete mode 100644 data/templates/conserver/conserver.conf.tmpl create mode 100644 data/templates/conserver/dropbear@.service.j2 delete mode 100644 data/templates/conserver/dropbear@.service.tmpl diff --git a/data/templates/conserver/conserver.conf.j2 b/data/templates/conserver/conserver.conf.j2 new file mode 100644 index 000000000..1823657d7 --- /dev/null +++ b/data/templates/conserver/conserver.conf.j2 @@ -0,0 +1,37 @@ +### Autogenerated by service_console-server.py ### + +# See https://www.conserver.com/docs/conserver.cf.man.html for additional options + +config * { + primaryport 3109; + daemonmode false; +} + +default * { + motd "VyOS Console Server"; + rw *; +} + +## +## list of consoles we serve +## +{% for key, value in device.items() %} +{# Depending on our USB serial console we could require a path adjustment #} +{% set path = '/dev' if key.startswith('ttyS') else '/dev/serial/by-bus' %} +console {{ key }} { + master localhost; + type device; + device {{ path }}/{{ key }}; + baud {{ value.speed }}; + parity {{ value.parity }}; + options {{ "!" if value.stop_bits == "1" }}cstopb; +} +{% endfor %} + +## +## list of clients we allow +## +access * { + trusted localhost; + allowed localhost; +} diff --git a/data/templates/conserver/conserver.conf.tmpl b/data/templates/conserver/conserver.conf.tmpl deleted file mode 100644 index 4e7b5d8d7..000000000 --- a/data/templates/conserver/conserver.conf.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -### Autogenerated by service_console-server.py ### - -# See https://www.conserver.com/docs/conserver.cf.man.html for additional options - -config * { - primaryport 3109; - daemonmode false; -} - -default * { - motd "VyOS Console Server"; - rw *; -} - -## -## list of consoles we serve -## -{% for key, value in device.items() %} -{# Depending on our USB serial console we could require a path adjustment #} -{% set path = '/dev' if key.startswith('ttyS') else '/dev/serial/by-bus' %} -console {{ key }} { - master localhost; - type device; - device {{ path }}/{{ key }}; - baud {{ value.speed }}; - parity {{ value.parity }}; - options {{ "!" if value.stop_bits == "1" }}cstopb; -} -{% endfor %} - -## -## list of clients we allow -## -access * { - trusted localhost; - allowed localhost; -} diff --git a/data/templates/conserver/dropbear@.service.j2 b/data/templates/conserver/dropbear@.service.j2 new file mode 100644 index 000000000..e355dab43 --- /dev/null +++ b/data/templates/conserver/dropbear@.service.j2 @@ -0,0 +1,4 @@ +[Service] +ExecStart= +ExecStart=/usr/sbin/dropbear -w -j -k -r /etc/dropbear/dropbear_rsa_host_key -b /etc/issue.net -c "/usr/bin/console {{ device }}" -P /run/conserver/dropbear.%I.pid -p %I +PIDFile=/run/conserver/dropbear.%I.pid diff --git a/data/templates/conserver/dropbear@.service.tmpl b/data/templates/conserver/dropbear@.service.tmpl deleted file mode 100644 index e355dab43..000000000 --- a/data/templates/conserver/dropbear@.service.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -[Service] -ExecStart= -ExecStart=/usr/sbin/dropbear -w -j -k -r /etc/dropbear/dropbear_rsa_host_key -b /etc/issue.net -c "/usr/bin/console {{ device }}" -P /run/conserver/dropbear.%I.pid -p %I -PIDFile=/run/conserver/dropbear.%I.pid diff --git a/src/conf_mode/service_console-server.py b/src/conf_mode/service_console-server.py index 51050e702..a2e411e49 100755 --- a/src/conf_mode/service_console-server.py +++ b/src/conf_mode/service_console-server.py @@ -81,7 +81,7 @@ def generate(proxy): if not proxy: return None - render(config_file, 'conserver/conserver.conf.tmpl', proxy) + render(config_file, 'conserver/conserver.conf.j2', proxy) if 'device' in proxy: for device, device_config in proxy['device'].items(): if 'ssh' not in device_config: @@ -92,7 +92,7 @@ def generate(proxy): 'port' : device_config['ssh']['port'], } render(dropbear_systemd_file.format(**tmp), - 'conserver/dropbear@.service.tmpl', tmp) + 'conserver/dropbear@.service.j2', tmp) return None -- cgit v1.2.3