From 71f98373d0cc0ae19750badcd4b47a936ec5391d Mon Sep 17 00:00:00 2001 From: William Mantly Date: Sun, 26 Jun 2022 18:19:24 +0000 Subject: [PATCH] Update 'index.sh' --- index.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.sh b/index.sh index 415ccb5..175144a 100755 --- a/index.sh +++ b/index.sh @@ -114,15 +114,15 @@ echo "AuthorizedKeysCommandUser nobody" >> /etc/ssh/sshd_config service ssh restart -if [ -z "$sso_token" ]; then +if [[ -v sso_token ]]; then + echo "found token" + curl "${sso_url}/api/group/" \ + -H "auth-token: ${sso_token}" \ + -H "content-type: application/json; charset=UTF-8" \ + --data-binary "{\"name\":\"host_${current_host}_access\",\"description\":\"Access for $hostname\"}" - curl '$sso_url/api/group/' \ - -H 'auth-token: $sso_token' \ - -H 'content-type: application/json; charset=UTF-8' \ - --data-binary "{\"name\":\"host_${hostname}_access\",\"description\":\"Access for $hostname\"}" - - curl '$sso_url/api/group/' \ - -H 'auth-token: $sso_token' \ - -H 'content-type: application/json; charset=UTF-8' \ - --data-binary "{\"name\":\"host_${hostname}_admin\",\"description\":\"sudo for $hostname\"}" + curl "${sso_url}/api/group/" \ + -H "auth-token: ${sso_token}" \ + -H "content-type: application/json; charset=UTF-8" \ + --data-binary "{\"name\":\"host_${current_host}_admin\",\"description\":\"sudo for $hostname\"}" fi