diff options
| -rwxr-xr-x | autopeer_shell.py | 2 | ||||
| -rwxr-xr-x | cronjob.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/autopeer_shell.py b/autopeer_shell.py index 0e15930..d981676 100755 --- a/autopeer_shell.py +++ b/autopeer_shell.py @@ -82,7 +82,7 @@ class AutopeerShell(cmd.Cmd): def do_addpeer(self, name, pubkey, endpoint, port, ipll): '''<name> <wg pubkey> <wg address> <wg port> <ipv6 link local> Add a new peer''' - NAME_REGEX = r'^[a-zA-Z][a-zA-Z0-9]+$' + NAME_REGEX = r'^[a-zA-Z][a-zA-Z0-9]{0,8}$' if not re.match(NAME_REGEX, name): print(f'Error: name must match {NAME_REGEX}', file=sys.stderr) return @@ -10,7 +10,7 @@ while row := curs.fetchone(): name, asn = row print(f'Processing {asn}-{name}...') birdcfg = open(f'/etc/bird/peers/as{asn}{name}.conf', 'w') - wgcfg = open(f'/etc/wireguard/wg-{asn}-{name}.conf', 'w') + wgcfg = open(f'/etc/wireguard/wg{asn%10000}{name}.conf', 'w') print(_bird_config(name, _get_peer_info(name, asn), _get_my_info(asn)), file=birdcfg) print(_wg_config(name, _get_peer_info(name, asn), _get_my_info(asn)), file=wgcfg) birdcfg.close() |
