Example #1
0
    def __init__(self, daemon):
        """
        Set internal fields for the IPsec process.
        """

        super().__init__()

        self.dry_run = daemon.dry_run

        self.logger = daemon.logger

        self.use_ipsec = daemon.use_ipsec

        if not self.use_ipsec:
            return

        self.ipsec_manage = daemon.ipsec_manage
        self.ipsec_psk = daemon.ipsec_psk

        self.template_dir = daemon.template_dir

        self.ipsec_conf = daemon.ipsec_conf
        self.ipsec_secrets = daemon.ipsec_secrets

        self.ipsec_conf_template = util.template_read(self.template_dir, "ipsec.conf")
        self.ipsec_secrets_template = util.template_read(self.template_dir, "ipsec.secrets")

        # Create a dictionary which maps the name of the IPsec
        # connection to a tuple containing the local and remote addresses.
        self.mesh_conns = dict(zip(["%s-%s" % (m[0], m[1]) for m in daemon.mesh_links], daemon.mesh_links))

        self.ipsec = util.command_path("ipsec") if not self.dry_run else util.command_path("true")
Example #2
0
    def __init__(self, daemon, overlay):
        '''
        Set internal fields for the BGP process.
        '''

        super().__init__()

        self.dry_run = daemon.dry_run

        self.log_level = daemon.log_level

        self.template_dir = daemon.template_dir

        self.logger = overlay.logger
        self.name = overlay.name
        self.netns = overlay.netns

        self.description = "BGP process for overlay '%s'" % self.name

        self.asn = overlay.asn
        self.linknet_pool = overlay.linknet_pool

        self.mesh_tunnels = tuple(overlay.mesh_tunnels)
        self.interfaces = tuple(overlay.interfaces)

        self.bird_ctl_dir = os.path.join(overlay.root_dir, "run", "bird")
        self.bird_conf_dir = os.path.join(overlay.root_dir, "etc", "bird")
        self.bird_log_dir = os.path.join(overlay.root_dir, "var", "log", "bird")
        self.bird_pid_dir = os.path.join(overlay.root_dir, "run", "bird")

        self.bird_ctl = os.path.join(self.bird_ctl_dir, "bird.ctl")
        self.bird_conf = os.path.join(self.bird_conf_dir, "bird.conf")
        self.bird_log = os.path.join(self.bird_log_dir, "bird.log")
        self.bird_pid = os.path.join(self.bird_pid_dir, "bird.pid")

        self.bird6_ctl = os.path.join(self.bird_ctl_dir, "bird6.ctl")
        self.bird6_conf = os.path.join(self.bird_conf_dir, "bird6.conf")
        self.bird6_log = os.path.join(self.bird_log_dir, "bird6.log")
        self.bird6_pid = os.path.join(self.bird_pid_dir, "bird6.pid")

        self.bird_conf_template = util.template_read(self.template_dir, "bird.conf")

        self.bird = util.command_path("bird") if not self.dry_run else "/usr/sbin/bird"
        self.bird6 = util.command_path("bird6") if not self.dry_run else "/usr/sbin/bird6"