Skip to content

Commit

Permalink
Public origins shouldn't serve paths requiring auth
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasselmeci committed Dec 29, 2023
1 parent b250ebb commit c8a95fb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/stashcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,17 @@ def generate_origin_authfile(global_data: GlobalData, fqdn: str, suppress_errors
"# You must use the 'stash-origin' xrootd instance instead.\n")

authfile_lines = []
authfile_lines.extend(idns.warnings_auth)
for authfile_id in idns.id_to_paths:
paths_acl = " ".join(f"{p} lr" for p in sorted(idns.id_to_paths[authfile_id]))
authfile_lines.append(f"# {idns.id_to_str[authfile_id]}")
authfile_lines.append(f"{authfile_id} {paths_acl}")

# Only auth origins should serve paths requiring authentication
if not public_origin:
authfile_lines.extend(idns.warnings_auth)
for authfile_id in idns.id_to_paths:
paths_acl = " ".join(f"{p} lr" for p in sorted(idns.id_to_paths[authfile_id]))
authfile_lines.append(f"# {idns.id_to_str[authfile_id]}")
authfile_lines.append(f"{authfile_id} {paths_acl}")

# Public paths must be at the end
# XXX Should auth origins _also_ serve public paths?
if public_origin and idns.public_paths:
authfile_lines.append("")
authfile_lines.extend(idns.warnings_public)
Expand Down

0 comments on commit c8a95fb

Please sign in to comment.