fix(radius): fix vlan assignment and export to csv
This commit is contained in:
parent
54794f2611
commit
30cd7a9f39
@ -5,7 +5,8 @@
|
||||
#
|
||||
# ACHTUNG! Die Passwörter sind nicht idempotent, sondern werden neu generiert.
|
||||
# Das Skript also nur ausführen, solange die User noch nicht online sind.
|
||||
# Danach muss wieder manuell gefrickelt werden.
|
||||
# Danach muss wieder manuell gefrickelt werden. Das Passwort für leitstelle01
|
||||
# ist bereits publik, darum wird es hier überschrieben.
|
||||
#
|
||||
# Anpassbar:
|
||||
# - Welcher Userprefix kommt in welches VLAN.
|
||||
@ -14,11 +15,11 @@
|
||||
# Fragen? Fragen! DECT664 oder über Signal / Matrix / rfc1149.
|
||||
###
|
||||
|
||||
|
||||
import secrets
|
||||
import string
|
||||
|
||||
USERS_PER_PREFIX = 20
|
||||
LEITSTELLE01_PW = "Findest du in der existierenden authorize file"
|
||||
|
||||
### LEITSTELLE
|
||||
# DEFAULT
|
||||
@ -60,10 +61,12 @@ print("\tTunnel-Medium-Type = IEEE-802,")
|
||||
print("\tFall-Through = Yes")
|
||||
print()
|
||||
|
||||
csv_file = "Username,password\n"
|
||||
|
||||
for (vlan, prefix) in prefixes:
|
||||
print(f"## {prefix.upper()}")
|
||||
print(f"DEFAULT")
|
||||
print(f"\tTunnel-Private-Group-Id = \"{vlan}\"")
|
||||
print(f"\tTunnel-Private-Group-Id := \"{vlan}\",")
|
||||
print(f"\tFall-Through = Yes")
|
||||
print()
|
||||
|
||||
@ -71,6 +74,14 @@ for (vlan, prefix) in prefixes:
|
||||
username = f"{prefix}{i:02d}"
|
||||
pw = gen_password()
|
||||
|
||||
if username == "leitstelle01":
|
||||
pw = LEITSTELLE01_PW
|
||||
|
||||
print(f"{username}\tCleartext-Password := \"{pw}\"")
|
||||
|
||||
print()
|
||||
csv_file += username + "," + pw + "\n"
|
||||
print()
|
||||
|
||||
f = open("accounts.csv", "w")
|
||||
f.write(csv_file)
|
||||
f.close()
|
Loading…
Reference in New Issue
Block a user