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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,10 @@ authentication domain must be listed in `domains`.
| `identity_mapping` | Optional expression-based identity mappings for storage gateway accounts | Optional[Array[Hash]] |
| `freeipa_mapping` | Enable external username mapping through the FreeIPA API using a dedicated gcsweb keytab; mutually exclusive with `identity_mapping` | Boolean |
| `restrict_paths` | Path restrictions for accessing data on collections created using this storage gateway | [GlobusPathRestrictions](https://docs.globus.org/globus-connect-server/v5/api/schemas/PathRestrictions_schema/) |
| `subscription_id` | Attache the Globus endpoint to a subscription ID. Required for `high_assurance` | Optional[String[1]] |
| `high_assurance` | Creates a Globus `high-assurance` storage gateway, requires a subscribed endpoint | Boolean |
| `authentication_timeout_mins` | Minutes before users must re-authenticate to a `high-assurance` gateway | Integer[1] |
| `allow_guest_collections` | Allow users to create guest collections on the mapped collection, requires a subscribed endpoint | Boolean |

<details>
<summary>default values</summary>
Expand All @@ -860,6 +864,10 @@ profile::globus::domains: []
profile::globus::enable_oidc: true
profile::globus::identity_mapping: ~
profile::globus::freeipa_mapping: false
profile::globus::high_assurance: false
profile::globus::authentication_timeout_mins: 60
profile::globus::subscription_id: ~
profile::globus::allow_guest_collections: false
profile::globus::restrict_paths: {}
```
</details>
Expand Down
48 changes: 44 additions & 4 deletions site/profile/manifests/globus.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
Boolean $enable_oidc = true,
Optional[Array[Hash]] $identity_mapping = undef,
Boolean $freeipa_mapping = false,
Boolean $high_assurance = false,
Integer[1] $authentication_timeout_mins = 60,
Optional[String[1]] $subscription_id = undef,
Boolean $allow_guest_collections = false,
GlobusPathRestrictions $restrict_paths = {},
) {
if $freeipa_mapping and $identity_mapping != undef {
Expand Down Expand Up @@ -51,6 +55,8 @@
'display_name' => $display_name,
'domain_string' => $domain_string,
'identity_mapping' => $identity_mapping != undef or $freeipa_mapping,
'high_assurance' => $high_assurance,
'auth_timeout' => $authentication_timeout_mins,
}
),
}
Expand All @@ -64,10 +70,11 @@
content => epp(
'profile/globus/globus-collection-setup',
{
'default_directory' => $default_directory,
'public_ip' => lookup('terraform.self.public_ip'),
'display_name' => $display_name,
'collection_path' => $collection_path,
'default_directory' => $default_directory,
'public_ip' => lookup('terraform.self.public_ip'),
'display_name' => $display_name,
'collection_path' => $collection_path,
'allow_guest_collections' => $allow_guest_collections,
}
),
}
Expand Down Expand Up @@ -152,6 +159,39 @@
fail('Globus requires at least one authentication domain or ensure OIDC server is running (profile::globus::enable_oidc: true)')
}

if $subscription_id {
file { '/root/globus-subscription-setup':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0700',
content => epp(
'profile/globus/globus-subscription-setup',
{
'subscription_id' => $subscription_id,
}
),
}

# Runs once after the endpoint and node are set up, and again whenever
# subscription_id differs from the one recorded in subscription.json.
exec { 'globus-subscription-setup':
command => '/bin/sh /root/globus-subscription-setup',
environment => [
"GCS_CLI_CLIENT_ID=${globus::client_id}",
"GCS_CLI_CLIENT_SECRET=${globus::client_secret.unwrap}",
],
unless => "/usr/bin/test \"\$(/usr/bin/jq -r .subscription_id /var/lib/globus-connect-server/subscription.json 2>/dev/null)\" = '${subscription_id}'",
provider => 'shell',
require => [
Package['jq'],
Exec['globus-node-setup'],
File['/root/globus-subscription-setup'],
],
before => Exec['globus-gateway-setup'],
}
}

exec { 'globus-gateway-setup':
command => '/bin/sh /root/globus-gateway-setup',
environment => [
Expand Down
1 change: 1 addition & 0 deletions site/profile/templates/globus/globus-collection-setup.epp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ COLLECTION_OUTPUT=$(
collection create ${GATEWAY_ID} \
<%= $collection_path %> \
--default-directory <%= $default_directory %> \
<% if $allow_guest_collections { %>--allow-guest-collections<% } %> \
"<%= $display_name %> collection"
)
exit_code=$?
Expand Down
1 change: 1 addition & 0 deletions site/profile/templates/globus/globus-gateway-setup.epp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ GATEWAY_OUTPUT=$(
posix "<%= $display_name %> gateway" \
<%= $domain_string %> ${OIDC_DOMAIN} \
<% if $identity_mapping { %>--identity-mapping file:/etc/globus/identity_mapping.json<% } %> \
<% if $high_assurance { %>--high-assurance --authentication-timeout-mins <%= $auth_timeout %><% } %> \
--restrict-paths file:/etc/globus/restrict_paths.json
)
exit_code=$?
Expand Down
15 changes: 15 additions & 0 deletions site/profile/templates/globus/globus-subscription-setup.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
export GCS_CLI_ENDPOINT_ID=$(jq .endpoint_id -r /var/lib/globus-connect-server/info.json)
SUBSCRIPTION_OUTPUT=$(
globus-connect-server endpoint update \
--subscription-id <%= $subscription_id %> 2>&1
)
exit_code=$?
if [ "${exit_code}" -eq 0 ]; then
jq -n --arg subscription_id "<%= $subscription_id %>" '{subscription_id: $subscription_id}' \
> /var/lib/globus-connect-server/subscription.json
rm -f /var/lib/globus-connect-server/subscription-error.json
else
echo "${SUBSCRIPTION_OUTPUT}" > /var/lib/globus-connect-server/subscription-error.json
exit ${exit_code}
fi
Loading