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.
|
# ACHTUNG! Die Passwörter sind nicht idempotent, sondern werden neu generiert.
|
||||||
# Das Skript also nur ausführen, solange die User noch nicht online sind.
|
# 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:
|
# Anpassbar:
|
||||||
# - Welcher Userprefix kommt in welches VLAN.
|
# - Welcher Userprefix kommt in welches VLAN.
|
||||||
@ -14,11 +15,11 @@
|
|||||||
# Fragen? Fragen! DECT664 oder über Signal / Matrix / rfc1149.
|
# Fragen? Fragen! DECT664 oder über Signal / Matrix / rfc1149.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
|
|
||||||
USERS_PER_PREFIX = 20
|
USERS_PER_PREFIX = 20
|
||||||
|
LEITSTELLE01_PW = "Findest du in der existierenden authorize file"
|
||||||
|
|
||||||
### LEITSTELLE
|
### LEITSTELLE
|
||||||
# DEFAULT
|
# DEFAULT
|
||||||
@ -60,10 +61,12 @@ print("\tTunnel-Medium-Type = IEEE-802,")
|
|||||||
print("\tFall-Through = Yes")
|
print("\tFall-Through = Yes")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
csv_file = "Username,password\n"
|
||||||
|
|
||||||
for (vlan, prefix) in prefixes:
|
for (vlan, prefix) in prefixes:
|
||||||
print(f"## {prefix.upper()}")
|
print(f"## {prefix.upper()}")
|
||||||
print(f"DEFAULT")
|
print(f"DEFAULT")
|
||||||
print(f"\tTunnel-Private-Group-Id = \"{vlan}\"")
|
print(f"\tTunnel-Private-Group-Id := \"{vlan}\",")
|
||||||
print(f"\tFall-Through = Yes")
|
print(f"\tFall-Through = Yes")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
@ -71,6 +74,14 @@ for (vlan, prefix) in prefixes:
|
|||||||
username = f"{prefix}{i:02d}"
|
username = f"{prefix}{i:02d}"
|
||||||
pw = gen_password()
|
pw = gen_password()
|
||||||
|
|
||||||
|
if username == "leitstelle01":
|
||||||
|
pw = LEITSTELLE01_PW
|
||||||
|
|
||||||
print(f"{username}\tCleartext-Password := \"{pw}\"")
|
print(f"{username}\tCleartext-Password := \"{pw}\"")
|
||||||
|
|
||||||
|
csv_file += username + "," + pw + "\n"
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
f = open("accounts.csv", "w")
|
||||||
|
f.write(csv_file)
|
||||||
|
f.close()
|
Loading…
Reference in New Issue
Block a user