From 5f4335042cf40bf4bf18294706cce0b3a2fd5907 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Fri, 29 May 2020 06:37:00 +0100 Subject: airbag: T2088: explicit enabling of the feature airbag must now be explicitly installed. the patch also allow to fully disables the installation of the logging code at setup (and not just installing and doing nothing) --- python/vyos/airbag.py | 36 ++++++++--------------------- src/conf_mode/arp.py | 3 +++ src/conf_mode/bcast_relay.py | 3 +++ src/conf_mode/dhcp_relay.py | 3 +++ src/conf_mode/dhcp_server.py | 3 +++ src/conf_mode/dhcpv6_relay.py | 3 +++ src/conf_mode/dhcpv6_server.py | 3 +++ src/conf_mode/dns_forwarding.py | 3 +++ src/conf_mode/dynamic_dns.py | 3 +++ src/conf_mode/firewall_options.py | 2 ++ src/conf_mode/flow_accounting_conf.py | 3 +++ src/conf_mode/host_name.py | 3 +++ src/conf_mode/http-api.py | 3 +++ src/conf_mode/https.py | 2 ++ src/conf_mode/igmp_proxy.py | 2 ++ src/conf_mode/intel_qat.py | 3 +++ src/conf_mode/interfaces-bonding.py | 3 +++ src/conf_mode/interfaces-bridge.py | 3 +++ src/conf_mode/interfaces-dummy.py | 3 +++ src/conf_mode/interfaces-ethernet.py | 3 +++ src/conf_mode/interfaces-geneve.py | 3 +++ src/conf_mode/interfaces-l2tpv3.py | 3 +++ src/conf_mode/interfaces-loopback.py | 3 +++ src/conf_mode/interfaces-macsec.py | 3 +++ src/conf_mode/interfaces-openvpn.py | 3 +++ src/conf_mode/interfaces-pppoe.py | 2 ++ src/conf_mode/interfaces-pseudo-ethernet.py | 3 +++ src/conf_mode/interfaces-tunnel.py | 3 +++ src/conf_mode/interfaces-vxlan.py | 3 +++ src/conf_mode/interfaces-wireguard.py | 3 +++ src/conf_mode/interfaces-wireless.py | 3 +++ src/conf_mode/interfaces-wirelessmodem.py | 3 +++ src/conf_mode/ipsec-settings.py | 2 ++ src/conf_mode/le_cert.py | 3 +++ src/conf_mode/lldp.py | 2 ++ src/conf_mode/mdns_repeater.py | 3 +++ src/conf_mode/nat.py | 3 +++ src/conf_mode/ntp.py | 3 +++ src/conf_mode/protocols_bfd.py | 2 ++ src/conf_mode/protocols_igmp.py | 2 ++ src/conf_mode/protocols_mpls.py | 2 ++ src/conf_mode/protocols_pim.py | 2 ++ src/conf_mode/protocols_static_multicast.py | 2 ++ src/conf_mode/salt-minion.py | 3 +++ src/conf_mode/service_ipoe-server.py | 3 +++ src/conf_mode/service_pppoe-server.py | 3 +++ src/conf_mode/service_router-advert.py | 2 ++ src/conf_mode/snmp.py | 2 ++ src/conf_mode/ssh.py | 2 ++ src/conf_mode/system-ip.py | 2 ++ src/conf_mode/system-ipv6.py | 2 ++ src/conf_mode/system-login-banner.py | 3 +++ src/conf_mode/system-login.py | 3 +++ src/conf_mode/system-options.py | 3 +++ src/conf_mode/system-proxy.py | 3 +++ src/conf_mode/system-syslog.py | 2 ++ src/conf_mode/system-timezone.py | 2 ++ src/conf_mode/system-wifi-regdom.py | 2 ++ src/conf_mode/task_scheduler.py | 2 ++ src/conf_mode/tftp_server.py | 2 ++ src/conf_mode/vpn_l2tp.py | 2 ++ src/conf_mode/vpn_pptp.py | 3 +++ src/conf_mode/vpn_sstp.py | 3 +++ src/conf_mode/vrf.py | 2 ++ src/conf_mode/vrrp.py | 2 ++ src/conf_mode/vyos_cert.py | 3 +++ 66 files changed, 181 insertions(+), 26 deletions(-) diff --git a/python/vyos/airbag.py b/python/vyos/airbag.py index b7838d8a2..510ab7f46 100644 --- a/python/vyos/airbag.py +++ b/python/vyos/airbag.py @@ -17,17 +17,20 @@ import sys from datetime import datetime from vyos import debug -from vyos.config import Config from vyos.logger import syslog from vyos.version import get_version from vyos.version import get_full_version_data -# we allow to disable the extra logging -DISABLE = False + +def enable(log=True): + if log: + _intercepting_logger() + _intercepting_exceptions() _noteworthy = [] + def noteworthy(msg): """ noteworthy can be use to take note things which we may not want to @@ -45,8 +48,6 @@ class _IO(object): def write(self, message): self.std.write(message) - if DISABLE: - return for line in message.split('\n'): s = line.rstrip() if s: @@ -90,14 +91,14 @@ def bug_report(dtype, value, trace): # define an exception handler to be run when an exception # reach the end of __main__ and was not intercepted -def intercepter(dtype, value, trace): +def _intercepter(dtype, value, trace): bug_report(dtype, value, trace) if debug.enabled('developer'): import pdb pdb.pm() -def InterceptingLogger(_singleton=[False]): +def _intercepting_logger(_singleton=[False]): skip = _singleton.pop() _singleton.append(True) if skip: @@ -110,7 +111,7 @@ def InterceptingLogger(_singleton=[False]): # lists as default arguments in function is normally dangerous # as they will keep any modification performed, unless this is # what you want to do (in that case to only run the code once) -def InterceptingException(excepthook,_singleton=[False]): +def _intercepting_exceptions(_singleton=[False]): skip = _singleton.pop() _singleton.append(True) if skip: @@ -118,24 +119,7 @@ def InterceptingException(excepthook,_singleton=[False]): # install the handler to replace the default behaviour # which just prints the exception trace on screen - sys.excepthook = excepthook - - -# Do not attempt the extra logging for operational commands -try: - # This fails during boot - insession = Config().in_session() -except: - # we save info on boot to help debugging - insession = True - - -# Installing the interception, it currently does not work when -# running testing so we are checking that we are on the router -# as otherwise it prevents dpkg-buildpackage to work -if get_version() and insession: - InterceptingLogger() - InterceptingException(intercepter) + sys.excepthook = _intercepter # Messages to print diff --git a/src/conf_mode/arp.py b/src/conf_mode/arp.py index fde7dc521..aac07bd80 100755 --- a/src/conf_mode/arp.py +++ b/src/conf_mode/arp.py @@ -25,6 +25,9 @@ from vyos.config import Config from vyos.util import call from vyos import ConfigError +from vyos import airbag +airbag.enable() + arp_cmd = '/usr/sbin/arp' def get_config(): diff --git a/src/conf_mode/bcast_relay.py b/src/conf_mode/bcast_relay.py index a3bc76ef8..5c7294296 100755 --- a/src/conf_mode/bcast_relay.py +++ b/src/conf_mode/bcast_relay.py @@ -25,6 +25,9 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() + config_file = r'/etc/default/udp-broadcast-relay' default_config_data = { diff --git a/src/conf_mode/dhcp_relay.py b/src/conf_mode/dhcp_relay.py index d24a46220..f093a005e 100755 --- a/src/conf_mode/dhcp_relay.py +++ b/src/conf_mode/dhcp_relay.py @@ -23,6 +23,9 @@ from vyos.template import render from vyos.util import call from vyos import ConfigError +from vyos import airbag +airbag.enable() + config_file = r'/run/dhcp-relay/dhcp.conf' default_config_data = { diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index 1849ece0a..0eaa14c5b 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -27,6 +27,9 @@ from vyos import ConfigError from vyos.template import render from vyos.util import call, chown +from vyos import airbag +airbag.enable() + config_file = r'/run/dhcp-server/dhcpd.conf' default_config_data = { diff --git a/src/conf_mode/dhcpv6_relay.py b/src/conf_mode/dhcpv6_relay.py index ecc739063..6ef290bf0 100755 --- a/src/conf_mode/dhcpv6_relay.py +++ b/src/conf_mode/dhcpv6_relay.py @@ -24,6 +24,9 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() + config_file = r'/run/dhcp-relay/dhcpv6.conf' default_config_data = { diff --git a/src/conf_mode/dhcpv6_server.py b/src/conf_mode/dhcpv6_server.py index 9e24ee591..53c8358a5 100755 --- a/src/conf_mode/dhcpv6_server.py +++ b/src/conf_mode/dhcpv6_server.py @@ -26,6 +26,9 @@ from vyos.util import call from vyos.validate import is_subnet_connected, is_ipv6 from vyos import ConfigError +from vyos import airbag +airbag.enable() + config_file = r'/run/dhcp-server/dhcpdv6.conf' default_config_data = { diff --git a/src/conf_mode/dns_forwarding.py b/src/conf_mode/dns_forwarding.py index f87c198f7..692ac2456 100755 --- a/src/conf_mode/dns_forwarding.py +++ b/src/conf_mode/dns_forwarding.py @@ -27,6 +27,9 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() + parser = argparse.ArgumentParser() parser.add_argument("--dhclient", action="store_true", help="Started from dhclient-script") diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py index 3386324ae..5b1883c03 100755 --- a/src/conf_mode/dynamic_dns.py +++ b/src/conf_mode/dynamic_dns.py @@ -25,6 +25,9 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() + config_file = r'/run/ddclient/ddclient.conf' # Mapping of service name to service protocol diff --git a/src/conf_mode/firewall_options.py b/src/conf_mode/firewall_options.py index 0b800f48f..71b2a98b3 100755 --- a/src/conf_mode/firewall_options.py +++ b/src/conf_mode/firewall_options.py @@ -23,6 +23,8 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import call +from vyos import airbag +airbag.enable() default_config_data = { 'intf_opts': [], diff --git a/src/conf_mode/flow_accounting_conf.py b/src/conf_mode/flow_accounting_conf.py index d691e6abd..a9ebab53e 100755 --- a/src/conf_mode/flow_accounting_conf.py +++ b/src/conf_mode/flow_accounting_conf.py @@ -29,6 +29,9 @@ from vyos import ConfigError from vyos.util import cmd from vyos.template import render +from vyos import airbag +airbag.enable() + # default values default_sflow_server_port = 6343 default_netflow_server_port = 2055 diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index f181a7b35..dbc587d7d 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -33,6 +33,9 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import cmd, call, run, process_named_running +from vyos import airbag +airbag.enable() + default_config_data = { 'hostname': 'vyos', 'domain_name': '', diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py index 3b8a67ef6..b8a084a40 100755 --- a/src/conf_mode/http-api.py +++ b/src/conf_mode/http-api.py @@ -27,6 +27,9 @@ from vyos import ConfigError from vyos.util import cmd from vyos.util import call +from vyos import airbag +airbag.enable() + config_file = '/etc/vyos/http-api.conf' vyos_conf_scripts_dir=vyos.defaults.directories['conf_mode'] diff --git a/src/conf_mode/https.py b/src/conf_mode/https.py index 718e8375c..7acb629bd 100755 --- a/src/conf_mode/https.py +++ b/src/conf_mode/https.py @@ -27,6 +27,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = '/etc/nginx/sites-available/default' diff --git a/src/conf_mode/igmp_proxy.py b/src/conf_mode/igmp_proxy.py index 9cd7163f0..49aea9b7f 100755 --- a/src/conf_mode/igmp_proxy.py +++ b/src/conf_mode/igmp_proxy.py @@ -25,6 +25,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/etc/igmpproxy.conf' diff --git a/src/conf_mode/intel_qat.py b/src/conf_mode/intel_qat.py index cc7d4a915..1ceab0a87 100755 --- a/src/conf_mode/intel_qat.py +++ b/src/conf_mode/intel_qat.py @@ -24,6 +24,9 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import popen, run +from vyos import airbag +airbag.enable() + # Define for recovering gl_ipsec_conf = None diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py index bdca9d170..d87e0cd0e 100755 --- a/src/conf_mode/interfaces-bonding.py +++ b/src/conf_mode/interfaces-bonding.py @@ -28,6 +28,9 @@ from vyos.util import call, cmd from vyos.validate import is_member, has_address_configured from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { **interface_default_data, 'arp_mon_intvl': 0, diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 3ff339f0f..af5372e21 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -28,6 +28,9 @@ from vyos.config import Config from vyos.util import cmd, get_bridge_member_config from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { **interface_default_data, 'aging': 300, diff --git a/src/conf_mode/interfaces-dummy.py b/src/conf_mode/interfaces-dummy.py index 4a77b0c1a..ec255edd5 100755 --- a/src/conf_mode/interfaces-dummy.py +++ b/src/conf_mode/interfaces-dummy.py @@ -26,6 +26,9 @@ from vyos.config import Config from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'address_remove': [], diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py index f45a77a3e..ef958e9f8 100755 --- a/src/conf_mode/interfaces-ethernet.py +++ b/src/conf_mode/interfaces-ethernet.py @@ -27,6 +27,9 @@ from vyos.validate import is_member from vyos.config import Config from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { **interface_default_data, 'deleted': False, diff --git a/src/conf_mode/interfaces-geneve.py b/src/conf_mode/interfaces-geneve.py index e4109a221..31f6eb6b5 100755 --- a/src/conf_mode/interfaces-geneve.py +++ b/src/conf_mode/interfaces-geneve.py @@ -25,6 +25,9 @@ from vyos.ifconfig import GeneveIf from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'deleted': False, diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py index cdfc6ea84..4ff0bcb57 100755 --- a/src/conf_mode/interfaces-l2tpv3.py +++ b/src/conf_mode/interfaces-l2tpv3.py @@ -26,6 +26,9 @@ from vyos import ConfigError from vyos.util import call from vyos.validate import is_member, is_addr_assigned +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'deleted': False, diff --git a/src/conf_mode/interfaces-loopback.py b/src/conf_mode/interfaces-loopback.py index ddd18ae24..df268cec2 100755 --- a/src/conf_mode/interfaces-loopback.py +++ b/src/conf_mode/interfaces-loopback.py @@ -24,6 +24,9 @@ from vyos.configdict import list_diff from vyos.config import Config from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'address_remove': [], diff --git a/src/conf_mode/interfaces-macsec.py b/src/conf_mode/interfaces-macsec.py index 7d6f238f3..a8966148f 100755 --- a/src/conf_mode/interfaces-macsec.py +++ b/src/conf_mode/interfaces-macsec.py @@ -28,6 +28,9 @@ from vyos.util import call from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'address_remove': [], diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index ea8e1a7c4..bd8a0b6b0 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -32,6 +32,9 @@ from vyos.util import call, chown, chmod_600, chmod_755 from vyos.validate import is_addr_assigned, is_member, is_ipv4 from vyos import ConfigError +from vyos import airbag +airbag.enable() + user = 'openvpn' group = 'openvpn' diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 6cde850c9..ac0022dc1 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -26,6 +26,8 @@ from vyos.util import chown, chmod_755, call from vyos import ConfigError from vyos.template import render +from vyos import airbag +airbag.enable() default_config_data = { 'access_concentrator': '', diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py index 3e036a753..96ec5602d 100755 --- a/src/conf_mode/interfaces-pseudo-ethernet.py +++ b/src/conf_mode/interfaces-pseudo-ethernet.py @@ -26,6 +26,9 @@ from vyos.ifconfig import MACVLANIf, Section from vyos.ifconfig_vlan import apply_all_vlans, verify_vlan_config from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { **interface_default_data, 'deleted': False, diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py index 8e9bb069e..c9964d41c 100755 --- a/src/conf_mode/interfaces-tunnel.py +++ b/src/conf_mode/interfaces-tunnel.py @@ -29,6 +29,9 @@ from vyos.validate import is_ipv4, is_ipv6, is_member from vyos import ConfigError from vyos.dicts import FixedDict +from vyos import airbag +airbag.enable() + class ConfigurationState(Config): """ The current API require a dict to be generated by get_config() diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 84fe3dfc8..39db814b4 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -25,6 +25,9 @@ from vyos.ifconfig import VXLANIf, Interface from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'deleted': False, diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py index 97dcf626b..ab3e073ae 100755 --- a/src/conf_mode/interfaces-wireguard.py +++ b/src/conf_mode/interfaces-wireguard.py @@ -28,6 +28,9 @@ from vyos.util import chown, chmod_750, call from vyos.validate import is_member, is_ipv6 from vyos import ConfigError +from vyos import airbag +airbag.enable() + kdir = r'/config/auth/wireguard' default_config_data = { diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 0fa20c5f4..328632036 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -32,6 +32,9 @@ from vyos.util import chown, call from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { **interface_default_data, 'cap_ht' : False, diff --git a/src/conf_mode/interfaces-wirelessmodem.py b/src/conf_mode/interfaces-wirelessmodem.py index 975e21d9f..a13c70990 100755 --- a/src/conf_mode/interfaces-wirelessmodem.py +++ b/src/conf_mode/interfaces-wirelessmodem.py @@ -27,6 +27,9 @@ from vyos.util import chown, chmod_755, cmd, call from vyos.validate import is_member from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'address': [], 'apn': '', diff --git a/src/conf_mode/ipsec-settings.py b/src/conf_mode/ipsec-settings.py index 6282c2cc7..015d1a480 100755 --- a/src/conf_mode/ipsec-settings.py +++ b/src/conf_mode/ipsec-settings.py @@ -25,6 +25,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() ra_conn_name = "remote-access" charon_conf_file = "/etc/strongswan.d/charon.conf" diff --git a/src/conf_mode/le_cert.py b/src/conf_mode/le_cert.py index 2db31d3fc..5b965f95f 100755 --- a/src/conf_mode/le_cert.py +++ b/src/conf_mode/le_cert.py @@ -23,6 +23,9 @@ from vyos import ConfigError from vyos.util import cmd from vyos.util import call +from vyos import airbag +airbag.enable() + vyos_conf_scripts_dir = vyos.defaults.directories['conf_mode'] dependencies = [ diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index 6446074d8..1b539887a 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -27,6 +27,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = "/etc/default/lldpd" vyos_config_file = "/etc/lldpd.d/01-vyos.conf" diff --git a/src/conf_mode/mdns_repeater.py b/src/conf_mode/mdns_repeater.py index a652553f7..b43f9bdd8 100755 --- a/src/conf_mode/mdns_repeater.py +++ b/src/conf_mode/mdns_repeater.py @@ -25,6 +25,9 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() + config_file = r'/etc/default/mdns-repeater' default_config_data = { diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py index d491395ac..7294314c6 100755 --- a/src/conf_mode/nat.py +++ b/src/conf_mode/nat.py @@ -28,6 +28,9 @@ from vyos.util import call, cmd from vyos.validate import is_addr_assigned from vyos import ConfigError +from vyos import airbag +airbag.enable() + default_config_data = { 'deleted': False, 'destination': [], diff --git a/src/conf_mode/ntp.py b/src/conf_mode/ntp.py index 85f60293d..a66fddc61 100755 --- a/src/conf_mode/ntp.py +++ b/src/conf_mode/ntp.py @@ -25,6 +25,9 @@ from vyos.util import call from vyos.template import render from vyos import ConfigError +from vyos import airbag +airbag.enable() + config_file = r'/etc/ntp.conf' default_config_data = { diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py index d6577579e..c8e791c78 100755 --- a/src/conf_mode/protocols_bfd.py +++ b/src/conf_mode/protocols_bfd.py @@ -25,6 +25,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/tmp/bfd.frr' diff --git a/src/conf_mode/protocols_igmp.py b/src/conf_mode/protocols_igmp.py index 821ccb0fc..6f0e2010f 100755 --- a/src/conf_mode/protocols_igmp.py +++ b/src/conf_mode/protocols_igmp.py @@ -24,6 +24,8 @@ from vyos.config import Config from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/tmp/igmp.frr' diff --git a/src/conf_mode/protocols_mpls.py b/src/conf_mode/protocols_mpls.py index 9b946b43a..15785a801 100755 --- a/src/conf_mode/protocols_mpls.py +++ b/src/conf_mode/protocols_mpls.py @@ -21,6 +21,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/tmp/ldpd.frr' diff --git a/src/conf_mode/protocols_pim.py b/src/conf_mode/protocols_pim.py index 15c4a2b0f..8aa324bac 100755 --- a/src/conf_mode/protocols_pim.py +++ b/src/conf_mode/protocols_pim.py @@ -24,6 +24,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/tmp/pimd.frr' diff --git a/src/conf_mode/protocols_static_multicast.py b/src/conf_mode/protocols_static_multicast.py index ba6324393..eeab26d4d 100755 --- a/src/conf_mode/protocols_static_multicast.py +++ b/src/conf_mode/protocols_static_multicast.py @@ -24,6 +24,8 @@ from vyos.config import Config from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/tmp/static_mcast.frr' diff --git a/src/conf_mode/salt-minion.py b/src/conf_mode/salt-minion.py index 8bc35bb45..3343d1247 100755 --- a/src/conf_mode/salt-minion.py +++ b/src/conf_mode/salt-minion.py @@ -26,6 +26,9 @@ from vyos.template import render from vyos.util import call, chown from vyos import ConfigError +from vyos import airbag +airbag.enable() + config_file = r'/etc/salt/minion' master_keyfile = r'/opt/vyatta/etc/config/salt/pki/minion/master_sign.pub' diff --git a/src/conf_mode/service_ipoe-server.py b/src/conf_mode/service_ipoe-server.py index 84443ade3..b539da98e 100755 --- a/src/conf_mode/service_ipoe-server.py +++ b/src/conf_mode/service_ipoe-server.py @@ -27,6 +27,9 @@ from vyos.util import call, get_half_cpus from vyos.validate import is_ipv4 from vyos import ConfigError +from vyos import airbag +airbag.enable() + ipoe_conf = '/run/accel-pppd/ipoe.conf' ipoe_chap_secrets = '/run/accel-pppd/ipoe.chap-secrets' diff --git a/src/conf_mode/service_pppoe-server.py b/src/conf_mode/service_pppoe-server.py index e05b0ab2a..e8777dcad 100755 --- a/src/conf_mode/service_pppoe-server.py +++ b/src/conf_mode/service_pppoe-server.py @@ -27,6 +27,9 @@ from vyos.util import call, get_half_cpus from vyos.validate import is_ipv4 from vyos import ConfigError +from vyos import airbag +airbag.enable() + pppoe_conf = r'/run/accel-pppd/pppoe.conf' pppoe_chap_secrets = r'/run/accel-pppd/pppoe.chap-secrets' diff --git a/src/conf_mode/service_router-advert.py b/src/conf_mode/service_router-advert.py index 620f3eacf..da7019e2c 100755 --- a/src/conf_mode/service_router-advert.py +++ b/src/conf_mode/service_router-advert.py @@ -24,6 +24,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/etc/radvd.conf' diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py index 7530da2dc..2b6140f41 100755 --- a/src/conf_mode/snmp.py +++ b/src/conf_mode/snmp.py @@ -28,6 +28,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file_client = r'/etc/snmp/snmp.conf' config_file_daemon = r'/etc/snmp/snmpd.conf' diff --git a/src/conf_mode/ssh.py b/src/conf_mode/ssh.py index 76fdad8ae..c830497ab 100755 --- a/src/conf_mode/ssh.py +++ b/src/conf_mode/ssh.py @@ -22,6 +22,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/etc/ssh/sshd_config' diff --git a/src/conf_mode/system-ip.py b/src/conf_mode/system-ip.py index 8a1ac8411..85f1e3771 100755 --- a/src/conf_mode/system-ip.py +++ b/src/conf_mode/system-ip.py @@ -22,6 +22,8 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import call +from vyos import airbag +airbag.enable() default_config_data = { 'arp_table': 8192, diff --git a/src/conf_mode/system-ipv6.py b/src/conf_mode/system-ipv6.py index 04a063564..3417c609d 100755 --- a/src/conf_mode/system-ipv6.py +++ b/src/conf_mode/system-ipv6.py @@ -23,6 +23,8 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import call +from vyos import airbag +airbag.enable() ipv6_disable_file = '/etc/modprobe.d/vyos_disable_ipv6.conf' diff --git a/src/conf_mode/system-login-banner.py b/src/conf_mode/system-login-banner.py index 5a34a0b06..5c0adc921 100755 --- a/src/conf_mode/system-login-banner.py +++ b/src/conf_mode/system-login-banner.py @@ -18,6 +18,9 @@ from sys import exit from vyos.config import Config from vyos import ConfigError +from vyos import airbag +airbag.enable() + motd=""" The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index 536c5f70e..5990c3777 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -28,6 +28,9 @@ from vyos.template import render from vyos.util import cmd, call, DEVNULL, chmod_600, chmod_755 from vyos import ConfigError +from vyos import airbag +airbag.enable() + radius_config_file = "/etc/pam_radius_auth.conf" default_config_data = { diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py index b3dbc82fb..8de3b6fa2 100755 --- a/src/conf_mode/system-options.py +++ b/src/conf_mode/system-options.py @@ -22,6 +22,9 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import run +from vyos import airbag +airbag.enable() + systemd_ctrl_alt_del = '/lib/systemd/system/ctrl-alt-del.target' default_config_data = { diff --git a/src/conf_mode/system-proxy.py b/src/conf_mode/system-proxy.py index cf72a1f96..02536c2ab 100755 --- a/src/conf_mode/system-proxy.py +++ b/src/conf_mode/system-proxy.py @@ -23,6 +23,9 @@ import re from vyos import ConfigError from vyos.config import Config +from vyos import airbag +airbag.enable() + proxy_def = r'/etc/profile.d/vyos-system-proxy.sh' diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py index 9da3d9157..8b20e1135 100755 --- a/src/conf_mode/system-syslog.py +++ b/src/conf_mode/system-syslog.py @@ -24,6 +24,8 @@ from vyos import ConfigError from vyos.util import run from vyos.template import render +from vyos import airbag +airbag.enable() def get_config(): c = Config() diff --git a/src/conf_mode/system-timezone.py b/src/conf_mode/system-timezone.py index 25b949a79..0f4513122 100755 --- a/src/conf_mode/system-timezone.py +++ b/src/conf_mode/system-timezone.py @@ -22,6 +22,8 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import call +from vyos import airbag +airbag.enable() default_config_data = { 'name': 'UTC' diff --git a/src/conf_mode/system-wifi-regdom.py b/src/conf_mode/system-wifi-regdom.py index b222df0a9..30ea89098 100755 --- a/src/conf_mode/system-wifi-regdom.py +++ b/src/conf_mode/system-wifi-regdom.py @@ -23,6 +23,8 @@ from vyos.config import Config from vyos import ConfigError from vyos.template import render +from vyos import airbag +airbag.enable() config_80211_file='/etc/modprobe.d/cfg80211.conf' config_crda_file='/etc/default/crda' diff --git a/src/conf_mode/task_scheduler.py b/src/conf_mode/task_scheduler.py index b171e9576..51d8684cb 100755 --- a/src/conf_mode/task_scheduler.py +++ b/src/conf_mode/task_scheduler.py @@ -23,6 +23,8 @@ import sys from vyos.config import Config from vyos import ConfigError +from vyos import airbag +airbag.enable() crontab_file = "/etc/cron.d/vyos-crontab" diff --git a/src/conf_mode/tftp_server.py b/src/conf_mode/tftp_server.py index 94c8bcf03..d31851bef 100755 --- a/src/conf_mode/tftp_server.py +++ b/src/conf_mode/tftp_server.py @@ -28,6 +28,8 @@ from vyos import ConfigError from vyos.util import call from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/etc/default/tftpd' diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py index f312f2a17..febe8c3b7 100755 --- a/src/conf_mode/vpn_l2tp.py +++ b/src/conf_mode/vpn_l2tp.py @@ -30,6 +30,8 @@ from vyos.validate import is_ipv4 from vyos import ConfigError from vyos.template import render +from vyos import airbag +airbag.enable() l2tp_conf = '/run/accel-pppd/l2tp.conf' l2tp_chap_secrets = '/run/accel-pppd/l2tp.chap-secrets' diff --git a/src/conf_mode/vpn_pptp.py b/src/conf_mode/vpn_pptp.py index 085c9c2c6..5c8b53e1d 100755 --- a/src/conf_mode/vpn_pptp.py +++ b/src/conf_mode/vpn_pptp.py @@ -26,6 +26,9 @@ from vyos.template import render from vyos.util import call, get_half_cpus from vyos import ConfigError +from vyos import airbag +airbag.enable() + pptp_conf = '/run/accel-pppd/pptp.conf' pptp_chap_secrets = '/run/accel-pppd/pptp.chap-secrets' diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py index 7c3e3f515..e080ce0dd 100755 --- a/src/conf_mode/vpn_sstp.py +++ b/src/conf_mode/vpn_sstp.py @@ -27,6 +27,9 @@ from vyos.util import call, run, get_half_cpus from vyos.validate import is_ipv4 from vyos import ConfigError +from vyos import airbag +airbag.enable() + sstp_conf = '/run/accel-pppd/sstp.conf' sstp_chap_secrets = '/run/accel-pppd/sstp.chap-secrets' diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py index eb73293a9..e8f523e36 100755 --- a/src/conf_mode/vrf.py +++ b/src/conf_mode/vrf.py @@ -27,6 +27,8 @@ from vyos.util import read_file, cmd from vyos import ConfigError from vyos.template import render +from vyos import airbag +airbag.enable() config_file = r'/etc/iproute2/rt_tables.d/vyos-vrf.conf' diff --git a/src/conf_mode/vrrp.py b/src/conf_mode/vrrp.py index 1a5ad1f8c..292eb0c78 100755 --- a/src/conf_mode/vrrp.py +++ b/src/conf_mode/vrrp.py @@ -29,6 +29,8 @@ from vyos.template import render from vyos.ifconfig.vrrp import VRRP +from vyos import airbag +airbag.enable() def get_config(): vrrp_groups = [] diff --git a/src/conf_mode/vyos_cert.py b/src/conf_mode/vyos_cert.py index 8b8953cb7..fb4644d5a 100755 --- a/src/conf_mode/vyos_cert.py +++ b/src/conf_mode/vyos_cert.py @@ -27,6 +27,9 @@ from vyos.config import Config from vyos import ConfigError from vyos.util import cmd +from vyos import airbag +airbag.enable() + vyos_conf_scripts_dir = vyos.defaults.directories['conf_mode'] # XXX: this model will need to be extended for tag nodes -- cgit v1.2.3