Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix logging bug #269

Merged
merged 4 commits into from
Oct 26, 2020
Merged

fix logging bug #269

merged 4 commits into from
Oct 26, 2020

Conversation

reetasingh
Copy link
Contributor

@reetasingh reetasingh commented Oct 24, 2020

What does this PR do?

  1. Address Fix logging across modules #268
  2. Remove click_log lib

What gif best describes this PR or how it makes you feel?

ALT

Completion checklist

@reetasingh reetasingh marked this pull request as draft October 24, 2020 19:30
@reetasingh reetasingh added the bug Something isn't working label Oct 24, 2020
@reetasingh
Copy link
Contributor Author

logging is now working with -v flag

reetasingh-ltm8:policy_sentry reetasingh$ policy_sentry write-policy --input-file examples/yml/crud-with-wildcard.yml --minimize 0 -v debug
2020-10-24 13:14:25,676 policy_sentry.writing.sid_group [DEBUG] CRUD mode selected
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Requested wildcard-only actions: ['ram:enablesharingwithawsorganization', 'ram:getresourcepolicies', 'secretsmanager:putsecretvalue']
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Attempting to add the following actions to the policy: ['ram:enablesharingwithawsorganization', 'ram:getresourcepolicies']
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Adding by list of actions
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Supplied actions: ['ram:enablesharingwithawsorganization', 'ram:getresourcepolicies']
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Dependent actions: []
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Purging actions that do not match the requested actions and dependent actions
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Supplied actions: ['ram:enablesharingwithawsorganization', 'ram:getresourcepolicies']
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Dependent actions: []
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Actions deleted: []
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Deliberately adding the action ram:EnableSharingWithAwsOrganization without resource constraints
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Deliberately adding the action ram:GetResourcePolicies without resource constraints
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Removing actions that are in the wildcard arn (Resources = '*') as well as other statements that have resource constraints 
2020-10-24 13:14:25,677 policy_sentry.writing.sid_group [DEBUG] Getting the rendered policy
2020-10-24 13:14:25,681 policy_sentry.writing.sid_group [DEBUG] Adding statement with SID MultMultNone
2020-10-24 13:14:25,681 policy_sentry.writing.sid_group [DEBUG] MultMultNone SID has the actions: ['ram:EnableSharingWithAwsOrganization', 'ram:GetResourcePolicies']
2020-10-24 13:14:25,681 policy_sentry.writing.sid_group [DEBUG] MultMultNone SID has the resources: ['*']
2020-10-24 13:14:25,681 policy_sentry.writing.sid_group [DEBUG] Added the following wildcard-only actions to the policy: ['ram:enablesharingwithawsorganization', 'ram:getresourcepolicies']
2020-10-24 13:14:25,681 policy_sentry.writing.sid_group [DEBUG] Requested access to arns: ['arn:aws:s3:::example-org-s3-access-logs']
2020-10-24 13:14:25,682 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,682 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,683 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,684 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,685 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,686 policy_sentry.util.arns [DEBUG] Special type: ${BucketName}
2020-10-24 13:14:25,687 policy_sentry.writing.sid_group [DEBUG] Minimizing statements...
2020-10-24 13:14:25,854 policy_sentry.writing.sid_group [DEBUG] Adding statement with SID MultMultNone
2020-10-24 13:14:25,854 policy_sentry.writing.sid_group [DEBUG] MultMultNone SID has the actions: ['ram:e*', 'ram:getresourcep*']
2020-10-24 13:14:25,854 policy_sentry.writing.sid_group [DEBUG] MultMultNone SID has the resources: ['*']
2020-10-24 13:14:25,854 policy_sentry.writing.sid_group [DEBUG] Minimizing statements...
2020-10-24 13:14:26,005 policy_sentry.writing.sid_group [DEBUG] Adding statement with SID S3PermissionsmanagementBucket
2020-10-24 13:14:26,005 policy_sentry.writing.sid_group [DEBUG] S3PermissionsmanagementBucket SID has the actions: ['s3:deletebucketp*', 's3:putbucketa*', 's3:putbucketp*']
2020-10-24 13:14:26,005 policy_sentry.writing.sid_group [DEBUG] S3PermissionsmanagementBucket SID has the resources: ['arn:aws:s3:::example-org-s3-access-logs']
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "MultMultNone",
            "Effect": "Allow",
            "Action": [
                "ram:e*",
                "ram:getresourcep*"
            ],
            "Resource": [
                "*"
            ]

@reetasingh reetasingh marked this pull request as ready for review October 24, 2020 20:20
@reetasingh
Copy link
Contributor Author

reetasingh-ltm8:policy_sentry reetasingh$ policy_sentry initialize --fetch -v debug
Creating the database...
2020-10-24 13:44:05,937 policy_sentry.command.initialize [DEBUG] We will store the new database here: /usr/local/lib/python3.8/site-packages/policy_sentry/shared/data/iam-definition.json
2020-10-24 13:44:05,937 policy_sentry.command.initialize [DEBUG] /usr/local/lib/python3.8/site-packages/policy_sentry/shared/data/docs
2020-10-24 13:44:06,059 policy_sentry.command.initialize [DEBUG] copying overrides file access-level-overrides.yml to /Users/reetasingh/.policy_sentry
2020-10-24 13:44:06,059 policy_sentry.command.initialize [DEBUG] copying overrides file overrides-resource-policies.yml to /Users/reetasingh/.policy_sentry
Database will be stored here: /Use

@reetasingh reetasingh closed this Oct 24, 2020
@reetasingh reetasingh reopened this Oct 24, 2020
@reetasingh reetasingh marked this pull request as draft October 24, 2020 21:30
@reetasingh
Copy link
Contributor Author

reetasingh-ltm8:policy_sentry reetasingh$ policy_sentry initialize --fetch -v info
Creating the database...
Database will be stored here: /Users/reetasingh/.policy_sentry/iam-definition.json
2020-10-24 14:32:40,509 policy_sentry.shared.awsdocs [INFO] list_awsaccounts.html downloaded
2020-10-24 14:32:40,999 policy_sentry.shared.awsdocs [INFO] list_alexaforbusiness.html downloaded
2020-10-24 14:32:41,455 policy_sentry.shared.awsdocs [INFO] list_awsamplify.html downloaded
2020-10-24 14:32:41,863 policy_sentry.shared.awsdocs [INFO] list_amazonapigateway.html downloaded
2020-10-24 14:32:42,338 policy_sentry.shared.awsdocs [INFO] list_awsappmesh.html downloaded
2020-10-24 14:32:42,798 policy_sentry.shared.awsdocs [INFO] list_awsappmeshpreview.html downloaded
2020-10-24 14:32:43,279 policy_sentry.shared.awsdocs [INFO] list_awsappconfig.html downloaded
^Z

@reetasingh reetasingh marked this pull request as ready for review October 24, 2020 22:27
@reetasingh
Copy link
Contributor Author

@kmcquade please review

@reetasingh reetasingh changed the title fix logging fix logging bug Oct 24, 2020
@kmcquade kmcquade merged commit 5eae1a0 into salesforce:master Oct 26, 2020
saikirankv pushed a commit to saikirankv/policy_sentry that referenced this pull request Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla:signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants