I am pleased to share a new Conjur Community project - a Python client for using Conjur with authn-iam!
When you use this project, you’ll find it’s even easier to leverage AWS IAM to authenticate with Conjur - which helps especially when using Lambda functions and other AWS-native tools that require secret data from Conjur.
You can find the project in GitHub here - please check it out if you’re working with Python in AWS with Conjur and want to make it even easier!
SIlly question. So, the cert_file = ‘conjur-cert.pem’? Is that just the public cert for the follower VIP? And the CA chain is in /etc/ssl/certs/ca-certificates.crt?
Hey @archerbj! The cert_file variable should point to the location of a file with the PEM-encoded x509 CA certificate chain for the DAP / Conjur instance you are connecting to. This value may be obtained by running the command:
On the Conjur policy side (from ‘conjur list’):
“OurConjurAcct:policy:conjur/authn-iam/prod”,
“OurConjurAcct:webservice:conjur/authn-iam/prod”,
“OurConjurAcct:group:conjur/authn-iam/prod/clients”
…
“OurConjurAcct:policy:conjur/authn-iam/prod/IAMmySecretTest”,
“OurConjurAcct:group:conjur/authn-iam/prod/IAMmySecretTest/secrets_grp”,
“OurConjurAcct:layer:conjur/authn-iam/prod/IAMmySecretTest”,
“OurConjurAcct:host:conjur/authn-iam/prod/IAMmySecretTest/123456789876:role/aws-test-ec2-test-role”
Note: We tried to followed the Conjur documentation for setting up the IAM Authenticator policies.
EC2 python script error:
conjur_iam_client.ConjurIAMAuthnException: Conjur IAM authentication failed with 401 - Unauthorized. Check conjur logs for more information
I mentioned this in our email exchange, but figured it might help others to post it here as well. I think your host definition is incorrect. Specifically, the :role portion is not required. The host should be just conjur/authn-iam/prod/IAMmySecretTest/123456789876/aws-test-ec2-test-role. Please let us know how that goes.
We also found that we needed to make sure that the host entries match between the app policy (where we defined the aws host acct/role) and the policy giving the host permission to use the authn-iam authenticator.
And review all the changes to do a sanity check while troubleshooting.