ruimarinho / gsts

Obtain and store AWS STS credentials to interact with Amazon services by authenticating via G Suite SAML.
MIT License
212 stars 37 forks source link

multiple daemon entries #61

Closed heydonovan closed 1 year ago

heydonovan commented 2 years ago

as a workaround for this issue (https://github.com/ruimarinho/gsts/issues/60), we are exploring the use of gsts --daemon

gsts --idp-id=REDACTED --sp-id=REDACTED --aws-profile=test_a --aws-role-arn=arn:aws:iam::12345:role/${ROLE} --force --daemon
gsts --idp-id=REDACTED --sp-id=REDACTED --aws-profile=test_b --aws-role-arn=arn:aws:iam::98765:role/${ROLE} --force --daemon

We have two different AWS accounts, and two different roles. However, running this command only resulted in one io.github.ruimarinho.gsts.plist file being generated, with only the test_b profile. I believe it overwrites the test_a one. Is it possible to have two daemons? One for each profile?

$ cat /Users/donovanhernandez/Library/LaunchAgents/io.github.ruimarinho.gsts.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>io.github.ruimarinho.gsts</string>
    <key>EnvironmentVariables</key>
    <dict>
      <key>PATH</key>
      <string>/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
    </dict>
    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>600</integer>
    <key>StandardErrorPath</key>
    <string>/usr/local/var/log/gsts.stdout.log</string>
    <key>StandardOutPath</key>
    <string>/usr/local/var/log/gsts.stderr.log</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/gsts</string>
      <string>--aws-profile=test_b</string>
      <string>--aws-role-arn=arn:aws:iam::98765:role/REDACTED</string>
      <string>--aws-shared-credentials-file=/Users/donovanhernandez/.aws/credentials</string>
      <string>--force</string>
      <string>--idp-id=REDACTED</string>
      <string>--engine=chromium</string>
      <string>--sp-id=REDACTED</string>
    </array>
  </dict>
</plist>⏎
ruimarinho commented 1 year ago

The daemon functionality will be removed on the next major, being drafted under https://github.com/ruimarinho/gsts/pull/82. It won't be necessary anymore as the expiration issue has been addressed there.

Thanks for your feedback!