Skip to content

Commit

Permalink
Merge pull request opensciencegrid#3216 from AndresTanasijczuk/cache_…
Browse files Browse the repository at this point in the history
…authz_ligo_vo

Extend authz list with LIGO DNs for all LIGO private namespaces in cache Authfile
  • Loading branch information
matyasselmeci authored Sep 13, 2023
2 parents 73fbe32 + 49f88e6 commit 032f6fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ For every cache resource, add a `u <DN HASH> <PATH1> rl <PATH2> rl ...` ACL for
The Authfile for a public cache is served at `/cache/Authfile-public?fqdn=<CACHE FQDN>`.

The public Authfile is basically a giant `u *` list:
- Explicitly deny read access to `/user/ligo` (with `-rl` permissions)
- Explicitly deny read access to `/user/ligo` (with `-rl` permissions); this is needed, because granting access to the OSG VO `/user` path would otherwise also grant access to `/user/ligo`
- Allow read access to the path of each namespace supported by the cache (`rl` permissions)

### Cache authenticated Authfile generation
Expand All @@ -452,9 +452,9 @@ The Authfile for an authenticated cache is served at `/cache/Authfile?fqdn=<CACH
- Add a `u <DN HASH> <PATH1> rl <PATH2> rl ...` for every DN listed in the Authorizations list of every namespace supported by the cache.
- Add a `g <FQAN> <PATH1> rl <PATH2> rl ...` for every FQAN listed in the Authorizations list of every namespace supported by the cache.

In addition, if the cache supports the `/user/ligo` namespace and the webapp can access LIGO's LDAP server:
In addition, if the cache supports the LIGO VO and the webapp can access LIGO's LDAP server:

- Add a `u <DN HASH> /user/ligo rl` for every DN obtained from the LIGO's LDAP server.
- Add a `u <DN HASH> <LIGO PATH1> rl <LIGO PATH2> rl ...` for every DN obtained from the LIGO's LDAP server.


### Origin xrootd-scitokens config generation
Expand Down
9 changes: 2 additions & 7 deletions src/stashcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def fetch_ligo_authz_list_if_needed():
ligo_authz_list.append(parse_authz(f"DN:{dn}")[0])
return ligo_authz_list

for stashcache_obj in vos_data.stashcache_by_vo_name.values():
for vo_name, stashcache_obj in vos_data.stashcache_by_vo_name.items():
for path, namespace in stashcache_obj.namespaces.items():
if not namespace_allows_cache_resource(namespace, cache_resource):
continue
Expand All @@ -165,7 +165,7 @@ def fetch_ligo_authz_list_if_needed():

# Extend authz list with LIGO DNs if applicable
extended_authz_list = namespace.authz_list
if path == "/user/ligo":
if vo_name.lower() == "ligo":
if legacy:
extended_authz_list += fetch_ligo_authz_list_if_needed()
else:
Expand Down Expand Up @@ -323,11 +323,6 @@ def generate_cache_grid_mapfile(global_data: GlobalData,
if not resource:
return ""

ligo_authz_list: List[AuthMethod] = []
if legacy:
for dn in global_data.get_ligo_dn_list():
ligo_authz_list.append(parse_authz(f"DN:{dn}")[0])

idns = _IdNamespaceData.for_cache(
global_data=global_data,
topology=topology,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_stashcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def test_allowedVO_includes_ANY_for_ligo_inclusion(self, client: flask.Flask, mo

stashcache.generate_cache_authfile(global_data, "osg-sunnyvale-stashcache.t2.ucsd.edu")

assert spy.call_count == 1
assert spy.call_count == 5

def test_allowedVO_includes_LIGO_for_ligo_inclusion(self, client: flask.Flask, mocker: MockerFixture):
spy = mocker.spy(global_data, "get_ligo_dn_list")

stashcache.generate_cache_authfile(global_data, "stashcache.gwave.ics.psu.edu")

assert spy.call_count == 1
assert spy.call_count == 5

def test_allowedVO_excludes_LIGO_and_ANY_for_ligo_inclusion(self, client: flask.Flask, mocker: MockerFixture):
spy = mocker.spy(global_data, "get_ligo_dn_list")
Expand Down

0 comments on commit 032f6fc

Please sign in to comment.