Skip to content

Commit 9b2edc3

Browse files
committed
Add protection to /replace_referee
1 parent 665d68d commit 9b2edc3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config/caddy/Caddyfile.template

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ scheduling.{{ root_domain }} {
2020
{% for user in gc_users %}{{ user.name }} {{ user.hash }}
2121
{% endfor %}
2222
}
23+
basicauth /replace_referee {
24+
{% for user in gc_admin_users %}{{ user.name }} {{ user.hash }}
25+
{% endfor %}
26+
}
2327
}
2428

2529
portainer.{{ field_name }}.{{ root_domain }} {

config/caddy/generate_caddyfile.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,18 @@ def load_password_hashes():
4343
password_hashes = load_password_hashes()
4444

4545
gc_users = []
46+
gc_admin_users = []
4647
for username, password_hash in password_hashes.items():
4748
gc_users.append({"name": username, "hash": password_hash})
49+
if username == "guacadmin":
50+
gc_admin_users.append({"name": username, "hash": password_hash})
4851

4952
template = Template(load_caddyfile_template())
5053
caddyfile = template.render({
5154
"root_domain": root_domain,
5255
"field_name": field_name,
53-
"gc_users": gc_users
56+
"gc_users": gc_users,
57+
"gc_admin_users": gc_admin_users
5458
})
5559
with open(caddy_file, "w") as file:
5660
file.write(caddyfile)

0 commit comments

Comments
 (0)