diff --git a/README.md b/README.md index c41259290..acdc61bd4 100644 --- a/README.md +++ b/README.md @@ -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 |
default values @@ -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: {} ```
diff --git a/site/profile/manifests/globus.pp b/site/profile/manifests/globus.pp index 696097e03..b5975610e 100644 --- a/site/profile/manifests/globus.pp +++ b/site/profile/manifests/globus.pp @@ -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 { @@ -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, } ), } @@ -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, } ), } @@ -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 => [ diff --git a/site/profile/templates/globus/globus-collection-setup.epp b/site/profile/templates/globus/globus-collection-setup.epp index 95b4afa62..52dc5bf83 100644 --- a/site/profile/templates/globus/globus-collection-setup.epp +++ b/site/profile/templates/globus/globus-collection-setup.epp @@ -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=$? diff --git a/site/profile/templates/globus/globus-gateway-setup.epp b/site/profile/templates/globus/globus-gateway-setup.epp index a64ee0c01..069e28e17 100644 --- a/site/profile/templates/globus/globus-gateway-setup.epp +++ b/site/profile/templates/globus/globus-gateway-setup.epp @@ -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=$? diff --git a/site/profile/templates/globus/globus-subscription-setup.epp b/site/profile/templates/globus/globus-subscription-setup.epp new file mode 100644 index 000000000..ccf0b5e94 --- /dev/null +++ b/site/profile/templates/globus/globus-subscription-setup.epp @@ -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