Skip to content

Commit

Permalink
Merge pull request #15 from lorengordon/govcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon authored May 13, 2020
2 parents 3d4b5b9 + 0324f3c commit 4906483
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[bumpversion]
current_version = 0.0.1
current_version = 0.0.2
commit = True
message = Bumps version to {new_version}
tag = False
tag_name = {new_version}

13 changes: 10 additions & 3 deletions security_hub_accepter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ def filter_none_values(data):


def assume_role(
session, role_arn, duration=3600, session_name=None, serial_number=None
session,
role_arn,
profile=None,
duration=3600,
session_name=None,
serial_number=None,
):
fetcher = botocore.credentials.AssumeRoleCredentialFetcher(
session.create_client,
Expand All @@ -74,7 +79,7 @@ def assume_role(
),
cache=botocore.credentials.JSONFileCache(),
)
role_session = botocore.session.Session()
role_session = botocore.session.Session(profile=profile)
role_session.register_component(
"credential_provider",
botocore.credentials.CredentialResolver([AssumeRoleProvider(fetcher)]),
Expand Down Expand Up @@ -106,8 +111,10 @@ def main(
role_arn = role_arn or None

session = botocore.session.Session(profile=profile)
session.set_default_client_config(botocore.client.Config(region_name=region))

if role_arn:
session = assume_role(session, role_arn)
session = assume_role(session, role_arn, profile=profile)

sechub = session.create_client("securityhub", region_name=region)

Expand Down

0 comments on commit 4906483

Please sign in to comment.