Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions misc-tools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/dj_make_chroot_docker
/dj_run_chroot
/dj_judgehost_cleanup
/force-passwords
2 changes: 1 addition & 1 deletion misc-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/Makefile.global
TARGETS =
OBJECTS =

SUBST_DOMSERVER = fix_permissions configure-domjudge import-contest
SUBST_DOMSERVER = fix_permissions configure-domjudge import-contest force-passwords

SUBST_JUDGEHOST = dj_make_chroot dj_run_chroot dj_make_chroot_docker \
dj_judgehost_cleanup
Expand Down
22 changes: 22 additions & 0 deletions misc-tools/force-passwords.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3

import subprocess

webappdir = '@domserver_webappdir@'
etcdir = '@domserver_etcdir@'

with open(f'{etcdir}/restapi.secret', 'r') as f:
while True:
line = f.readline()
if line.startswith('#'):
continue
tokens = line.split()
if len(tokens) == 4 and tokens[0] == 'default':
user = tokens[2]
password = tokens[3]
subprocess.run([webappdir + '/bin/console', 'domjudge:reset-user-password', user, password])
break

with open(f'{etcdir}/initial_admin_password.secret', 'r') as f:
password = f.readline().strip()
subprocess.run([webappdir + '/bin/console', 'domjudge:reset-user-password', 'admin', password])
Loading