summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xautopeer_shell.py2
-rwxr-xr-xcronjob.py2
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
diff --git a/cronjob.py b/cronjob.py
index 01f72fb..84c5e24 100755
--- a/cronjob.py
+++ b/cronjob.py
@@ -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()