{"platform":{"name":"aws","release":"train-aws: v0.1.16, aws-sdk-core: v3.98.0"},"profiles":[{"name":"cis-aws-foundations-baseline","version":"1.0.5","sha256":"832a2a1148f7f7203c9187028d984ca0cf7da23785e63dfc7c9f92bf55f3875d","title":"cis-aws-foundations-baseline","maintainer":"MITRE InSpec Team","summary":"InSpec Profile to validate the CIS AWS Foundations Benchmark v1.1.0","license":"Apache-2.0","copyright":"MITRE, 2018","copyright_email":"inspec@mitre.org","supports":[{"platform":"aws"}],"attributes":[{"name":"default_aws_region","options":{"value":"us-east-1"}},{"name":"aws_key_age","options":{"type":"Numeric","value":90}},{"name":"pwd_length","options":{"type":"Numeric","value":14}},{"name":"aws_cred_age","options":{"type":"Numeric","value":90}},{"name":"iam_manager_role_name","options":{"type":"String","value":"iam-manager-role-name"}},{"name":"iam_master_role_name","options":{"type":"String","value":"iam-master-role-name"}},{"name":"iam_manager_user_name","options":{"type":"String","value":"iam-manager-user-name"}},{"name":"iam_master_user_name","options":{"type":"String","value":"iam-master-user-name"}},{"name":"iam_manager_policy_name","options":{"type":"String","value":"iam-manager-policy"}},{"name":"iam_master_policy_name","options":{"type":"String","value":"iam-master-policy"}},{"name":"exception_bucket_list","options":{"type":"Array","value":["exception_bucket_name"]}},{"name":"config_delivery_channels","options":{"type":"Hash","value":{"us-east-1":{"s3_bucket_name":"s3_bucket_name_value","sns_topic_arn":"sns_topic_arn_value"},"us-east-2":{"s3_bucket_name":"s3_bucket_name_value","sns_topic_arn":"sns_topic_arn_value"},"us-west-1":{"s3_bucket_name":"s3_bucket_name_value","sns_topic_arn":"sns_topic_arn_value"},"us-west-2":{"s3_bucket_name":"s3_bucket_name_value","sns_topic_arn":"sns_topic_arn_value"}}}},{"name":"sns_topics","options":{"type":"Hash","value":{"topic_arn1":{"owner":"owner_value","region":"region_value"},"topic_arn2":{"owner":"owner_value","region":"region_value"}}}},{"name":"sns_subscriptions","options":{"type":"Hash","value":{"subscription_arn1":{"endpoint":"endpoint_value","owner":"owner_value","protocol":"protocol_value"},"subscription_arn2":{"endpoint":"endpoint_value","owner":"owner_value","protocol":"protocol_value"}}}},{"name":"exception_security_group_list","options":{"type":"Array","value":["exception_security_group_name"]}},{"name":"service_account_mfa_exceptions","options":{"type":"Array","value":["service_account_mfa_exceptions"]}}],"depends":[{"name":"inspec-aws","git":"git@github.com:inspec/inspec-aws.git"}],"groups":[{"id":"controls/cis-aws-foundations-1.14.rb","controls":["cis-aws-foundations-1.14"]},{"id":"controls/cis-aws-foundations-1.23.rb","controls":["cis-aws-foundations-1.23"]},{"id":"controls/cis-aws-foundations-4.2.rb","controls":["cis-aws-foundations-4.2"]},{"id":"controls/cis-aws-foundations-1.18.rb","controls":["cis-aws-foundations-1.18"]},{"id":"controls/cis-aws-foundations-1.5.rb","controls":["cis-aws-foundations-1.5"]},{"id":"controls/cis-aws-foundations-1.21.rb","controls":["cis-aws-foundations-1.21"]},{"id":"controls/cis-aws-foundations-2.3.rb","controls":["cis-aws-foundations-2.3"]},{"id":"controls/cis-aws-foundations-1.24.rb","controls":["cis-aws-foundations-1.24"]},{"id":"controls/cis-aws-foundations-1.11.rb","controls":["cis-aws-foundations-1.11"]},{"id":"controls/cis-aws-foundations-2.7.rb","controls":["cis-aws-foundations-2.7"]},{"id":"controls/cis-aws-foundations-1.20.rb","controls":["cis-aws-foundations-1.20"]},{"id":"controls/cis-aws-foundations-1.12.rb","controls":["cis-aws-foundations-1.12"]},{"id":"controls/cis-aws-foundations-1.8.rb","controls":["cis-aws-foundations-1.8"]},{"id":"controls/cis-aws-foundations-2.4.rb","controls":["cis-aws-foundations-2.4"]},{"id":"controls/cis-aws-foundations-4.3.rb","controls":["cis-aws-foundations-4.3"]},{"id":"controls/cis-aws-foundations-2.2.rb","controls":["cis-aws-foundations-2.2"]},{"id":"controls/cis-aws-foundations-2.8.rb","controls":["cis-aws-foundations-2.8"]},{"id":"controls/cis-aws-foundations-1.13.rb","controls":["cis-aws-foundations-1.13"]},{"id":"controls/cis-aws-foundations-1.10.rb","controls":["cis-aws-foundations-1.10"]},{"id":"controls/cis-aws-foundations-4.1.rb","controls":["cis-aws-foundations-4.1"]},{"id":"controls/cis-aws-foundations-1.2.rb","controls":["cis-aws-foundations-1.2"]},{"id":"controls/cis-aws-foundations-2.6.rb","controls":["cis-aws-foundations-2.6"]},{"id":"controls/cis-aws-foundations-4.4.rb","controls":["cis-aws-foundations-4.4"]},{"id":"controls/cis-aws-foundations-1.15.rb","controls":["cis-aws-foundations-1.15"]},{"id":"controls/cis-aws-foundations-4.5.rb","controls":["cis-aws-foundations-4.5"]},{"id":"controls/cis-aws-foundations-1.3.rb","controls":["cis-aws-foundations-1.3"]},{"id":"controls/cis-aws-foundations-1.4.rb","controls":["cis-aws-foundations-1.4"]},{"id":"controls/cis-aws-foundations-1.17.rb","controls":["cis-aws-foundations-1.17"]},{"id":"controls/cis-aws-foundations-1.19.rb","controls":["cis-aws-foundations-1.19"]},{"id":"controls/cis-aws-foundations-1.7.rb","controls":["cis-aws-foundations-1.7"]},{"id":"controls/cis-aws-foundations-1.22.rb","controls":["cis-aws-foundations-1.22"]},{"id":"controls/cis-aws-foundations-2.1.rb","controls":["cis-aws-foundations-2.1"]},{"id":"controls/cis-aws-foundations-1.9.rb","controls":["cis-aws-foundations-1.9"]},{"id":"controls/cis-aws-foundations-2.5.rb","controls":["cis-aws-foundations-2.5"]},{"id":"controls/cis-aws-foundations-1.16.rb","controls":["cis-aws-foundations-1.16"]},{"id":"controls/cis-aws-foundations-1.6.rb","controls":["cis-aws-foundations-1.6"]}],"controls":[{"id":"cis-aws-foundations-1.14","title":"Ensure hardware MFA is enabled for the 'root' account","desc":"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device. For Level 2, it is recommended that the root account be\nprotected with a hardware MFA.","descriptions":[{"label":"default","data":"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device. For Level 2, it is recommended that the root account be\nprotected with a hardware MFA."}],"impact":0.7,"refs":[],"tags":{"rationale":"A hardware MFA has a smaller attack surface than a virtual\nMFA. For example, a hardware MFA does not suffer the attack surface introduced\nby the mobile smartphone on which a virtual MFA resides.\n\n'NOTE: Using hardware MFA for many, many AWS accounts may create a logistical\ndevice management issue. If this is the case, consider implementing this Level\n2 recommendation selectively to the highest security AWS accounts and the Level\n1 recommendation applied to the remaining accounts.\n\n'Link to order AWS compatible hardware MFA device:\nhttp://onlinenoram.gemalto.com/ [http://onlinenoram.gemalto.com/]","cis_impact":"","cis_rid":"1.14","cis_level":2,"csc_control":[["5.6","11.4","12.6","16.11"],"6.0"],"nist":["IA-2(1)","SC-23","Rev_4"],"cce_id":"CCE-78911-5","check":"Perform the following to determine if the root account has a\nhardware MFA setup:\n\n\n* Run the following command to list all virtual MFA devices:\n\n'aws iam list-virtual-mfa-devices\n* If the output contains one MFA with the following Serial Number, it means the\nMFA is virtual, not hardware and the account is not compliant with this\nrecommendation:\n\n' 'SerialNumber':\n'arn:aws:iam::_<aws_account_number>_:mfa/root-account-mfa-device'\n","fix":"Perform the following to establish a hardware MFA for the root\naccount:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].<div\nclass='aws-note'>\n\n'Note: to manage MFA devices for the root AWS account, you must use your root\naccount credentials to sign in to AWS. You cannot manage MFA devices for the\nroot account using other credentials.\n\n\n 'Choose Dashboard, and under Security Status, expand Activate MFA on your root\naccount.\n\n 'Choose Activate MFA\n\n 'In the wizard, choose A hardware MFA device and then choose Next Step.\n\n 'In the Serial Number box, enter the serial number that is found on the back of\nthe MFA device.\n\n 'In the Authentication Code 1 box, enter the six-digit number displayed by the\nMFA device. You might need to press the button on the front of the device to\ndisplay the number.\n\n 'Wait 30 seconds while the device refreshes the code, and then enter the next\nsix-digit number into the Authentication Code 2 box. You might need to press\nthe button on the front of the device again to display the second number.\n\n 'Choose Next Step. The MFA device is now associated with the AWS account. The\nnext time you use your AWS account credentials to sign in, you must type a code\nfrom the hardware MFA device.\n"},"code":"control 'cis-aws-foundations-1.14' do\n  title \"Ensure hardware MFA is enabled for the 'root' account\"\n  desc  \"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device. For Level 2, it is recommended that the root account be\nprotected with a hardware MFA.\"\n  impact 0.7\n  tag \"rationale\": \"A hardware MFA has a smaller attack surface than a virtual\nMFA. For example, a hardware MFA does not suffer the attack surface introduced\nby the mobile smartphone on which a virtual MFA resides.\n\n'NOTE: Using hardware MFA for many, many AWS accounts may create a logistical\ndevice management issue. If this is the case, consider implementing this Level\n2 recommendation selectively to the highest security AWS accounts and the Level\n1 recommendation applied to the remaining accounts.\n\n'Link to order AWS compatible hardware MFA device:\nhttp://onlinenoram.gemalto.com/ [http://onlinenoram.gemalto.com/]\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.14'\n  tag \"cis_level\": 2\n  tag \"csc_control\": [['5.6', '11.4', '12.6', '16.11'], '6.0']\n  tag \"nist\": ['IA-2(1)', 'SC-23', 'Rev_4']\n  tag \"cce_id\": 'CCE-78911-5'\n  tag \"check\": \"Perform the following to determine if the root account has a\nhardware MFA setup:\n\n\n* Run the following command to list all virtual MFA devices:\n\n'aws iam list-virtual-mfa-devices\n* If the output contains one MFA with the following Serial Number, it means the\nMFA is virtual, not hardware and the account is not compliant with this\nrecommendation:\n\n' 'SerialNumber':\n'arn:aws:iam::_<aws_account_number>_:mfa/root-account-mfa-device'\n\"\n  tag \"fix\": \"Perform the following to establish a hardware MFA for the root\naccount:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].<div\nclass='aws-note'>\n\n'Note: to manage MFA devices for the root AWS account, you must use your root\naccount credentials to sign in to AWS. You cannot manage MFA devices for the\nroot account using other credentials.\n\n\n 'Choose Dashboard, and under Security Status, expand Activate MFA on your root\naccount.\n\n 'Choose Activate MFA\n\n 'In the wizard, choose A hardware MFA device and then choose Next Step.\n\n 'In the Serial Number box, enter the serial number that is found on the back of\nthe MFA device.\n\n 'In the Authentication Code 1 box, enter the six-digit number displayed by the\nMFA device. You might need to press the button on the front of the device to\ndisplay the number.\n\n 'Wait 30 seconds while the device refreshes the code, and then enter the next\nsix-digit number into the Authentication Code 2 box. You might need to press\nthe button on the front of the device again to display the second number.\n\n 'Choose Next Step. The MFA device is now associated with the AWS account. The\nnext time you use your AWS account credentials to sign in, you must type a code\nfrom the hardware MFA device.\n\"\n\n  describe aws_iam_root_user do\n    it { should have_mfa_enabled }\n    it { should_not have_virtual_mfa_enabled }\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.14.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"AWS Root-User is expected to have mfa enabled","run_time":0.087599806,"start_time":"2020-06-19T14:44:07+00:00","message":"expected #has_mfa_enabled? to return true, got false"},{"status":"passed","code_desc":"AWS Root-User is expected not to have virtual mfa enabled","run_time":0.037886695,"start_time":"2020-06-19T14:44:07+00:00"}]},{"id":"cis-aws-foundations-1.23","title":"Do not setup access keys during initial user setup for all IAM users\nthat have a console password","desc":"AWS console defaults the checkbox for creating access keys to enabled.\nThis results in many access keys being generated unnecessarily. In addition to\nunnecessary credentials, it also generates unnecessary management work in\nauditing and rotating these keys.","descriptions":[{"label":"default","data":"AWS console defaults the checkbox for creating access keys to enabled.\nThis results in many access keys being generated unnecessarily. In addition to\nunnecessary credentials, it also generates unnecessary management work in\nauditing and rotating these keys."}],"impact":0.3,"refs":[],"tags":{"rationale":"Requiring that additional steps be taken by the user after\ntheir profile has been created will give a stronger indication of intent that\naccess keys are [a] necessary for their work and [b] once the access key is\nestablished on an account, that the keys may be in use somewhere in the\norganization.\n\n'NOTE: Even if it is known the user will need access keys, require them to\ncreate the keys themselves or put in a support ticket to have the created as a\nseparate step from user creation.","cis_impact":"","cis_rid":"1.23","cis_level":1,"csc_control":"","nist":["AC-6","Rev_4"],"cce_id":"","check":"Perform the following to determine if access keys are rotated\nas prescribed:\n\n* Login to the AWS Management Console\n* ClickServices\n* ClickIAM\n* Click onA User\n* Compare the user creation date to the key 1 creation date.\n* For any that match, the key was created during initial user setup.\n\n * Keys that were created at the same time as the user profile and do not have a\nlast used date should be deleted.\n\n' Via the CLI\n\n\n* Run the following command (OSX/Linux/UNIX) to generate a list of all IAM\nusers along with their access keys utilization:\n\n'aws iam generate-credential-report\n\n'aws iam get-credential-report --query 'Content' --output text | base64 -d |\ncut -d, -f1,4,9,11,14,16\n\n* The output of this command will produce a table similar to the following:\n\n'user,password_enabled,access_key_1_active,access_key_1_last_used_date,access_key_2_active,access_key_2_last_used_date\n\nelise,false,true,2015-04-16T15:14:00+00:00,false,N/A\nbrandon,true,true,N/A,false,N/A\nrakesh,false,false,N/A,false,N/A\nhelene,false,true,2015-11-18T17:47:00+00:00,false,N/A\nparas,true,true,2016-08-28T12:04:00+00:00,true,2016-03-04T10:11:00+00:00\nanitha,true,true,2016-06-08T11:43:00+00:00,true,N/A\n* For any user having access_key_last_used_date set to N/A, ensure that access\nkey is deleted.\n\n\n","fix":"Perform the following to delete access keys that do not pass the\naudit:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Delete for keys that were created at the same time as the user\nprofile but have not been used.\n\n* As an IAM User\n\n* Click on Delete for keys that were created at the same time as the user\nprofile but have not been used.\n\n'Via CLI\n\n'aws iam delete-access-key"},"code":"control 'cis-aws-foundations-1.23' do\n  title \"Do not setup access keys during initial user setup for all IAM users\nthat have a console password\"\n  desc  \"AWS console defaults the checkbox for creating access keys to enabled.\nThis results in many access keys being generated unnecessarily. In addition to\nunnecessary credentials, it also generates unnecessary management work in\nauditing and rotating these keys.\"\n  impact 0.3\n  tag \"rationale\": \"Requiring that additional steps be taken by the user after\ntheir profile has been created will give a stronger indication of intent that\naccess keys are [a] necessary for their work and [b] once the access key is\nestablished on an account, that the keys may be in use somewhere in the\norganization.\n\n'NOTE: Even if it is known the user will need access keys, require them to\ncreate the keys themselves or put in a support ticket to have the created as a\nseparate step from user creation.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.23'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['AC-6', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Perform the following to determine if access keys are rotated\nas prescribed:\n\n* Login to the AWS Management Console\n* ClickServices\n* ClickIAM\n* Click onA User\n* Compare the user creation date to the key 1 creation date.\n* For any that match, the key was created during initial user setup.\n\n * Keys that were created at the same time as the user profile and do not have a\nlast used date should be deleted.\n\n' Via the CLI\n\n\n* Run the following command (OSX/Linux/UNIX) to generate a list of all IAM\nusers along with their access keys utilization:\n\n'aws iam generate-credential-report\n\n'aws iam get-credential-report --query 'Content' --output text | base64 -d |\ncut -d, -f1,4,9,11,14,16\n\n* The output of this command will produce a table similar to the following:\n\n'user,password_enabled,access_key_1_active,access_key_1_last_used_date,access_key_2_active,access_key_2_last_used_date\n\nelise,false,true,2015-04-16T15:14:00+00:00,false,N/A\nbrandon,true,true,N/A,false,N/A\nrakesh,false,false,N/A,false,N/A\nhelene,false,true,2015-11-18T17:47:00+00:00,false,N/A\nparas,true,true,2016-08-28T12:04:00+00:00,true,2016-03-04T10:11:00+00:00\nanitha,true,true,2016-06-08T11:43:00+00:00,true,N/A\n* For any user having access_key_last_used_date set to N/A, ensure that access\nkey is deleted.\n\n\n\"\n  tag \"fix\": \"Perform the following to delete access keys that do not pass the\naudit:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Delete for keys that were created at the same time as the user\nprofile but have not been used.\n\n* As an IAM User\n\n* Click on Delete for keys that were created at the same time as the user\nprofile but have not been used.\n\n'Via CLI\n\n'aws iam delete-access-key\"\n\n  aws_iam_access_keys.entries.each do |key|\n    describe key.username do\n      context key do\n        its('last_used_days_ago') { should_not be_nil }\n      end\n    end\n  end\n\n  if aws_iam_access_keys.entries.empty?\n    describe 'Control skipped because no iam access keys were found' do\n      skip 'This control is skipped since the aws_iam_access_keys resource returned an empty access key list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.23.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"test-one IAM Access Keys with one entry last_used_days_ago is expected not to be nil","run_time":0.002100839,"start_time":"2020-06-19T14:44:07+00:00"}]},{"id":"cis-aws-foundations-4.2","title":"Ensure no security groups allow ingress from 0.0.0.0/0 to port 3389","desc":"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 3389.","descriptions":[{"label":"default","data":"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 3389."}],"impact":0.3,"refs":[],"tags":{"rationale":"Removing unfettered connectivity to remote console\nservices, such as RDP, reduces a server's exposure to risk.","cis_impact":"For updating an existing environment, care should be taken\nto ensure that administrators currently relying on an existing ingress from\n0.0.0.0/0 have access to ports 22 and/or 3389 through another security group.","cis_rid":"4.2","cis_level":1,"cis_control_number":"","nist":["SC-7(5)","Rev_4"],"cce_id":"","check":"Perform the following to determine if the account is configured\nas prescribed:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Ensure no rule exists that has a port range that includes port 3389 and has a\nSource of 0.0.0.0/0\n\nNote: A Port value of ALL or a port range such as 1024-4098 are inclusive of\nport 3389.\n","fix":"Perform the following to implement the prescribed state:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Identify the rules to be removed\n* Click the x in the Remove column\n* Click Save"},"code":"control 'cis-aws-foundations-4.2' do\n  title 'Ensure no security groups allow ingress from 0.0.0.0/0 to port 3389'\n  desc  \"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 3389.\"\n  impact 0.3\n  tag \"rationale\": \"Removing unfettered connectivity to remote console\nservices, such as RDP, reduces a server's exposure to risk.\"\n  tag \"cis_impact\": \"For updating an existing environment, care should be taken\nto ensure that administrators currently relying on an existing ingress from\n0.0.0.0/0 have access to ports 22 and/or 3389 through another security group.\"\n  tag \"cis_rid\": '4.2'\n  tag \"cis_level\": 1\n  tag \"cis_control_number\": ''\n  tag \"nist\": ['SC-7(5)', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Perform the following to determine if the account is configured\nas prescribed:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Ensure no rule exists that has a port range that includes port 3389 and has a\nSource of 0.0.0.0/0\n\nNote: A Port value of ALL or a port range such as 1024-4098 are inclusive of\nport 3389.\n\"\n  tag \"fix\": \"Perform the following to implement the prescribed state:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Identify the rules to be removed\n* Click the x in the Remove column\n* Click Save\"\n\n  aws_security_groups.group_ids.each do |group_id|\n    if exception_security_group_list.include?(group_id)\n      describe 'Security Group not inspected because it is defined as an exception' do\n        skip \"Security Group:: #{group_id} not inspected because it is defined in exception_security_group_list.\"\n      end\n    end\n\n    next if exception_security_group_list.include?(group_id)\n\n    describe aws_security_group(group_id) do\n      it { should_not allow_in(port: 3389, ipv4_range: '0.0.0.0/0') }\n    end\n  end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-4.2.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"EC2 Security Group sg-0445e37d is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>3389}","run_time":0.013218742,"start_time":"2020-06-19T14:44:07+00:00"},{"status":"failed","code_desc":"EC2 Security Group sg-096195c1021874188 is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>3389}","run_time":0.003579065,"start_time":"2020-06-19T14:44:07+00:00","message":"expected `EC2 Security Group sg-096195c1021874188.allow_in?({:ipv4_range=>\"0.0.0.0/0\", :port=>3389})` to return false, got true"},{"status":"passed","code_desc":"EC2 Security Group sg-0f4cc17ad346000a8 is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>3389}","run_time":0.003416562,"start_time":"2020-06-19T14:44:07+00:00"}]},{"id":"cis-aws-foundations-1.18","title":"Ensure IAM Master and IAM Manager roles are active","desc":"Ensure IAM Master and IAM Manager roles are in place for IAM\nadministration and assignment of administrative permissions for other services\nto other roles.\n\n'An IAM role is conceptually 'a container of permissions resembling a user\naccount which cannot be directly logged into, but which must instead be assumed\nfrom an existing user account which has appropriate permissions to do so', in\nthe manner of roles in Unix Role-Based Access Control (RBAC). In AWS, roles can\nalso be assigned to EC2 instances and Lambda functions.\n\nControl over IAM, which is also defined and mediated by a number of\nfine-grained permissions, should be divided between a number of roles, such\nthat no individual user in a production account has full control over IAM.","descriptions":[{"label":"default","data":"Ensure IAM Master and IAM Manager roles are in place for IAM\nadministration and assignment of administrative permissions for other services\nto other roles.\n\n'An IAM role is conceptually 'a container of permissions resembling a user\naccount which cannot be directly logged into, but which must instead be assumed\nfrom an existing user account which has appropriate permissions to do so', in\nthe manner of roles in Unix Role-Based Access Control (RBAC). In AWS, roles can\nalso be assigned to EC2 instances and Lambda functions.\n\nControl over IAM, which is also defined and mediated by a number of\nfine-grained permissions, should be divided between a number of roles, such\nthat no individual user in a production account has full control over IAM."}],"impact":0.3,"refs":[],"tags":{"rationale":"IAM is the principal point of control for service\nconfiguration access, and 'control over IAM' means 'control over the\nconfiguration of all other assets in the AWS account'. Therefore it is\nrecommended that control of this degree of security criticality should be\ndivided among multiple individuals within an organisation, in a manner such\nthat no individual retains enough control over IAM to 'rewrite themselves to\nroot'.\n\nRoles are recommended for security-sensitive capabilities, as the act of\nassuming a role generates a set of ephemeral credentials using the Security\nToken Service (STS) and these credentials - being a token, an AWS Access Key\nand an AWS Secret Access Key - are needed to make API calls in the context of\nthe role. STS credentials expire after a configurable period (default 12 hours,\nminimum 15 minutes, maximum 36 hours), and this reduces the risk of engineers\nhard-wiring these keys into code, and therefore further reduces the risk of the\nkeys being mishandled.\n\nThe current recommendation is to divide account and permission configuration\npermissions between 2 roles, which are:\n\nIAM Master: creates users, groups and roles; assigns permissions to roles\nIAM Manager: assigns users and roles to groups\n\nIn this model, IAM Master and IAM Manager must work together in a 2-person rule\nmanner, in order for a user to gain access to a permission.","cis_impact":"","cis_rid":"1.18","cis_level":1,"csc_control":"","nist":["AC-6(7)","Rev_4"],"cce_id":"","check":"Using the Amazon unified CLI, from a user or role which has the\niam:ListRoles and iam:GetRolePolicy permissions:\n\nList the configured roles:\n\n'aws iam list-roles --query 'Roles[*].{RoleName:RoleName, Arn:Arn}'\n\n'The output should contain entries with 'RoleName': '_<iam_manager_role_name>_'\nand 'Rolename': '_<iam_master_role_name>_'\n\nExamine the permissions associated with each of these roles:\n\n'aws iam get-role-policy --role-name _<iam_manager_role_name>_\n\n'aws iam get-role-policy --role-name _<iam_master_role_name>_\n\nThe _<iam_master_role_name>_ role should include the following Actions with an\nAllow effect:\n\niam:AttachRolePolicy\niam:CreateGroup\niam:CreatePolicy\niam:CreatePolicyVersion\niam:CreateRole\niam:CreateUser\niam:DeleteGroup\niam:DeletePolicy\niam:DeletePolicyVersion\niam:DeleteRole\niam:DeleteRolePolicy\niam:DeleteUser\niam:PutRolePolicy\niam:GetPolicy\niam:GetPolicyVersion\niam:GetRole\niam:GetRolePolicy\niam:GetUser\niam:GetUserPolicy\niam:ListEntitiesForPolicy\niam:ListGroupPolicies\niam:ListGroups\niam:ListGroupsForUser\niam:ListPolicies\niam:ListPoliciesGrantingServiceAccess\niam:ListPolicyVersions\niam:ListRolePolicies\niam:ListAttachedGroupPolicies\niam:ListAttachedRolePolicies\niam:ListAttachedUserPolicies\niam:ListRoles\niam:ListUsers\n\nand the following Actions with a Deny effect:\n\niam:AddUserToGroup\niam:AttachGroupPolicy\niam:DeleteGroupPolicy\niam:DeleteUserPolicy\niam:DetachGroupPolicy\niam:DetachRolePolicy\niam:DetachUserPolicy\niam:PutGroupPolicy\niam:PutUserPolicy\niam:RemoveUserFromGroup\niam:UpdateGroup\niam:UpdateAssumeRolePolicy\niam:UpdateUser\n\nThe _<iam_manager_role_name>_ role should include the following Actions with an\nAllow effect:\n\niam:AddUserToGroup\niam:AttachGroupPolicy\niam:DeleteGroupPolicy\niam:DeleteUserPolicy\niam:DetachGroupPolicy\niam:DetachRolePolicy\niam:DetachUserPolicy\niam:PutGroupPolicy\niam:PutUserPolicy\niam:RemoveUserFromGroup\niam:UpdateGroup\niam:UpdateAssumeRolePolicy\niam:UpdateUser\niam:GetPolicy\niam:GetPolicyVersion\niam:GetRole\niam:GetRolePolicy\niam:GetUser\niam:GetUserPolicy\niam:ListEntitiesForPolicy\niam:ListGroupPolicies\niam:ListGroups\niam:ListGroupsForUser\niam:ListPolicies\niam:ListPoliciesGrantingServiceAccess\niam:ListPolicyVersions\niam:ListRolePolicies\niam:ListAttachedGroupPolicies\niam:ListAttachedRolePolicies\niam:ListAttachedUserPolicies\niam:ListRoles\niam:ListUsers\n\nand the following Actions with a Deny effect:\n\niam: AttachRolePolicy\niam:CreateGroup\niam:CreatePolicy\niam:CreatePolicyVersion\niam:CreateRole\niam:CreateUser\niam:DeleteGroup\niam:DeletePolicy\niam:DeletePolicyVersion\niam:DeleteRole\niam:DeleteRolePolicy\niam:DeleteUser\niam:PutRolePolicy\n\nOther iam:* Actions may be included in these policies as needed.\n\nBoth policies should also be limited by a Condition that MFA authentication is\nin effect, by containing:\n\n'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\nin the Allow effect section (provided IAM Federation has not been configured).\n\n\nEach role needs to be assumable by at least one user or group:\n\n'aws iam get-role --role-name _<iam_manager_role_name>_\n\n'aws iam get-role --role-name _<iam_master_role_name>_\n\n'should display the AssumeRolePolicyDocument indicating which users and groups\nare able to assume the roles. No user or group should be able to assume both\nroles.","fix":"Using the Amazon unified CLI, from a user or role which has the\niam:CreateRole, iam:CreatePolicy and iam:PutRolePolicy permissions:\n\n'aws iam create-role --role-name _<iam_manager_role_name>_\n\n'aws iam create-role --role-name _<iam_master_role_name>_\n\n'aws iam put-role-policy --role-name _<iam_manager_role_name>_ --policy-name\n_<iam_manager_permissions_policy>_ --policy-document\n<a>file://IAM-Manager-policy.json</a>\n\n'aws iam put-role-policy --role-name _<iam_master_role_name>_ --policy-name\n_<iam_master_permissions_policy>_ --policy-document\n<a>file://IAM-Master-policy.json</a>\n\n'where IAM-Master-policy.json contains:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': [{\n\n' 'Action': [\n\n' 'iam:CreateGroup',\n\n''iam:CreatePolicy',\n\n''iam:CreatePolicyVersion',\n\n''iam:CreateRole',\n\n''iam:CreateUser',\n\n''iam:DeleteGroup',\n\n''iam:DeletePolicy',\n\n''iam:DeletePolicyVersion',\n\n''iam:DeleteRole',\n\n''iam:DeleteRolePolicy',\n\n''iam:DeleteUser',\n\n''iam:PutRolePolicy',\n\n''iam:GetPolicy',\n\n''iam:GetPolicyVersion',\n\n''iam:GetRole',\n\n''iam:GetRolePolicy',\n\n''iam:GetUser',\n\n''iam:GetUserPolicy',\n\n''iam:ListEntitiesForPolicy',\n\n''iam:ListGroupPolicies',\n\n''iam:ListGroups',\n\n''iam:ListGroupsForUser',\n\n''iam:ListPolicies',\n\n''iam:ListPoliciesGrantingServiceAccess',\n\n''iam:ListPolicyVersions',\n\n''iam:ListRolePolicies',\n\n''iam:ListAttachedGroupPolicies',\n\n''iam:ListAttachedRolePolicies',\n\n''iam:ListAttachedUserPolicies',\n\n''iam:ListRoles',\n\n''iam:ListUsers'\n\n' ],\n\n' 'Effect': 'Allow',\n\n' 'Resource': '*',\n\n' 'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\n' }],\n\n' 'Action': [\n\n''iam:AddUserToGroup',\n\n''iam:AttachGroupPolicy',\n\n''iam:DeleteGroupPolicy',\n\n''iam:DeleteUserPolicy',\n\n''iam:DetachGroupPolicy',\n\n''iam:DetachRolePolicy',\n\n''iam:DetachUserPolicy',\n\n''iam:PutGroupPolicy',\n\n''iam:PutUserPolicy',\n\n''iam:RemoveUserFromGroup',\n\n''iam:UpdateGroup',\n\n''iam:UpdateAssumeRolePolicy',\n\n''iam:UpdateUser'\n\n' ],\n\n' 'Effect': 'Deny',\n\n' 'Resource': '*'\n\n' }]\n\n'}\n\n'and where IAM-Manager-policy.json contains:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': [{\n\n' 'Action': [\n\n''iam:AddUserToGroup',\n\n''iam:AttachGroupPolicy',\n\n''iam:DeleteGroupPolicy',\n\n''iam:DeleteUserPolicy',\n\n''iam:DetachGroupPolicy',\n\n''iam:DetachRolePolicy',\n\n''iam:DetachUserPolicy',\n\n''iam:PutGroupPolicy',\n\n''iam:PutUserPolicy',\n\n''iam:RemoveUserFromGroup',\n\n''iam:UpdateGroup',\n\n''iam:UpdateAssumeRolePolicy',\n\n''iam:UpdateUser',\n\n''iam:GetPolicy',\n\n''iam:GetPolicyVersion',\n\n''iam:GetRole',\n\n''iam:GetRolePolicy',\n\n''iam:GetUser',\n\n''iam:GetUserPolicy',\n\n''iam:ListEntitiesForPolicy',\n\n''iam:ListGroupPolicies',\n\n''iam:ListGroups',\n\n''iam:ListGroupsForUser',\n\n''iam:ListPolicies',\n\n''iam:ListPoliciesGrantingServiceAccess',\n\n''iam:ListPolicyVersions',\n\n''iam:ListRolePolicies',\n\n''iam:ListAttachedGroupPolicies',\n\n''iam:ListAttachedRolePolicies',\n\n''iam:ListAttachedUserPolicies',\n\n''iam:ListRoles',\n\n''iam:ListUsers'\n\n' ],\n\n' 'Effect': 'Allow',\n\n' 'Resource': '*',\n\n' 'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\n' }],\n\n' 'Action': [\n\n' 'iam:CreateGroup',\n\n''iam:CreatePolicy',\n\n''iam:CreatePolicyVersion',\n\n''iam:CreateRole',\n\n''iam:CreateUser',\n\n''iam:DeleteGroup',\n\n''iam:DeletePolicy',\n\n''iam:DeletePolicyVersion',\n\n''iam:DeleteRole',\n\n''iam:DeleteRolePolicy',\n\n''iam:DeleteUser',\n\n''iam:PutRolePolicy'\n\n' ],\n\n' 'Effect': 'Deny',\n\n' 'Resource': '*'\n\n' }]\n\n'}\n\n'Note that each of IAM-Manager-policy.json and IAM-Master-policy.json can\ncontain other iam:* permissions in either Allow or Deny Action lists, depending\non what other requirements are in place in the account.\n\n'Each of these roles needs to be assumable by a different user or group.\n\n'For appropriate users or groups (groups are recommended):\n\n'aws iam put-user-policy --user-name _<iam_user>_ --policy-name\n_<assume_iam_master_role_policy>_ --policy-document\n<a>file://Assume-IAM-Master.json</a>\n\n'aws iam put-user-policy --user-name _<iam_user>_ --policy-name\n_<assume_iam_manager_role_policy>_ --policy-document\n<a>file://Assume-IAM-Manager.json</a>\n\n'or\n\n'aws iam put-group-policy --group-name _<iam_group>_  --policy-name\n_<assume_iam_master_role_policy>_ --policy-document\n<a>file://Assume-IAM-Master.json</a>\n\n'aws iam put-group-policy --group-name _<iam_group>_ --policy-name\n_<assume_iam_manager_role_policy> _--policy-document\n<a>file://Assume-IAM-Manager.json</a>\n\n'where Assume-IAM-Master.json is:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': {\n\n' 'Effect': 'Allow',\n\n' 'Action': 'sts:AssumeRole',\n\n' 'Resource': 'arn:aws:iam::_<aws_account_number>_:role/<iam_master_role_name>'\n\n\n' }\n\n'}\n\n'and Assume-IAM-Manager.json is:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': {\n\n' 'Effect': 'Allow',\n\n' 'Action': 'sts:AssumeRole',\n\n' 'Resource': 'arn:aws:iam::<aws_account_number>:role/<iam_manager_role_name>'\n\n\n' }\n\n'}"},"code":"control 'cis-aws-foundations-1.18' do\n  title 'Ensure IAM Master and IAM Manager roles are active'\n  desc  \"Ensure IAM Master and IAM Manager roles are in place for IAM\nadministration and assignment of administrative permissions for other services\nto other roles.\n\n'An IAM role is conceptually 'a container of permissions resembling a user\naccount which cannot be directly logged into, but which must instead be assumed\nfrom an existing user account which has appropriate permissions to do so', in\nthe manner of roles in Unix Role-Based Access Control (RBAC). In AWS, roles can\nalso be assigned to EC2 instances and Lambda functions.\n\nControl over IAM, which is also defined and mediated by a number of\nfine-grained permissions, should be divided between a number of roles, such\nthat no individual user in a production account has full control over IAM.\"\n  impact 0.3\n  tag \"rationale\": \"IAM is the principal point of control for service\nconfiguration access, and 'control over IAM' means 'control over the\nconfiguration of all other assets in the AWS account'. Therefore it is\nrecommended that control of this degree of security criticality should be\ndivided among multiple individuals within an organisation, in a manner such\nthat no individual retains enough control over IAM to 'rewrite themselves to\nroot'.\n\nRoles are recommended for security-sensitive capabilities, as the act of\nassuming a role generates a set of ephemeral credentials using the Security\nToken Service (STS) and these credentials - being a token, an AWS Access Key\nand an AWS Secret Access Key - are needed to make API calls in the context of\nthe role. STS credentials expire after a configurable period (default 12 hours,\nminimum 15 minutes, maximum 36 hours), and this reduces the risk of engineers\nhard-wiring these keys into code, and therefore further reduces the risk of the\nkeys being mishandled.\n\nThe current recommendation is to divide account and permission configuration\npermissions between 2 roles, which are:\n\nIAM Master: creates users, groups and roles; assigns permissions to roles\nIAM Manager: assigns users and roles to groups\n\nIn this model, IAM Master and IAM Manager must work together in a 2-person rule\nmanner, in order for a user to gain access to a permission.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.18'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['AC-6(7)', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Using the Amazon unified CLI, from a user or role which has the\niam:ListRoles and iam:GetRolePolicy permissions:\n\nList the configured roles:\n\n'aws iam list-roles --query 'Roles[*].{RoleName:RoleName, Arn:Arn}'\n\n'The output should contain entries with 'RoleName': '_<iam_manager_role_name>_'\nand 'Rolename': '_<iam_master_role_name>_'\n\nExamine the permissions associated with each of these roles:\n\n'aws iam get-role-policy --role-name _<iam_manager_role_name>_\n\n'aws iam get-role-policy --role-name _<iam_master_role_name>_\n\nThe _<iam_master_role_name>_ role should include the following Actions with an\nAllow effect:\n\niam:AttachRolePolicy\niam:CreateGroup\niam:CreatePolicy\niam:CreatePolicyVersion\niam:CreateRole\niam:CreateUser\niam:DeleteGroup\niam:DeletePolicy\niam:DeletePolicyVersion\niam:DeleteRole\niam:DeleteRolePolicy\niam:DeleteUser\niam:PutRolePolicy\niam:GetPolicy\niam:GetPolicyVersion\niam:GetRole\niam:GetRolePolicy\niam:GetUser\niam:GetUserPolicy\niam:ListEntitiesForPolicy\niam:ListGroupPolicies\niam:ListGroups\niam:ListGroupsForUser\niam:ListPolicies\niam:ListPoliciesGrantingServiceAccess\niam:ListPolicyVersions\niam:ListRolePolicies\niam:ListAttachedGroupPolicies\niam:ListAttachedRolePolicies\niam:ListAttachedUserPolicies\niam:ListRoles\niam:ListUsers\n\nand the following Actions with a Deny effect:\n\niam:AddUserToGroup\niam:AttachGroupPolicy\niam:DeleteGroupPolicy\niam:DeleteUserPolicy\niam:DetachGroupPolicy\niam:DetachRolePolicy\niam:DetachUserPolicy\niam:PutGroupPolicy\niam:PutUserPolicy\niam:RemoveUserFromGroup\niam:UpdateGroup\niam:UpdateAssumeRolePolicy\niam:UpdateUser\n\nThe _<iam_manager_role_name>_ role should include the following Actions with an\nAllow effect:\n\niam:AddUserToGroup\niam:AttachGroupPolicy\niam:DeleteGroupPolicy\niam:DeleteUserPolicy\niam:DetachGroupPolicy\niam:DetachRolePolicy\niam:DetachUserPolicy\niam:PutGroupPolicy\niam:PutUserPolicy\niam:RemoveUserFromGroup\niam:UpdateGroup\niam:UpdateAssumeRolePolicy\niam:UpdateUser\niam:GetPolicy\niam:GetPolicyVersion\niam:GetRole\niam:GetRolePolicy\niam:GetUser\niam:GetUserPolicy\niam:ListEntitiesForPolicy\niam:ListGroupPolicies\niam:ListGroups\niam:ListGroupsForUser\niam:ListPolicies\niam:ListPoliciesGrantingServiceAccess\niam:ListPolicyVersions\niam:ListRolePolicies\niam:ListAttachedGroupPolicies\niam:ListAttachedRolePolicies\niam:ListAttachedUserPolicies\niam:ListRoles\niam:ListUsers\n\nand the following Actions with a Deny effect:\n\niam: AttachRolePolicy\niam:CreateGroup\niam:CreatePolicy\niam:CreatePolicyVersion\niam:CreateRole\niam:CreateUser\niam:DeleteGroup\niam:DeletePolicy\niam:DeletePolicyVersion\niam:DeleteRole\niam:DeleteRolePolicy\niam:DeleteUser\niam:PutRolePolicy\n\nOther iam:* Actions may be included in these policies as needed.\n\nBoth policies should also be limited by a Condition that MFA authentication is\nin effect, by containing:\n\n'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\nin the Allow effect section (provided IAM Federation has not been configured).\n\n\nEach role needs to be assumable by at least one user or group:\n\n'aws iam get-role --role-name _<iam_manager_role_name>_\n\n'aws iam get-role --role-name _<iam_master_role_name>_\n\n'should display the AssumeRolePolicyDocument indicating which users and groups\nare able to assume the roles. No user or group should be able to assume both\nroles.\"\n  tag \"fix\": \"Using the Amazon unified CLI, from a user or role which has the\niam:CreateRole, iam:CreatePolicy and iam:PutRolePolicy permissions:\n\n'aws iam create-role --role-name _<iam_manager_role_name>_\n\n'aws iam create-role --role-name _<iam_master_role_name>_\n\n'aws iam put-role-policy --role-name _<iam_manager_role_name>_ --policy-name\n_<iam_manager_permissions_policy>_ --policy-document\n<a>file://IAM-Manager-policy.json</a>\n\n'aws iam put-role-policy --role-name _<iam_master_role_name>_ --policy-name\n_<iam_master_permissions_policy>_ --policy-document\n<a>file://IAM-Master-policy.json</a>\n\n'where IAM-Master-policy.json contains:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': [{\n\n' 'Action': [\n\n' 'iam:CreateGroup',\n\n''iam:CreatePolicy',\n\n''iam:CreatePolicyVersion',\n\n''iam:CreateRole',\n\n''iam:CreateUser',\n\n''iam:DeleteGroup',\n\n''iam:DeletePolicy',\n\n''iam:DeletePolicyVersion',\n\n''iam:DeleteRole',\n\n''iam:DeleteRolePolicy',\n\n''iam:DeleteUser',\n\n''iam:PutRolePolicy',\n\n''iam:GetPolicy',\n\n''iam:GetPolicyVersion',\n\n''iam:GetRole',\n\n''iam:GetRolePolicy',\n\n''iam:GetUser',\n\n''iam:GetUserPolicy',\n\n''iam:ListEntitiesForPolicy',\n\n''iam:ListGroupPolicies',\n\n''iam:ListGroups',\n\n''iam:ListGroupsForUser',\n\n''iam:ListPolicies',\n\n''iam:ListPoliciesGrantingServiceAccess',\n\n''iam:ListPolicyVersions',\n\n''iam:ListRolePolicies',\n\n''iam:ListAttachedGroupPolicies',\n\n''iam:ListAttachedRolePolicies',\n\n''iam:ListAttachedUserPolicies',\n\n''iam:ListRoles',\n\n''iam:ListUsers'\n\n' ],\n\n' 'Effect': 'Allow',\n\n' 'Resource': '*',\n\n' 'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\n' }],\n\n' 'Action': [\n\n''iam:AddUserToGroup',\n\n''iam:AttachGroupPolicy',\n\n''iam:DeleteGroupPolicy',\n\n''iam:DeleteUserPolicy',\n\n''iam:DetachGroupPolicy',\n\n''iam:DetachRolePolicy',\n\n''iam:DetachUserPolicy',\n\n''iam:PutGroupPolicy',\n\n''iam:PutUserPolicy',\n\n''iam:RemoveUserFromGroup',\n\n''iam:UpdateGroup',\n\n''iam:UpdateAssumeRolePolicy',\n\n''iam:UpdateUser'\n\n' ],\n\n' 'Effect': 'Deny',\n\n' 'Resource': '*'\n\n' }]\n\n'}\n\n'and where IAM-Manager-policy.json contains:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': [{\n\n' 'Action': [\n\n''iam:AddUserToGroup',\n\n''iam:AttachGroupPolicy',\n\n''iam:DeleteGroupPolicy',\n\n''iam:DeleteUserPolicy',\n\n''iam:DetachGroupPolicy',\n\n''iam:DetachRolePolicy',\n\n''iam:DetachUserPolicy',\n\n''iam:PutGroupPolicy',\n\n''iam:PutUserPolicy',\n\n''iam:RemoveUserFromGroup',\n\n''iam:UpdateGroup',\n\n''iam:UpdateAssumeRolePolicy',\n\n''iam:UpdateUser',\n\n''iam:GetPolicy',\n\n''iam:GetPolicyVersion',\n\n''iam:GetRole',\n\n''iam:GetRolePolicy',\n\n''iam:GetUser',\n\n''iam:GetUserPolicy',\n\n''iam:ListEntitiesForPolicy',\n\n''iam:ListGroupPolicies',\n\n''iam:ListGroups',\n\n''iam:ListGroupsForUser',\n\n''iam:ListPolicies',\n\n''iam:ListPoliciesGrantingServiceAccess',\n\n''iam:ListPolicyVersions',\n\n''iam:ListRolePolicies',\n\n''iam:ListAttachedGroupPolicies',\n\n''iam:ListAttachedRolePolicies',\n\n''iam:ListAttachedUserPolicies',\n\n''iam:ListRoles',\n\n''iam:ListUsers'\n\n' ],\n\n' 'Effect': 'Allow',\n\n' 'Resource': '*',\n\n' 'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}\n\n' }],\n\n' 'Action': [\n\n' 'iam:CreateGroup',\n\n''iam:CreatePolicy',\n\n''iam:CreatePolicyVersion',\n\n''iam:CreateRole',\n\n''iam:CreateUser',\n\n''iam:DeleteGroup',\n\n''iam:DeletePolicy',\n\n''iam:DeletePolicyVersion',\n\n''iam:DeleteRole',\n\n''iam:DeleteRolePolicy',\n\n''iam:DeleteUser',\n\n''iam:PutRolePolicy'\n\n' ],\n\n' 'Effect': 'Deny',\n\n' 'Resource': '*'\n\n' }]\n\n'}\n\n'Note that each of IAM-Manager-policy.json and IAM-Master-policy.json can\ncontain other iam:* permissions in either Allow or Deny Action lists, depending\non what other requirements are in place in the account.\n\n'Each of these roles needs to be assumable by a different user or group.\n\n'For appropriate users or groups (groups are recommended):\n\n'aws iam put-user-policy --user-name _<iam_user>_ --policy-name\n_<assume_iam_master_role_policy>_ --policy-document\n<a>file://Assume-IAM-Master.json</a>\n\n'aws iam put-user-policy --user-name _<iam_user>_ --policy-name\n_<assume_iam_manager_role_policy>_ --policy-document\n<a>file://Assume-IAM-Manager.json</a>\n\n'or\n\n'aws iam put-group-policy --group-name _<iam_group>_  --policy-name\n_<assume_iam_master_role_policy>_ --policy-document\n<a>file://Assume-IAM-Master.json</a>\n\n'aws iam put-group-policy --group-name _<iam_group>_ --policy-name\n_<assume_iam_manager_role_policy> _--policy-document\n<a>file://Assume-IAM-Manager.json</a>\n\n'where Assume-IAM-Master.json is:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': {\n\n' 'Effect': 'Allow',\n\n' 'Action': 'sts:AssumeRole',\n\n' 'Resource': 'arn:aws:iam::_<aws_account_number>_:role/<iam_master_role_name>'\n\n\n' }\n\n'}\n\n'and Assume-IAM-Manager.json is:\n\n'{\n\n' 'Version': '2012-10-17',\n\n' 'Statement': {\n\n' 'Effect': 'Allow',\n\n' 'Action': 'sts:AssumeRole',\n\n' 'Resource': 'arn:aws:iam::<aws_account_number>:role/<iam_manager_role_name>'\n\n\n' }\n\n'}\"\n\n  master_allow_actions = [\n    'iam:AttachRolePolicy',\n    'iam:CreateGroup',\n    'iam:CreatePolicy',\n    'iam:CreatePolicyVersion',\n    'iam:CreateRole',\n    'iam:CreateUser',\n    'iam:DeleteGroup',\n    'iam:DeletePolicy',\n    'iam:DeletePolicyVersion',\n    'iam:DeleteRole',\n    'iam:DeleteRolePolicy',\n    'iam:DeleteUser',\n    'iam:PutRolePolicy',\n    'iam:GetPolicy',\n    'iam:GetPolicyVersion',\n    'iam:GetRole',\n    'iam:GetRolePolicy',\n    'iam:GetUser',\n    'iam:GetUserPolicy',\n    'iam:ListEntitiesForPolicy',\n    'iam:ListGroupPolicies',\n    'iam:ListGroups',\n    'iam:ListGroupsForUser',\n    'iam:ListPolicies',\n    'iam:ListPoliciesGrantingServiceAccess',\n    'iam:ListPolicyVersions',\n    'iam:ListRolePolicies',\n    'iam:ListAttachedGroupPolicies',\n    'iam:ListAttachedRolePolicies',\n    'iam:ListAttachedUserPolicies',\n    'iam:ListRoles',\n    'iam:ListUsers'\n  ]\n\n  master_deny_actions = [\n    'iam:AddUserToGroup',\n    'iam:AttachGroupPolicy',\n    'iam:DeleteGroupPolicy',\n    'iam:DeleteUserPolicy',\n    'iam:DetachGroupPolicy',\n    'iam:DetachRolePolicy',\n    'iam:DetachUserPolicy',\n    'iam:PutGroupPolicy',\n    'iam:PutUserPolicy',\n    'iam:RemoveUserFromGroup',\n    'iam:UpdateGroup',\n    'iam:UpdateAssumeRolePolicy',\n    'iam:UpdateUser'\n  ]\n\n  manager_allow_actions = [\n    'iam:AddUserToGroup',\n    'iam:AttachGroupPolicy',\n    'iam:DeleteGroupPolicy',\n    'iam:DeleteUserPolicy',\n    'iam:DetachGroupPolicy',\n    'iam:DetachRolePolicy',\n    'iam:DetachUserPolicy',\n    'iam:PutGroupPolicy',\n    'iam:PutUserPolicy',\n    'iam:RemoveUserFromGroup',\n    'iam:UpdateGroup',\n    'iam:UpdateAssumeRolePolicy',\n    'iam:UpdateUser',\n    'iam:GetPolicy',\n    'iam:GetPolicyVersion',\n    'iam:GetRole',\n    'iam:GetRolePolicy',\n    'iam:GetUser',\n    'iam:GetUserPolicy',\n    'iam:ListEntitiesForPolicy',\n    'iam:ListGroupPolicies',\n    'iam:ListGroups',\n    'iam:ListGroupsForUser',\n    'iam:ListPolicies',\n    'iam:ListPoliciesGrantingServiceAccess',\n    'iam:ListPolicyVersions',\n    'iam:ListRolePolicies',\n    'iam:ListAttachedGroupPolicies',\n    'iam:ListAttachedRolePolicies',\n    'iam:ListAttachedUserPolicies',\n    'iam:ListRoles',\n    'iam:ListUsers'\n  ]\n\n  manager_deny_actions = [\n    'iam:AttachRolePolicy',\n    'iam:CreateGroup',\n    'iam:CreatePolicy',\n    'iam:CreatePolicyVersion',\n    'iam:CreateRole',\n    'iam:CreateUser',\n    'iam:DeleteGroup',\n    'iam:DeletePolicy',\n    'iam:DeletePolicyVersion',\n    'iam:DeleteRole',\n    'iam:DeleteRolePolicy',\n    'iam:DeleteUser',\n    'iam:PutRolePolicy'\n  ]\n\n  mfa_condition = {\n    \"Bool\": {\n      \"aws:MultiFactorAuthPresent\": 'true'\n    }\n  }\n\n  describe aws_iam_policy(iam_master_policy_name) do\n    it { should exist }\n  end\n\n  if aws_iam_policy(iam_master_policy_name).exists?\n    describe 'Master Policy Allow Actions ' do\n      subject { master_allow_actions }\n      it { should be_in aws_iam_policy(iam_master_policy_name).document.where(Effect: 'Allow').actions.flatten }\n    end\n\n    describe 'Master Policy Deny Actions ' do\n      subject { master_deny_actions }\n      it { should be_in aws_iam_policy(iam_master_policy_name).document.where(Effect: 'Deny').actions.flatten }\n    end\n\n    describe aws_iam_policy(iam_master_policy_name) do\n      it { should be_attached_to_role(iam_master_role_name) }\n    end\n\n    describe aws_iam_role(iam_master_role_name).assume_role_policy_document do\n      its('actions') { should_not be_empty }\n    end\n\n    if aws_iam_role(iam_manager_role_name).assume_role_policy_document.where(Action: 'sts:AssumeRole').exists?\n      describe aws_iam_role(iam_master_role_name).assume_role_policy_document.where(Action: 'sts:AssumeRole').where(Effect: 'Allow') do\n        its('principals.to_s') { should match \":user/#{iam_master_user_name}\" }\n        its('principals.to_s') { should_not match \":user/#{iam_manager_user_name}\" }\n      end\n    end\n  end\n\n  describe aws_iam_policy(iam_manager_policy_name) do\n    it { should exist }\n  end\n\n  if aws_iam_policy(iam_manager_policy_name).exists?\n    describe 'Manager Policy Allow Actions ' do\n      subject { manager_allow_actions }\n      it { should be_in aws_iam_policy(iam_manager_policy_name).document.where(Effect: 'Allow').actions.flatten }\n    end\n\n    describe 'Manager Policy Deny Actions ' do\n      subject { manager_deny_actions }\n      it { should be_in aws_iam_policy(iam_manager_policy_name).document.where(Effect: 'Deny').actions.flatten }\n    end\n\n    describe aws_iam_policy(iam_manager_policy_name) do\n      it { should be_attached_to_role(iam_manager_role_name) }\n    end\n\n    describe aws_iam_role(iam_manager_role_name).assume_role_policy_document do\n      its('actions') { should_not be_empty }\n    end\n\n    if aws_iam_role(iam_manager_role_name).assume_role_policy_document.where(Action: 'sts:AssumeRole').exists?\n      describe aws_iam_role(iam_manager_role_name).assume_role_policy_document.where(Action: 'sts:AssumeRole').where(Effect: 'Allow') do\n        its('principals.to_s') { should match \":user/#{iam_manager_user_name}\" }\n        its('principals.to_s') { should_not match \":user/#{iam_manager_user_name}\" }\n      end\n    end\n  end\nend\n","source_location":{"line":13,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.18.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"Policy iam-master-policy is expected to exist","run_time":0.001398725,"start_time":"2020-06-19T14:44:07+00:00","message":"expected Policy iam-master-policy to exist"},{"status":"failed","code_desc":"Policy iam-manager-policy is expected to exist","run_time":0.000153003,"start_time":"2020-06-19T14:44:07+00:00","message":"expected Policy iam-manager-policy to exist"}]},{"id":"cis-aws-foundations-1.5","title":"Ensure IAM password policy requires at least one uppercase letter","desc":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one uppercase letter.","descriptions":[{"label":"default","data":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one uppercase letter."}],"impact":0.3,"refs":[],"tags":{"rationale":"Setting a password complexity policy increases account\nresiliency against brute force login attempts.","cis_impact":"","cis_rid":"1.5","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78903-2","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Requires at least one uppercase letter' is checked under 'Password\nPolicy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireUppercaseCharacters':\ntrue","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Requires at least one uppercase letter'\n* Click 'Apply password policy'\n\n'Via CLI\n\n' aws iam update-account-password-policy --require-uppercase-characters\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.5' do\n  title 'Ensure IAM password policy requires at least one uppercase letter'\n  desc  \"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one uppercase letter.\"\n  impact 0.3\n  tag \"rationale\": \"Setting a password complexity policy increases account\nresiliency against brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.5'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78903-2'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Requires at least one uppercase letter' is checked under 'Password\nPolicy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireUppercaseCharacters':\ntrue\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Requires at least one uppercase letter'\n* Click 'Apply password policy'\n\n'Via CLI\n\n' aws iam update-account-password-policy --require-uppercase-characters\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('require_uppercase_characters?') { should be true }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.5.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000203003,"start_time":"2020-06-19T14:44:07+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-1.21","title":"Ensure IAM instance roles are used for AWS resource access from\ninstances","desc":"AWS access from within AWS instances can be done by either encoding\nAWS keys into AWS API calls or by assigning the instance to a role which has an\nappropriate permissions policy for the required access. 'AWS Access' means\naccessing the APIs of AWS in order to access AWS resources or manage AWS\naccount resources.","descriptions":[{"label":"default","data":"AWS access from within AWS instances can be done by either encoding\nAWS keys into AWS API calls or by assigning the instance to a role which has an\nappropriate permissions policy for the required access. 'AWS Access' means\naccessing the APIs of AWS in order to access AWS resources or manage AWS\naccount resources."}],"impact":0.7,"refs":[],"tags":{"rationale":"AWS IAM roles reduce the risks associated with sharing and\nrotating credentials that can be used outside of AWS itself. If credentials are\ncompromised, they can be used from outside of the the AWS account they give\naccess to. In contrast, in order to leverage role permissions an attacker would\nneed to gain and maintain access to a specific instance to use the privileges\nassociated with it.\n\n'Additionally, if credentials are encoded into compiled applications or other\nhard to change mechanisms, then they are even more unlikely to be properly\nrotated due to service disruption risks. As time goes on, credentials that\ncannot be rotated are more likely to be known by an increasing number of\nindividuals who no longer work for the organization owning the credentials.","cis_impact":"","cis_rid":"1.21","cis_level":2,"csc_control":[["16.14"],"6.0"],"nist":["SC-28","Rev_4"],"cce_id":"","check":"Whether an Instance Is Associated With a Role\n\n'For instances that are known to perform AWS actions, ensure that they belong\nto an instance role that has the necessary permissions:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Open the EC2 Dashboard and choose 'Instances'\n* Click the EC2 instance that performs AWS actions, in the lower pane details\nfind 'IAM Role'\n* If the Role is blank, the instance is not assigned to one.\n* If the Role is filled in, it does not mean the instance might not *also* have\ncredentials encoded on it for some activities.\n\n'Whether an Instance Contains Embedded Credentials\n\n'On the instance that is known to perform AWS actions, audit all scripts and\nenvironment variables to ensure that none of them contain AWS credentials.\n\n'Whether an Instance Application Contains Embedded Credentials\n\n'Applications that run on an instance may also have credentials embedded. This\nis a bad practice, but even worse if the source code is stored in a public code\nrepository such as github. When an application contains credentials can be\ndetermined by eliminating all other sources of credentials and if the\napplication can still access AWS resources - it likely contains embedded\ncredentials. Another method is to examine all source code and configuration\nfiles of the application.","fix":"IAM roles can only be associated at the launch of an instance. To\nremediate an instance to add it to a role you must create a new instance.\n\n'If the instance has no external dependencies on it's current private ip or\npublic addresses are elastic IPs:\n\n* In AWS IAM create a new role. Assign a permissions policy if needed\npermissions are already known.\n* In the AWS console launch a new instance with identical settings to the\nexisting instance, and ensure that the newly created role is selected.\n* Shutdown both the existing instance and the new instance.\n* Detach disks from both instances.\n* Attach the existing instance disks to the new instance.\n* Boot the new instance and you should have the same machine, but with the\nassociated role.\n\n'Note: if your environment has dependencies on a dynamically assigned PRIVATE\nIP address you can create an AMI from the existing instance, destroy the old\none and then when launching from the AMI, manually assign the previous private\nIP address.\n\n'Note: if your environment has dependencies on a dynamically assigned PUBLIC IP\naddress there is not a way ensure the address is retained and assign an\ninstance role. Dependencies on dynamically assigned public IP addresses are a\nbad practice and, if possible, you may wish to rebuild the instance with a new\nelastic IP address and make the investment to remediate affected systems while\nassigning the system to a role."},"code":"control 'cis-aws-foundations-1.21' do\n  title \"Ensure IAM instance roles are used for AWS resource access from\ninstances\"\n  desc  \"AWS access from within AWS instances can be done by either encoding\nAWS keys into AWS API calls or by assigning the instance to a role which has an\nappropriate permissions policy for the required access. 'AWS Access' means\naccessing the APIs of AWS in order to access AWS resources or manage AWS\naccount resources.\"\n  impact 0.7\n  tag \"rationale\": \"AWS IAM roles reduce the risks associated with sharing and\nrotating credentials that can be used outside of AWS itself. If credentials are\ncompromised, they can be used from outside of the the AWS account they give\naccess to. In contrast, in order to leverage role permissions an attacker would\nneed to gain and maintain access to a specific instance to use the privileges\nassociated with it.\n\n'Additionally, if credentials are encoded into compiled applications or other\nhard to change mechanisms, then they are even more unlikely to be properly\nrotated due to service disruption risks. As time goes on, credentials that\ncannot be rotated are more likely to be known by an increasing number of\nindividuals who no longer work for the organization owning the credentials.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.21'\n  tag \"cis_level\": 2\n  tag \"csc_control\": [['16.14'], '6.0']\n  tag \"nist\": ['SC-28', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Whether an Instance Is Associated With a Role\n\n'For instances that are known to perform AWS actions, ensure that they belong\nto an instance role that has the necessary permissions:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Open the EC2 Dashboard and choose 'Instances'\n* Click the EC2 instance that performs AWS actions, in the lower pane details\nfind 'IAM Role'\n* If the Role is blank, the instance is not assigned to one.\n* If the Role is filled in, it does not mean the instance might not *also* have\ncredentials encoded on it for some activities.\n\n'Whether an Instance Contains Embedded Credentials\n\n'On the instance that is known to perform AWS actions, audit all scripts and\nenvironment variables to ensure that none of them contain AWS credentials.\n\n'Whether an Instance Application Contains Embedded Credentials\n\n'Applications that run on an instance may also have credentials embedded. This\nis a bad practice, but even worse if the source code is stored in a public code\nrepository such as github. When an application contains credentials can be\ndetermined by eliminating all other sources of credentials and if the\napplication can still access AWS resources - it likely contains embedded\ncredentials. Another method is to examine all source code and configuration\nfiles of the application.\"\n  tag \"fix\": \"IAM roles can only be associated at the launch of an instance. To\nremediate an instance to add it to a role you must create a new instance.\n\n'If the instance has no external dependencies on it's current private ip or\npublic addresses are elastic IPs:\n\n* In AWS IAM create a new role. Assign a permissions policy if needed\npermissions are already known.\n* In the AWS console launch a new instance with identical settings to the\nexisting instance, and ensure that the newly created role is selected.\n* Shutdown both the existing instance and the new instance.\n* Detach disks from both instances.\n* Attach the existing instance disks to the new instance.\n* Boot the new instance and you should have the same machine, but with the\nassociated role.\n\n'Note: if your environment has dependencies on a dynamically assigned PRIVATE\nIP address you can create an AMI from the existing instance, destroy the old\none and then when launching from the AMI, manually assign the previous private\nIP address.\n\n'Note: if your environment has dependencies on a dynamically assigned PUBLIC IP\naddress there is not a way ensure the address is retained and assign an\ninstance role. Dependencies on dynamically assigned public IP addresses are a\nbad practice and, if possible, you may wish to rebuild the instance with a new\nelastic IP address and make the investment to remediate affected systems while\nassigning the system to a role.\"\n\n  describe 'Control has to be tested manually' do\n    skip 'This control must be manually reviewed'\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.21.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"Control has to be tested manually","run_time":1.09e-05,"start_time":"2020-06-19T14:44:07+00:00","resource":"","skip_message":"This control must be manually reviewed"}]},{"id":"cis-aws-foundations-2.3","title":"Ensure the S3 bucket CloudTrail logs to is not publicly accessible","desc":"CloudTrail logs a record of every API call made in your AWS account.\nThese logs file are stored in an S3 bucket. It is recommended that the bucket\npolicy or access control list (ACL) applied to the S3 bucket that CloudTrail\nlogs to prevents public access to the CloudTrail logs.","descriptions":[{"label":"default","data":"CloudTrail logs a record of every API call made in your AWS account.\nThese logs file are stored in an S3 bucket. It is recommended that the bucket\npolicy or access control list (ACL) applied to the S3 bucket that CloudTrail\nlogs to prevents public access to the CloudTrail logs."}],"impact":0.3,"refs":[],"tags":{"rationale":"Allowing public access to CloudTrail log content may aid an\nadversary in identifying weaknesses in the affected account's use or\nconfiguration.","cis_impact":"","cis_rid":"2.3","cis_level":1,"csc_control":"","nist":["AU-9","Rev_4"],"cce_id":"CCE-78915-6","check":"Perform the following to determine if any public access is\ngranted to an S3 bucket via an ACL or S3 bucket policy:\n\n'Via the Management Console\n\n* Go to the Amazon CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/home\n[https://console.aws.amazon.com/cloudtrail/home]\n* In the API activity history pane on the left, click Trails\n* In the Trails pane, note the bucket names in the S3 bucket column\n* Go to Amazon S3 console at https://console.aws.amazon.com/s3/home\n[https://console.aws.amazon.com/s3/home]\n* For each bucket noted in step 3, right-click on the bucket and click\nProperties\n* In the Properties pane, click the Permissions tab.\n* The tab shows a list of grants, one row per grant, in the bucket ACL. Each\nrow identifies the grantee and the permissions granted.\n* Ensure no rows exists that have the Grantee set to Everyone or the Grantee\nset to Any Authenticated User.\n* If the Edit bucket policy button is present, click it to review the bucket\npolicy.\n* Ensure the policy does not contain a Statement having an Effect set to Allow\nand a Principal set to *.\n\n'Via CLI:\n\n* Get the name of the S3 bucket that CloudTrail is logging to:\n\n'aws cloudtrail describe-trails --query 'trailList[*].S3BucketName'\n\n* Ensure the AllUsers principal is not granted privileges to that _<bucket>_:\n\n'aws s3api get-bucket-acl --bucket <s3_bucket_for_cloudtrail> --query\n'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers`]'\n\n* Ensure the AuthenticatedUsersprincipal is not granted privileges to that\n_<bucket>_:\n\n'aws s3api get-bucket-acl --bucket <s3_bucket_for_cloudtrail> --query\n'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/Authenticated\nUsers`]'\n\n* Get the S3 Bucket Policy\n\n'aws s3api get-bucket-policy --bucket <s3_bucket_for_cloudtrail>\n* Ensure the policy does not contain a Statement having an Effect set to Allow\nand a Principal set to *.","fix":"Perform the following to remove any public access that has been\ngranted to the bucket via an ACL or S3 bucket policy:\n\n* Go to Amazon S3 console at https://console.aws.amazon.com/s3/home\n[https://console.aws.amazon.com/s3/home]\n* Right-click on the bucket and click Properties\n* In the Properties pane, click the Permissions tab.\n* The tab shows a list of grants, one row per grant, in the bucket ACL. Each\nrow identifies the grantee and the permissions granted.\n* Select the row that grants permission to Everyone or Any Authenticated User\n* Uncheck all the permissions granted to Everyone or Any Authenticated User\n(click x to delete the row).\n* Click Save to save the ACL.\n* If the Edit bucket policy button is present, click it.\n* Remove any Statement having an Effect set to Allow and a Principal set to *."},"code":"control 'cis-aws-foundations-2.3' do\n  title 'Ensure the S3 bucket CloudTrail logs to is not publicly accessible'\n  desc  \"CloudTrail logs a record of every API call made in your AWS account.\nThese logs file are stored in an S3 bucket. It is recommended that the bucket\npolicy or access control list (ACL) applied to the S3 bucket that CloudTrail\nlogs to prevents public access to the CloudTrail logs.\"\n  impact 0.3\n  tag \"rationale\": \"Allowing public access to CloudTrail log content may aid an\nadversary in identifying weaknesses in the affected account's use or\nconfiguration.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '2.3'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['AU-9', 'Rev_4']\n  tag \"cce_id\": 'CCE-78915-6'\n  tag \"check\": \"Perform the following to determine if any public access is\ngranted to an S3 bucket via an ACL or S3 bucket policy:\n\n'Via the Management Console\n\n* Go to the Amazon CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/home\n[https://console.aws.amazon.com/cloudtrail/home]\n* In the API activity history pane on the left, click Trails\n* In the Trails pane, note the bucket names in the S3 bucket column\n* Go to Amazon S3 console at https://console.aws.amazon.com/s3/home\n[https://console.aws.amazon.com/s3/home]\n* For each bucket noted in step 3, right-click on the bucket and click\nProperties\n* In the Properties pane, click the Permissions tab.\n* The tab shows a list of grants, one row per grant, in the bucket ACL. Each\nrow identifies the grantee and the permissions granted.\n* Ensure no rows exists that have the Grantee set to Everyone or the Grantee\nset to Any Authenticated User.\n* If the Edit bucket policy button is present, click it to review the bucket\npolicy.\n* Ensure the policy does not contain a Statement having an Effect set to Allow\nand a Principal set to *.\n\n'Via CLI:\n\n* Get the name of the S3 bucket that CloudTrail is logging to:\n\n'aws cloudtrail describe-trails --query 'trailList[*].S3BucketName'\n\n* Ensure the AllUsers principal is not granted privileges to that _<bucket>_:\n\n'aws s3api get-bucket-acl --bucket <s3_bucket_for_cloudtrail> --query\n'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers`]'\n\n* Ensure the AuthenticatedUsersprincipal is not granted privileges to that\n_<bucket>_:\n\n'aws s3api get-bucket-acl --bucket <s3_bucket_for_cloudtrail> --query\n'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/Authenticated\nUsers`]'\n\n* Get the S3 Bucket Policy\n\n'aws s3api get-bucket-policy --bucket <s3_bucket_for_cloudtrail>\n* Ensure the policy does not contain a Statement having an Effect set to Allow\nand a Principal set to *.\"\n  tag \"fix\": \"Perform the following to remove any public access that has been\ngranted to the bucket via an ACL or S3 bucket policy:\n\n* Go to Amazon S3 console at https://console.aws.amazon.com/s3/home\n[https://console.aws.amazon.com/s3/home]\n* Right-click on the bucket and click Properties\n* In the Properties pane, click the Permissions tab.\n* The tab shows a list of grants, one row per grant, in the bucket ACL. Each\nrow identifies the grantee and the permissions granted.\n* Select the row that grants permission to Everyone or Any Authenticated User\n* Uncheck all the permissions granted to Everyone or Any Authenticated User\n(click x to delete the row).\n* Click Save to save the ACL.\n* If the Edit bucket policy button is present, click it.\n* Remove any Statement having an Effect set to Allow and a Principal set to *.\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    bucket_name = aws_cloudtrail_trail(trail).s3_bucket_name\n    if exception_bucket_list.include?(bucket_name)\n      describe 'Bucket not inspected because it is defined as an exception' do\n        skip \"Bucket: #{bucket_name} not inspected because it is defined in exception_bucket_list.\"\n      end\n    end\n\n    next if exception_bucket_list.include?(bucket_name)\n\n    describe aws_s3_bucket(bucket_name) do\n      it { should_not be_public }\n    end\n  end\n\n  # Use this after skeletal aws_cloudtrail_trails is enhanced to expose s3_bucket_name\n  # aws_cloudtrail_trails.s3_bucket_name.uniq.each do |bucket|\n  #   describe aws_s3_bucket( bucket ) do\n  #     it{ should_not be_public }\n  #   end\n  # end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.3.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000138403,"start_time":"2020-06-19T14:44:07+00:00"},{"status":"passed","code_desc":"S3 Bucket aws-cis-storage is expected not to be public","run_time":0.145528069,"start_time":"2020-06-19T14:44:07+00:00"}]},{"id":"cis-aws-foundations-1.24","title":"Ensure IAM policies that allow full '*:*' administrative privileges\nare not created","desc":"IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended and considered a standard security advice\nto grant _least privilege_--that is, granting only the permissions required to\nperform a task. Determine what users need to do and then craft policies for\nthem that let the users perform _only_ those tasks, instead of allowing full\nadministrative privileges.","descriptions":[{"label":"default","data":"IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended and considered a standard security advice\nto grant _least privilege_--that is, granting only the permissions required to\nperform a task. Determine what users need to do and then craft policies for\nthem that let the users perform _only_ those tasks, instead of allowing full\nadministrative privileges."}],"impact":0.3,"refs":[],"tags":{"rationale":"It's more secure to start with a minimum set of permissions\nand grant additional permissions as necessary, rather than starting with\npermissions that are too lenient and then trying to tighten them later.\n\n'Providing full administrative privileges instead of restricting to the minimum\nset of permissions that the user is required to do exposes the resources to\npotentially unwanted actions.\n\n'IAM policies that have a statement with 'Effect': 'Allow' with 'Action': '*'\nover  'Resource': '*' should be removed.","cis_impact":"","cis_rid":"1.24","cis_level":1,"severity":"low","csc_control":"","nist":["AC-6","Rev_4"],"cce_id":"CCE-78912-3","check":"Perform the following to determine what policies are created:\n\n* Run the following to get a list of IAM policies:\n\n'aws iam list-policies --output text\n\n* For each policy returned, run the following command to determine if any\npolicies is allowing full administrative privileges on the account:\n\n'aws iam get-policy-version --policy-arn _<policy_arn>_ --version\n_<policy_version>_ --query 'PolicyVersion.Document.Statement[?Effect == 'Allow'\n&& contains(Resource, '*') && contains (Action, '*')]'\n* If the output of the command returns any policies, it's not compliant.","fix":"Using the GUI, perform the following to detach the policy that\nhas full administrative privileges:\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Policies and then search for the policy name\nfound in the audit step.\n\n 'Select the policy that needs to be deleted.\n\n 'In the policy action menu, select first Detach\n* Select all Users, Groups, Roles that have this policy attached\n\n 'Click Detach Policy\n\n 'In the policy action menu, select Detach\n\n'Using the CLI, perform the following to detach the policy that has full\nadministrative privileges as found in the audit step:\n\n'1. Lists all IAM users, groups, and roles that the specified managed policy is\nattached to.\n\n 'aws iam list-entities-for-policy --policy-arn _<policy_arn>_\n\n\n'2. Detach the policy from all IAM Users:\n\n 'aws iam detach-user-policy --user-name _<iam_user>_ --policy-arn _<policy_arn>_\n\n'3. Detach the policy from all IAM Groups:\n\n 'aws iam detach-group-policy --group-name _<iam_group>_ --policy-arn\n_<policy_arn>_\n\n\n'4. Detach the policy from all IAM Roles:\n\n\n 'aws iam detach-role-policy --role-name _<iam_role>_ --policy-arn _<policy_arn>_\n\n'\n"},"code":"control 'cis-aws-foundations-1.24' do\n  title \"Ensure IAM policies that allow full '*:*' administrative privileges\nare not created\"\n  desc  \"IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended and considered a standard security advice\nto grant _least privilege_--that is, granting only the permissions required to\nperform a task. Determine what users need to do and then craft policies for\nthem that let the users perform _only_ those tasks, instead of allowing full\nadministrative privileges.\"\n  impact 0.3\n  tag \"rationale\": \"It's more secure to start with a minimum set of permissions\nand grant additional permissions as necessary, rather than starting with\npermissions that are too lenient and then trying to tighten them later.\n\n'Providing full administrative privileges instead of restricting to the minimum\nset of permissions that the user is required to do exposes the resources to\npotentially unwanted actions.\n\n'IAM policies that have a statement with 'Effect': 'Allow' with 'Action': '*'\nover  'Resource': '*' should be removed.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.24'\n  tag \"cis_level\": 1\n  tag \"severity\": 'low'\n  tag \"csc_control\": ''\n  tag \"nist\": ['AC-6', 'Rev_4']\n  tag \"cce_id\": 'CCE-78912-3'\n  tag \"check\": \"Perform the following to determine what policies are created:\n\n* Run the following to get a list of IAM policies:\n\n'aws iam list-policies --output text\n\n* For each policy returned, run the following command to determine if any\npolicies is allowing full administrative privileges on the account:\n\n'aws iam get-policy-version --policy-arn _<policy_arn>_ --version\n_<policy_version>_ --query 'PolicyVersion.Document.Statement[?Effect == 'Allow'\n&& contains(Resource, '*') && contains (Action, '*')]'\n* If the output of the command returns any policies, it's not compliant.\"\n  tag \"fix\": \"Using the GUI, perform the following to detach the policy that\nhas full administrative privileges:\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Policies and then search for the policy name\nfound in the audit step.\n\n 'Select the policy that needs to be deleted.\n\n 'In the policy action menu, select first Detach\n* Select all Users, Groups, Roles that have this policy attached\n\n 'Click Detach Policy\n\n 'In the policy action menu, select Detach\n\n'Using the CLI, perform the following to detach the policy that has full\nadministrative privileges as found in the audit step:\n\n'1. Lists all IAM users, groups, and roles that the specified managed policy is\nattached to.\n\n 'aws iam list-entities-for-policy --policy-arn _<policy_arn>_\n\n\n'2. Detach the policy from all IAM Users:\n\n 'aws iam detach-user-policy --user-name _<iam_user>_ --policy-arn _<policy_arn>_\n\n'3. Detach the policy from all IAM Groups:\n\n 'aws iam detach-group-policy --group-name _<iam_group>_ --policy-arn\n_<policy_arn>_\n\n\n'4. Detach the policy from all IAM Roles:\n\n\n 'aws iam detach-role-policy --role-name _<iam_role>_ --policy-arn _<policy_arn>_\n\n'\n\"\n  # the following implementation covers cases where 'Action' and 'Resource' param of the\n  # policy json is defined as an array or string\n  # if recoded please confirm that it tests both cases\n\n  aws_iam_policies.where { attachment_count > 0 }.policy_names.each do |policy|\n    describe \"Attached Policies #{policy} allows full '*:*' privileges?\" do\n      subject do\n        aws_iam_policy(policy).document.where(Effect: 'Allow').actions.flatten.include?('*') &&\n          aws_iam_policy(policy).document.where(Effect: 'Allow').resources.flatten.include?('*')\n      end\n      it { should be false }\n    end\n  end\n\n  if  aws_iam_policies.where { attachment_count > 0 }.policy_names.empty?\n    describe 'Control skipped because no iam policies were found' do\n      skip 'This control is skipped since the aws_iam_policies resource returned an empty policy list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.24.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"Attached Policies AWSSSOServiceRolePolicy allows full '*:*' privileges? is expected to equal false","run_time":0.476976245,"start_time":"2020-06-19T14:44:07+00:00"},{"status":"passed","code_desc":"Attached Policies AWSOrganizationsServiceTrustPolicy allows full '*:*' privileges? is expected to equal false","run_time":0.457963197,"start_time":"2020-06-19T14:44:08+00:00"},{"status":"failed","code_desc":"Attached Policies AdministratorAccess allows full '*:*' privileges? is expected to equal false","run_time":1.028762364,"start_time":"2020-06-19T14:44:08+00:00","message":"\nexpected false\n     got true\n"},{"status":"passed","code_desc":"Attached Policies AmazonS3ReadOnlyAccess allows full '*:*' privileges? is expected to equal false","run_time":0.504093843,"start_time":"2020-06-19T14:44:09+00:00"},{"status":"passed","code_desc":"Attached Policies IAMUserChangePassword allows full '*:*' privileges? is expected to equal false","run_time":0.576665474,"start_time":"2020-06-19T14:44:10+00:00"},{"status":"passed","code_desc":"Attached Policies AWSTrustedAdvisorServiceRolePolicy allows full '*:*' privileges? is expected to equal false","run_time":0.571899886,"start_time":"2020-06-19T14:44:10+00:00"},{"status":"passed","code_desc":"Attached Policies AWSSupportServiceRolePolicy allows full '*:*' privileges? is expected to equal false","run_time":0.90210424,"start_time":"2020-06-19T14:44:11+00:00"}]},{"id":"cis-aws-foundations-1.11","title":"Ensure IAM password policy expires passwords within 90 days or less","desc":"IAM password policies can require passwords to be rotated or expired\nafter a given number of days. It is recommended that the password policy expire\npasswords after 90 days or less.","descriptions":[{"label":"default","data":"IAM password policies can require passwords to be rotated or expired\nafter a given number of days. It is recommended that the password policy expire\npasswords after 90 days or less."}],"impact":0.3,"refs":[],"tags":{"rationale":"Reducing the password lifetime increases account resiliency\nagainst brute force login attempts. Additionally, requiring regular password\nchanges help in the following scenarios:\n\n* Passwords can be stolen or compromised sometimes without your knowledge. This\ncan happen via a system compromise, software vulnerability, or internal threat.\n\n\n* Certain corporate and government web filters or proxy servers have the\nability to intercept and record traffic even if it's encrypted.\n* Many people use the same password for many systems such as work, email, and\npersonal.\n* Compromised end user workstations might have a keystroke logger.","cis_impact":"","cis_rid":"1.11","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78909-9","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Enable password expiration' is checked\n* Ensure 'Password expiration period (in days):' is set to 90 or less\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'MaxPasswordAge': 90 or less","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Enable password expiration'\n* Set 'Password expiration period (in days):' to 90 or less\n\n' Via CLI\n\n' aws iam update-account-password-policy --max-password-age 90\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.11' do\n  title \"Ensure IAM password policy expires passwords within #{aws_cred_age} days or less\"\n  desc  \"IAM password policies can require passwords to be rotated or expired\nafter a given number of days. It is recommended that the password policy expire\npasswords after #{aws_cred_age} days or less.\"\n  impact 0.3\n  tag \"rationale\": \"Reducing the password lifetime increases account resiliency\nagainst brute force login attempts. Additionally, requiring regular password\nchanges help in the following scenarios:\n\n* Passwords can be stolen or compromised sometimes without your knowledge. This\ncan happen via a system compromise, software vulnerability, or internal threat.\n\n\n* Certain corporate and government web filters or proxy servers have the\nability to intercept and record traffic even if it's encrypted.\n* Many people use the same password for many systems such as work, email, and\npersonal.\n* Compromised end user workstations might have a keystroke logger.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.11'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78909-9'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Enable password expiration' is checked\n* Ensure 'Password expiration period (in days):' is set to #{aws_cred_age} or less\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'MaxPasswordAge': #{aws_cred_age} or less\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console:\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Enable password expiration'\n* Set 'Password expiration period (in days):' to #{aws_cred_age} or less\n\n' Via CLI\n\n' aws iam update-account-password-policy --max-password-age #{aws_cred_age}\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('expire_passwords?') { should be true }\n    its('max_password_age_in_days') { should cmp <= aws_cred_age }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.11.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000267605,"start_time":"2020-06-19T14:44:12+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-2.7","title":"Ensure CloudTrail logs are encrypted at rest using KMS CMKs","desc":"AWS CloudTrail is a web service that records AWS API calls for an\naccount and makes those logs available to users and resources in accordance\nwith IAM policies. AWS Key Management Service (KMS) is a managed service that\nhelps create and control the encryption keys used to encrypt account data, and\nuses Hardware Security Modules (HSMs) to protect the security of encryption\nkeys. CloudTrail logs can be configured to leverage server side encryption\n(SSE) and KMS customer created master keys (CMK) to further protect CloudTrail\nlogs. It is recommended that CloudTrail be configured to use SSE-KMS.","descriptions":[{"label":"default","data":"AWS CloudTrail is a web service that records AWS API calls for an\naccount and makes those logs available to users and resources in accordance\nwith IAM policies. AWS Key Management Service (KMS) is a managed service that\nhelps create and control the encryption keys used to encrypt account data, and\nuses Hardware Security Modules (HSMs) to protect the security of encryption\nkeys. CloudTrail logs can be configured to leverage server side encryption\n(SSE) and KMS customer created master keys (CMK) to further protect CloudTrail\nlogs. It is recommended that CloudTrail be configured to use SSE-KMS."}],"impact":0.7,"refs":[],"tags":{"rationale":"Configuring CloudTrail to use SSE-KMS provides additional\nconfidentiality controls on log data as a given user must have S3 read\npermission on the corresponding log bucket and must be granted decrypt\npermission by the CMK policy.","cis_impact":"Customer created keys incur an additional cost. See\nhttps://aws.amazon.com/kms/pricing/ for more information.","cis_rid":"2.7","cis_level":2,"csc_control":[["13.1"],"6.0"],"nist":["AU-9","Rev_4"],"cce_id":"CCE-78919-8","check":"Perform the following to determine if CloudTrail is configured\nto use SSE-KMS:\n\n'Via the Management Console\n\n 'Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* In the left navigation pane, choose Trails.\n* Select a Trail\n* Under the S3 section, ensure Encrypt log files is set to Yes and a KMS key ID\nis specified in the KSM Key Id field.\n\n'Via CLI\n\n* Run the following command:\n\n'aws cloudtrail describe-trails\n* For each trail listed, SSE-KMS is enabled if the trail has a KmsKeyId\nproperty defined.","fix":"Perform the following to configure CloudTrail to use SSE-KMS:\n\n'Via the Management Console\n\n 'Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* In the left navigation pane, choose Trails.\n* Click on a Trail\n* Under the S3 section click on the edit button (pencil icon)\n* Click Advanced\n\n* Select an existing CMK from the KMS key Id drop-down menu\n\n* Note: Ensure the CMK is located in the same region as the S3 bucket\n* Note: You will need to apply a KMS Key policy on the selected CMK in order\nfor CloudTrail as a service to encrypt and decrypt log files using the CMK\nprovided. Steps are provided here\n[https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-kms-key-policy-for-cloudtrail.html]\nfor editing the selected CMK Key policy\n\n\n* Click Save\n* You will see a notification message stating that you need to have decrypt\npermissions on the specified KMS key to decrypt log files.\n* Click Yes\n\n'Via CLI\n\n'aws cloudtrail update-trail --name <_trail_name_> --kms-id\n<_cloudtrail_kms_key_>\naws kms put-key-policy --key-id <_cloudtrail_kms_key_> --policy\n<_cloudtrail_kms_key_policy_>"},"code":"control 'cis-aws-foundations-2.7' do\n  title 'Ensure CloudTrail logs are encrypted at rest using KMS CMKs'\n  desc  \"AWS CloudTrail is a web service that records AWS API calls for an\naccount and makes those logs available to users and resources in accordance\nwith IAM policies. AWS Key Management Service (KMS) is a managed service that\nhelps create and control the encryption keys used to encrypt account data, and\nuses Hardware Security Modules (HSMs) to protect the security of encryption\nkeys. CloudTrail logs can be configured to leverage server side encryption\n(SSE) and KMS customer created master keys (CMK) to further protect CloudTrail\nlogs. It is recommended that CloudTrail be configured to use SSE-KMS.\"\n  impact 0.7\n  tag \"rationale\": \"Configuring CloudTrail to use SSE-KMS provides additional\nconfidentiality controls on log data as a given user must have S3 read\npermission on the corresponding log bucket and must be granted decrypt\npermission by the CMK policy.\"\n  tag \"cis_impact\": \"Customer created keys incur an additional cost. See\nhttps://aws.amazon.com/kms/pricing/ for more information.\"\n  tag \"cis_rid\": '2.7'\n  tag \"cis_level\": 2\n  tag \"csc_control\": [['13.1'], '6.0']\n  tag \"nist\": ['AU-9', 'Rev_4']\n  tag \"cce_id\": 'CCE-78919-8'\n  tag \"check\": \"Perform the following to determine if CloudTrail is configured\nto use SSE-KMS:\n\n'Via the Management Console\n\n 'Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* In the left navigation pane, choose Trails.\n* Select a Trail\n* Under the S3 section, ensure Encrypt log files is set to Yes and a KMS key ID\nis specified in the KSM Key Id field.\n\n'Via CLI\n\n* Run the following command:\n\n'aws cloudtrail describe-trails\n* For each trail listed, SSE-KMS is enabled if the trail has a KmsKeyId\nproperty defined.\"\n  tag \"fix\": \"Perform the following to configure CloudTrail to use SSE-KMS:\n\n'Via the Management Console\n\n 'Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* In the left navigation pane, choose Trails.\n* Click on a Trail\n* Under the S3 section click on the edit button (pencil icon)\n* Click Advanced\n\n* Select an existing CMK from the KMS key Id drop-down menu\n\n* Note: Ensure the CMK is located in the same region as the S3 bucket\n* Note: You will need to apply a KMS Key policy on the selected CMK in order\nfor CloudTrail as a service to encrypt and decrypt log files using the CMK\nprovided. Steps are provided here\n[https://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-kms-key-policy-for-cloudtrail.html]\nfor editing the selected CMK Key policy\n\n\n* Click Save\n* You will see a notification message stating that you need to have decrypt\npermissions on the specified KMS key to decrypt log files.\n* Click Yes\n\n'Via CLI\n\n'aws cloudtrail update-trail --name <_trail_name_> --kms-id\n<_cloudtrail_kms_key_>\naws kms put-key-policy --key-id <_cloudtrail_kms_key_> --policy\n<_cloudtrail_kms_key_policy_>\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    describe aws_cloudtrail_trail(trail) do\n      its('kms_key_id') { should_not be_nil }\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.7.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000153803,"start_time":"2020-06-19T14:44:12+00:00"},{"status":"failed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis kms_key_id is expected not to be nil","run_time":0.000189703,"start_time":"2020-06-19T14:44:12+00:00","message":"expected: not nil\n     got: nil"}]},{"id":"cis-aws-foundations-1.20","title":"Ensure security contact information is registered","desc":"AWS provides customers with the option of specifying the contact\ninformation for account's security team. It is recommended that this\ninformation be provided.","descriptions":[{"label":"default","data":"AWS provides customers with the option of specifying the contact\ninformation for account's security team. It is recommended that this\ninformation be provided."}],"impact":0.3,"refs":[],"tags":{"rationale":"Specifying security-specific contact information will help\nensure that security advisories sent by AWS reach the team in your organization\nthat is best equipped to respond to them.","cis_impact":"","cis_rid":"1.20","cis_level":1,"csc_control":"","nist":["IA-4","Rev_4"],"cce_id":"CCE-79200-2","check":"Perform the following in the AWS Management Console to\ndetermine if security contact information is present:\n\n* Click on your account name at the top right corner of the console\n* From the drop-down menu Click My Account\n* Scroll down to the Alternate Contacts section\n* Ensure contact information is specified in the Security section","fix":"Perform the following in the AWS Management Console to establish\nsecurity contact information:\n\n* Click on your account name at the top right corner of the console.\n* From the drop-down menu Click My Account\n* Scroll down to the Alternate Contacts section\n* Enter contact information in the Security section\n\n'Note: Consider specifying an internal email distribution list to ensure emails\nare regularly monitored by more than one individual."},"code":"control 'cis-aws-foundations-1.20' do\n  title 'Ensure security contact information is registered'\n  desc  \"AWS provides customers with the option of specifying the contact\ninformation for account's security team. It is recommended that this\ninformation be provided.\"\n  impact 0.3\n  tag \"rationale\": \"Specifying security-specific contact information will help\nensure that security advisories sent by AWS reach the team in your organization\nthat is best equipped to respond to them.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.20'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-4', 'Rev_4']\n  tag \"cce_id\": 'CCE-79200-2'\n  tag \"check\": \"Perform the following in the AWS Management Console to\ndetermine if security contact information is present:\n\n* Click on your account name at the top right corner of the console\n* From the drop-down menu Click My Account\n* Scroll down to the Alternate Contacts section\n* Ensure contact information is specified in the Security section\"\n  tag \"fix\": \"Perform the following in the AWS Management Console to establish\nsecurity contact information:\n\n* Click on your account name at the top right corner of the console.\n* From the drop-down menu Click My Account\n* Scroll down to the Alternate Contacts section\n* Enter contact information in the Security section\n\n'Note: Consider specifying an internal email distribution list to ensure emails\nare regularly monitored by more than one individual.\"\n\n  describe 'Control has to be tested manually' do\n    skip 'This control must be manually reviewed'\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.20.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"Control has to be tested manually","run_time":8.6e-06,"start_time":"2020-06-19T14:44:12+00:00","resource":"","skip_message":"This control must be manually reviewed"}]},{"id":"cis-aws-foundations-1.12","title":"Ensure no root account access key exists","desc":"The root account is the most privileged user in an AWS account. AWS\nAccess Keys provide programmatic access to a given AWS account. It is\nrecommended that all access keys associated with the root account be removed.","descriptions":[{"label":"default","data":"The root account is the most privileged user in an AWS account. AWS\nAccess Keys provide programmatic access to a given AWS account. It is\nrecommended that all access keys associated with the root account be removed."}],"impact":0.3,"refs":[],"tags":{"rationale":"Removing access keys associated with the root account\nlimits vectors by which the account can be compromised. Additionally, removing\nthe root access keys encourages the creation and use of role based accounts\nthat are least privileged.","cis_impact":"","cis_rid":"1.12","cis_level":1,"csc_control":[["5.1"],"6.0"],"nist":["AC-6(9)","Rev_4"],"cce_id":"CCE-78910-7","check":"Perform the following to determine if the root account has\naccess keys:\n\n'Via the AWS Console\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains credential usage for all IAM\nusers within an AWS Account - open this file\n* For the <root_account> user, ensure the access_key_1_active and\naccess_key_2_active fields are set to FALSE.\n\n'Via CLI\n\n* Run the following commands:\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d | cut\n-d, -f1,9,14 | grep -B1 '<root_account>'\n* For the <root_account> user, ensure the access_key_1_active and\naccess_key_2_active fields are set to FALSE.","fix":"Perform the following to delete or disable active root access\nkeys being\n\n'Via the AWS Console\n\n 'Sign in to the AWS Management Console as Root and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'Click on _<Root_Account_Name>_ at the top right and select Security\nCredentials from the drop down list\n\n 'On the pop out screen Click on Continue to Security Credentials\n* Click on Access Keys _(Access Key ID and Secret Access Key)_\n\n* Under the Status column if there are any Keys which are Active\n\n* Click on Make Inactive - (Temporarily disable Key - may be needed again)\n* Click Delete - (Deleted keys cannot be recovered)\n"},"code":"control 'cis-aws-foundations-1.12' do\n  title 'Ensure no root account access key exists'\n  desc  \"The root account is the most privileged user in an AWS account. AWS\nAccess Keys provide programmatic access to a given AWS account. It is\nrecommended that all access keys associated with the root account be removed.\"\n  impact 0.3\n  tag \"rationale\": \"Removing access keys associated with the root account\nlimits vectors by which the account can be compromised. Additionally, removing\nthe root access keys encourages the creation and use of role based accounts\nthat are least privileged.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.12'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['5.1'], '6.0']\n  tag \"nist\": ['AC-6(9)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78910-7'\n  tag \"check\": \"Perform the following to determine if the root account has\naccess keys:\n\n'Via the AWS Console\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains credential usage for all IAM\nusers within an AWS Account - open this file\n* For the <root_account> user, ensure the access_key_1_active and\naccess_key_2_active fields are set to FALSE.\n\n'Via CLI\n\n* Run the following commands:\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d | cut\n-d, -f1,9,14 | grep -B1 '<root_account>'\n* For the <root_account> user, ensure the access_key_1_active and\naccess_key_2_active fields are set to FALSE.\"\n  tag \"fix\": \"Perform the following to delete or disable active root access\nkeys being\n\n'Via the AWS Console\n\n 'Sign in to the AWS Management Console as Root and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'Click on _<Root_Account_Name>_ at the top right and select Security\nCredentials from the drop down list\n\n 'On the pop out screen Click on Continue to Security Credentials\n* Click on Access Keys _(Access Key ID and Secret Access Key)_\n\n* Under the Status column if there are any Keys which are Active\n\n* Click on Make Inactive - (Temporarily disable Key - may be needed again)\n* Click Delete - (Deleted keys cannot be recovered)\n\"\n  describe aws_iam_root_user do\n    it { should_not have_access_key }\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.12.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"AWS Root-User is expected not to have access key","run_time":0.394404032,"start_time":"2020-06-19T14:44:12+00:00"}]},{"id":"cis-aws-foundations-1.8","title":"Ensure IAM password policy require at least one number","desc":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one number.","descriptions":[{"label":"default","data":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one number."}],"impact":0.3,"refs":[],"tags":{"rationale":"Setting a password complexity policy increases account\nresiliency against brute force login attempts.","cis_impact":"","cis_rid":"1.8","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78906-5","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Require at least one number ' is checked under 'Password Policy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireNumbers': true","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Require at least one number'\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --require-numbers\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.8' do\n  title 'Ensure IAM password policy require at least one number'\n  desc  \"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one number.\"\n  impact 0.3\n  tag \"rationale\": \"Setting a password complexity policy increases account\nresiliency against brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.8'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78906-5'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Require at least one number ' is checked under 'Password Policy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireNumbers': true\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Require at least one number'\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --require-numbers\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('require_numbers?') { should be true }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.8.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000285306,"start_time":"2020-06-19T14:44:12+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-2.4","title":"Ensure CloudTrail trails are integrated with CloudWatch Logs","desc":"AWS CloudTrail is a web service that records AWS API calls made in a\ngiven AWS account. The recorded information includes the identity of the API\ncaller, the time of the API call, the source IP address of the API caller, the\nrequest parameters, and the response elements returned by the AWS service.\nCloudTrail uses Amazon S3 for log file storage and delivery, so log files are\nstored durably. In addition to capturing CloudTrail logs within a specified S3\nbucket for long term analysis, realtime analysis can be performed by\nconfiguring CloudTrail to send logs to CloudWatch Logs. For a trail that is\nenabled in all regions in an account, CloudTrail sends log files from all those\nregions to a CloudWatch Logs log group. It is recommended that CloudTrail logs\nbe sent to CloudWatch Logs.\n\n'Note: The intent of this recommendation is to ensure AWS account activity is\nbeing captured, monitored, and appropriately alarmed on. CloudWatch Logs is a\nnative way to accomplish this using AWS services but does not preclude the use\nof an alternate solution.","descriptions":[{"label":"default","data":"AWS CloudTrail is a web service that records AWS API calls made in a\ngiven AWS account. The recorded information includes the identity of the API\ncaller, the time of the API call, the source IP address of the API caller, the\nrequest parameters, and the response elements returned by the AWS service.\nCloudTrail uses Amazon S3 for log file storage and delivery, so log files are\nstored durably. In addition to capturing CloudTrail logs within a specified S3\nbucket for long term analysis, realtime analysis can be performed by\nconfiguring CloudTrail to send logs to CloudWatch Logs. For a trail that is\nenabled in all regions in an account, CloudTrail sends log files from all those\nregions to a CloudWatch Logs log group. It is recommended that CloudTrail logs\nbe sent to CloudWatch Logs.\n\n'Note: The intent of this recommendation is to ensure AWS account activity is\nbeing captured, monitored, and appropriately alarmed on. CloudWatch Logs is a\nnative way to accomplish this using AWS services but does not preclude the use\nof an alternate solution."}],"impact":0.3,"refs":[],"tags":{"rationale":"Sending CloudTrail logs to CloudWatch Logs will facilitate\nreal-time and historic activity logging based on user, API, resource, and IP\naddress, and provides opportunity to establish alarms and notifications for\nanomalous or sensitivity account activity.","cis_impact":"Note: By default, CloudWatch Logs will store Logs\nindefinitely unless a specific retention period is defined for the log group.\nWhen choosing the number of days to retain, keep in mind the average days it\ntakes an organization to realize they have been breached is 210 days (at the\ntime of this writing). Since additional time is required to research a breach,\na minimum 365 day retention policy allows time for detection and research. You\nmay also wish to archive the logs to a cheaper storage service rather than\nsimply deleting them. See the following AWS resource to manage CloudWatch Logs\nretention periods:\n\n*\nhttp://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/SettingLogRetention.html","cis_rid":"2.4","cis_level":1,"csc_control":[["6.6","14.6"],"6.0"],"nist":["SI-4(2)","AU-2","Rev_4"],"cce_id":"CCE-78916-4","check":"Perform the following to ensure CloudTrail is configured as\nprescribed:\n\n'Via the AWS management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/\n[https://console.aws.amazon.com/cloudtrail/]\n* Under All Buckets, click on the target bucket you wish to evaluate\n* Click Properties on the top right of the console\n* Click Trails in the left menu\n* Ensure a CloudWatch Logs log group is configured and has a recent (~one day\nold) Last log file delivered timestamp.\n\n'Via CLI\n\n* Run the following command to get a listing of existing trails:\n\n'aws cloudtrail describe-trails\n* Ensure CloudWatchLogsLogGroupArn is not empty and note the value of the Name\nproperty.\n\n* Using the noted value of the Name property, run the following command:\n\n'aws cloudtrail get-trail-status --name _<trail_name>_\n* Ensure the LatestcloudwatchLogdDeliveryTime property is set to a recent (~one\nday old) timestamp.","fix":"Perform the following to establish the prescribed state:\n\n'Via the AWS management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/\n[https://console.aws.amazon.com/cloudtrail/]\n* Under All Buckets, click on the target bucket you wish to evaluate\n* Click Properties on the top right of the console\n* Click Trails in the left menu\n* Click on each trail where no CloudWatch Logs are defined\n* Go to the CloudWatch Logs section and click on Configure\n* Define a new or select an existing log group\n* Click on Continue\n\n* Configure IAM Role which will deliver CloudTrail events to CloudWatch Logs\n\n* Create/Select an IAM Role and Policy Name\n* Click Allow to continue\n\n'Via CLI\n\n'aws cloudtrail update-trail --name _<trail_name>_\n--cloudwatch-logs-log-group-arn _<cloudtrail_log_group_arn>_\n--cloudwatch-logs-role-arn _<__cloudtrail_cloudwatchLogs_role_arn>_"},"code":"control 'cis-aws-foundations-2.4' do\n  title 'Ensure CloudTrail trails are integrated with CloudWatch Logs'\n  desc  \"AWS CloudTrail is a web service that records AWS API calls made in a\ngiven AWS account. The recorded information includes the identity of the API\ncaller, the time of the API call, the source IP address of the API caller, the\nrequest parameters, and the response elements returned by the AWS service.\nCloudTrail uses Amazon S3 for log file storage and delivery, so log files are\nstored durably. In addition to capturing CloudTrail logs within a specified S3\nbucket for long term analysis, realtime analysis can be performed by\nconfiguring CloudTrail to send logs to CloudWatch Logs. For a trail that is\nenabled in all regions in an account, CloudTrail sends log files from all those\nregions to a CloudWatch Logs log group. It is recommended that CloudTrail logs\nbe sent to CloudWatch Logs.\n\n'Note: The intent of this recommendation is to ensure AWS account activity is\nbeing captured, monitored, and appropriately alarmed on. CloudWatch Logs is a\nnative way to accomplish this using AWS services but does not preclude the use\nof an alternate solution.\"\n  impact 0.3\n  tag \"rationale\": \"Sending CloudTrail logs to CloudWatch Logs will facilitate\nreal-time and historic activity logging based on user, API, resource, and IP\naddress, and provides opportunity to establish alarms and notifications for\nanomalous or sensitivity account activity.\"\n  tag \"cis_impact\": \"Note: By default, CloudWatch Logs will store Logs\nindefinitely unless a specific retention period is defined for the log group.\nWhen choosing the number of days to retain, keep in mind the average days it\ntakes an organization to realize they have been breached is 210 days (at the\ntime of this writing). Since additional time is required to research a breach,\na minimum 365 day retention policy allows time for detection and research. You\nmay also wish to archive the logs to a cheaper storage service rather than\nsimply deleting them. See the following AWS resource to manage CloudWatch Logs\nretention periods:\n\n*\nhttp://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/SettingLogRetention.html\"\n  tag \"cis_rid\": '2.4'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['6.6', '14.6'], '6.0']\n  tag \"nist\": ['SI-4(2)', 'AU-2', 'Rev_4']\n  tag \"cce_id\": 'CCE-78916-4'\n  tag \"check\": \"Perform the following to ensure CloudTrail is configured as\nprescribed:\n\n'Via the AWS management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/\n[https://console.aws.amazon.com/cloudtrail/]\n* Under All Buckets, click on the target bucket you wish to evaluate\n* Click Properties on the top right of the console\n* Click Trails in the left menu\n* Ensure a CloudWatch Logs log group is configured and has a recent (~one day\nold) Last log file delivered timestamp.\n\n'Via CLI\n\n* Run the following command to get a listing of existing trails:\n\n'aws cloudtrail describe-trails\n* Ensure CloudWatchLogsLogGroupArn is not empty and note the value of the Name\nproperty.\n\n* Using the noted value of the Name property, run the following command:\n\n'aws cloudtrail get-trail-status --name _<trail_name>_\n* Ensure the LatestcloudwatchLogdDeliveryTime property is set to a recent (~one\nday old) timestamp.\"\n  tag \"fix\": \"Perform the following to establish the prescribed state:\n\n'Via the AWS management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/\n[https://console.aws.amazon.com/cloudtrail/]\n* Under All Buckets, click on the target bucket you wish to evaluate\n* Click Properties on the top right of the console\n* Click Trails in the left menu\n* Click on each trail where no CloudWatch Logs are defined\n* Go to the CloudWatch Logs section and click on Configure\n* Define a new or select an existing log group\n* Click on Continue\n\n* Configure IAM Role which will deliver CloudTrail events to CloudWatch Logs\n\n* Create/Select an IAM Role and Policy Name\n* Click Allow to continue\n\n'Via CLI\n\n'aws cloudtrail update-trail --name _<trail_name>_\n--cloudwatch-logs-log-group-arn _<cloudtrail_log_group_arn>_\n--cloudwatch-logs-role-arn _<__cloudtrail_cloudwatchLogs_role_arn>_\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    describe aws_cloudtrail_trail(trail) do\n      its('cloud_watch_logs_log_group_arn') { should_not be_nil }\n      its('delivered_logs_days_ago') { should cmp <= 1 }\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.4.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000217404,"start_time":"2020-06-19T14:44:12+00:00"},{"status":"passed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis cloud_watch_logs_log_group_arn is expected not to be nil","run_time":0.000161003,"start_time":"2020-06-19T14:44:12+00:00"},{"status":"failed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis delivered_logs_days_ago is expected to cmp <= 1","run_time":0.089645543,"start_time":"2020-06-19T14:44:12+00:00","message":"\nexpected it to be <= 1\n     got: 2\n\n(compared using `cmp` matcher)\n"}]},{"id":"cis-aws-foundations-4.3","title":"Ensure VPC flow logging is enabled in all VPCs","desc":"VPC Flow Logs is a feature that enables you to capture information\nabout the IP traffic going to and from network interfaces in your VPC. After\nyou've created a flow log, you can view and retrieve its data in Amazon\nCloudWatch Logs. It is recommended that VPC Flow Logs be enabled for packet\n'Rejects' for VPCs.","descriptions":[{"label":"default","data":"VPC Flow Logs is a feature that enables you to capture information\nabout the IP traffic going to and from network interfaces in your VPC. After\nyou've created a flow log, you can view and retrieve its data in Amazon\nCloudWatch Logs. It is recommended that VPC Flow Logs be enabled for packet\n'Rejects' for VPCs."}],"impact":0.7,"refs":[],"tags":{"rationale":"VPC Flow Logs provide visibility into network traffic that\ntraverses the VPC and can be used to detect anomalous traffic or insight during\nsecurity workflows.","cis_impact":"By default, CloudWatch Logs will store Logs indefinitely\nunless a specific retention period is defined for the log group. When choosing\nthe number of days to retain, keep in mind the average days it takes an\norganization to realize they have been breached is 210 days (at the time of\nthis writing). Since additional time is required to research a breach, a\nminimum 365 day retention policy allows time for detection and research. You\nmay also wish to archive the logs to a cheaper storage service rather than\nsimply deleting them. See the following AWS resource to manage CloudWatch Logs\nretention periods:\n\n*\nhttp://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/SettingLogRetention.html","cis_rid":"4.3","cis_level":2,"cis_control_number":"","nist":["SI-4(4)","Rev_4"],"cce_id":"CCE-79202-8","check":"Perform the following to determine if VPC Flow logs is enabled:\n\n\n'Via the Management Console:\n\n* Sign into the management console\n* Select Services then VPC\n* In the left navigation pane, select Your VPCs\n* Select a VPC\n* In the right pane, select the Flow Logs tab.\n* Ensure a Log Flow exists that has Active in the Status column.","fix":"Perform the following to determine if VPC Flow logs is enabled:\n\n'Via the Management Console:\n\n* Sign into the management console\n* Select Services then VPC\n* In the left navigation pane, select Your VPCs\n* Select a VPC\n* In the right pane, select the Flow Logs tab.\n* If no Flow Log exists, click Create Flow Log\n* For Filter, select Reject\n* Enter in a Role and Destination Log Group\n* Click Create Log Flow\n* Click on CloudWatch Logs Group\n\n'NOTE: Setting the filter to 'Reject' will dramatically reduce the logging data\naccumulation for this recommendation and provide sufficient information for the\npurposes of breach detection, research and remediation. However, during periods\nof least privilege security group engineering, setting this the filter to 'All'\ncan be very helpful in discovering existing traffic flows required for proper\noperation of an already running environment.\n\n'\n"},"code":"control 'cis-aws-foundations-4.3' do\n  title 'Ensure VPC flow logging is enabled in all VPCs'\n  desc  \"VPC Flow Logs is a feature that enables you to capture information\nabout the IP traffic going to and from network interfaces in your VPC. After\nyou've created a flow log, you can view and retrieve its data in Amazon\nCloudWatch Logs. It is recommended that VPC Flow Logs be enabled for packet\n'Rejects' for VPCs.\"\n  impact 0.7\n  tag \"rationale\": \"VPC Flow Logs provide visibility into network traffic that\ntraverses the VPC and can be used to detect anomalous traffic or insight during\nsecurity workflows.\"\n  tag \"cis_impact\": \"By default, CloudWatch Logs will store Logs indefinitely\nunless a specific retention period is defined for the log group. When choosing\nthe number of days to retain, keep in mind the average days it takes an\norganization to realize they have been breached is 210 days (at the time of\nthis writing). Since additional time is required to research a breach, a\nminimum 365 day retention policy allows time for detection and research. You\nmay also wish to archive the logs to a cheaper storage service rather than\nsimply deleting them. See the following AWS resource to manage CloudWatch Logs\nretention periods:\n\n*\nhttp://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/SettingLogRetention.html\"\n  tag \"cis_rid\": '4.3'\n  tag \"cis_level\": 2\n  tag \"cis_control_number\": ''\n  tag \"nist\": ['SI-4(4)', 'Rev_4']\n  tag \"cce_id\": 'CCE-79202-8'\n  tag \"check\": \"Perform the following to determine if VPC Flow logs is enabled:\n\n\n'Via the Management Console:\n\n* Sign into the management console\n* Select Services then VPC\n* In the left navigation pane, select Your VPCs\n* Select a VPC\n* In the right pane, select the Flow Logs tab.\n* Ensure a Log Flow exists that has Active in the Status column.\"\n  tag \"fix\": \"Perform the following to determine if VPC Flow logs is enabled:\n\n'Via the Management Console:\n\n* Sign into the management console\n* Select Services then VPC\n* In the left navigation pane, select Your VPCs\n* Select a VPC\n* In the right pane, select the Flow Logs tab.\n* If no Flow Log exists, click Create Flow Log\n* For Filter, select Reject\n* Enter in a Role and Destination Log Group\n* Click Create Log Flow\n* Click on CloudWatch Logs Group\n\n'NOTE: Setting the filter to 'Reject' will dramatically reduce the logging data\naccumulation for this recommendation and provide sufficient information for the\npurposes of breach detection, research and remediation. However, during periods\nof least privilege security group engineering, setting this the filter to 'All'\ncan be very helpful in discovering existing traffic flows required for proper\noperation of an already running environment.\n\n'\n\"\n  aws_vpcs.vpc_ids.each do |vpc|\n    describe aws_vpc(vpc) do\n      it { should be_flow_logs_enabled }\n    end\n    describe.one do\n      aws_vpc(vpc).flow_logs.each do |flow_log|\n        describe 'flow log settings' do\n          subject { flow_log }\n          its('traffic_type') { should cmp 'REJECT' }\n        end\n      end\n    end\n  end\n  if aws_vpcs.vpc_ids.empty?\n    describe 'Control skipped because no vpcs were found' do\n      skip 'This control is skipped since the aws_vpcs resource returned an empty vpc list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-4.3.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"VPC vpc-01b5f9a36305ddf47 is expected to be flow logs enabled","run_time":0.144800755,"start_time":"2020-06-19T14:44:12+00:00","message":"expected `VPC vpc-01b5f9a36305ddf47.flow_logs_enabled?` to return true, got false"},{"status":"failed","code_desc":"VPC vpc-a5cb1fce is expected to be flow logs enabled","run_time":0.072987438,"start_time":"2020-06-19T14:44:12+00:00","message":"expected `VPC vpc-a5cb1fce.flow_logs_enabled?` to return true, got false"}]},{"id":"cis-aws-foundations-2.2","title":"Ensure CloudTrail log file validation is enabled","desc":"CloudTrail log file validation creates a digitally signed digest file\ncontaining a hash of each log that CloudTrail writes to S3. These digest files\ncan be used to determine whether a log file was changed, deleted, or unchanged\nafter CloudTrail delivered the log. It is recommended that file validation be\nenabled on all CloudTrails.","descriptions":[{"label":"default","data":"CloudTrail log file validation creates a digitally signed digest file\ncontaining a hash of each log that CloudTrail writes to S3. These digest files\ncan be used to determine whether a log file was changed, deleted, or unchanged\nafter CloudTrail delivered the log. It is recommended that file validation be\nenabled on all CloudTrails."}],"impact":0.7,"refs":[],"tags":{"rationale":"Enabling log file validation will provide additional\nintegrity checking of CloudTrail logs.","cis_impact":"","cis_rid":"2.2","cis_level":2,"csc_control":[["6.3"],"6.0"],"nist":["AU-4","Rev_4"],"cce_id":"CCE-78914-9","check":"Perform the following on each trail to determine if log file\nvalidation is enabled:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n\n* Click on Trails on the left navigation pane\n\n* You will be presented with a list of trails across all regions\n\n\n* Ensure at least one Trail has All specified in the Region column\n* Click on a trail via the link in the _Name_ column\n* Under the S3 section, ensure Enable log file validation is set to Yes\n\n'Via CLI\n\n'aws cloudtrail describe-trails\n\n'Ensure LogFileValidationEnabled is set to true for each trail.","fix":"Perform the following to enable log file validation on a given\ntrail:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* Click on Trails on the left navigation pane\n* Click on target trail\n* Within the S3 section click on the edit icon (pencil)\n* Click Advanced\n* Click on the Yes radio button in section Enable log file validation\n* Click Save\n\n'Via CLI\n\n'aws cloudtrail update-trail --name _<trail_name>_ --enable-log-file-validation\n\n\n'Note that periodic validation of logs using these digests can be performed by\nrunning the following command:\n\n'aws cloudtrail validate-logs --trail-arn _<trail_arn>_ --start-time\n_<start_time>_ --end-time _<end_time>_"},"code":"control 'cis-aws-foundations-2.2' do\n  title 'Ensure CloudTrail log file validation is enabled'\n  desc  \"CloudTrail log file validation creates a digitally signed digest file\ncontaining a hash of each log that CloudTrail writes to S3. These digest files\ncan be used to determine whether a log file was changed, deleted, or unchanged\nafter CloudTrail delivered the log. It is recommended that file validation be\nenabled on all CloudTrails.\"\n  impact 0.7\n  tag \"rationale\": \"Enabling log file validation will provide additional\nintegrity checking of CloudTrail logs.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '2.2'\n  tag \"cis_level\": 2\n  tag \"csc_control\": [['6.3'], '6.0']\n  tag \"nist\": ['AU-4', 'Rev_4']\n  tag \"cce_id\": 'CCE-78914-9'\n  tag \"check\": \"Perform the following on each trail to determine if log file\nvalidation is enabled:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n\n* Click on Trails on the left navigation pane\n\n* You will be presented with a list of trails across all regions\n\n\n* Ensure at least one Trail has All specified in the Region column\n* Click on a trail via the link in the _Name_ column\n* Under the S3 section, ensure Enable log file validation is set to Yes\n\n'Via CLI\n\n'aws cloudtrail describe-trails\n\n'Ensure LogFileValidationEnabled is set to true for each trail.\"\n  tag \"fix\": \"Perform the following to enable log file validation on a given\ntrail:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* Click on Trails on the left navigation pane\n* Click on target trail\n* Within the S3 section click on the edit icon (pencil)\n* Click Advanced\n* Click on the Yes radio button in section Enable log file validation\n* Click Save\n\n'Via CLI\n\n'aws cloudtrail update-trail --name _<trail_name>_ --enable-log-file-validation\n\n\n'Note that periodic validation of logs using these digests can be performed by\nrunning the following command:\n\n'aws cloudtrail validate-logs --trail-arn _<trail_arn>_ --start-time\n_<start_time>_ --end-time _<end_time>_\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    describe aws_cloudtrail_trail(trail) do\n      it { should be_log_file_validation_enabled }\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.2.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000289706,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis is expected to be log file validation enabled","run_time":0.022491512,"start_time":"2020-06-19T14:44:13+00:00"}]},{"id":"cis-aws-foundations-2.8","title":"Ensure rotation for customer created CMKs is enabled","desc":"AWS Key Management Service (KMS) allows customers to rotate the\nbacking key which is key material stored within the KMS which is tied to the\nkey ID of the Customer Created customer master key (CMK). It is the backing key\nthat is used to perform cryptographic operations such as encryption and\ndecryption. Automated key rotation currently retains all prior backing keys so\nthat decryption of encrypted data can take place transparently. It is\nrecommended that CMK key rotation be enabled.","descriptions":[{"label":"default","data":"AWS Key Management Service (KMS) allows customers to rotate the\nbacking key which is key material stored within the KMS which is tied to the\nkey ID of the Customer Created customer master key (CMK). It is the backing key\nthat is used to perform cryptographic operations such as encryption and\ndecryption. Automated key rotation currently retains all prior backing keys so\nthat decryption of encrypted data can take place transparently. It is\nrecommended that CMK key rotation be enabled."}],"impact":0.7,"refs":[],"tags":{"rationale":"Rotating encryption keys helps reduce the potential impact\nof a compromised key as data encrypted with a new key cannot be accessed with a\nprevious key that may have been exposed.","cis_impact":"","cis_rid":"2.8","cis_level":2,"csc_control":"","nist":["SC-12","Rev_4"],"cce_id":"CCE-78920-6","check":"Via the Management Console:\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam [https://console.aws.amazon.com/iam].\n\n 'In the left navigation pane, choose Encryption Keys.\n* Select a customer created master key (CMK)\n* Under the Key Policy section, move down to Key Rotation_._\n* Ensure the Rotate this key every year checkbox is checked.\n\n'Via CLI\n\n* Run the following command to get a list of all keys and their associated\nKeyIds\n\n'aws kms list-keys\n\n* For each key, note the KeyId and run the following command\n\n'aws kms get-key-rotation-status --key-id _<kms_key_id>_\n* Ensure KeyRotationEnabled is set to true","fix":"Via the Management Console:\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam [https://console.aws.amazon.com/iam].\n\n 'In the left navigation pane, choose Encryption Keys.\n* Select a customer created master key (CMK)\n* Under the Key Policy section, move down to Key Rotation_._\n* Check the Rotate this key every year checkbox.\n\n'Via CLI\n\n* Run the following command to enable key rotation:\n\n'aws kms enable-key-rotation --key-id _<kms_key_id>_\n"},"code":"control 'cis-aws-foundations-2.8' do\n  title 'Ensure rotation for customer created CMKs is enabled'\n  desc  \"AWS Key Management Service (KMS) allows customers to rotate the\nbacking key which is key material stored within the KMS which is tied to the\nkey ID of the Customer Created customer master key (CMK). It is the backing key\nthat is used to perform cryptographic operations such as encryption and\ndecryption. Automated key rotation currently retains all prior backing keys so\nthat decryption of encrypted data can take place transparently. It is\nrecommended that CMK key rotation be enabled.\"\n  impact 0.7\n  tag \"rationale\": \"Rotating encryption keys helps reduce the potential impact\nof a compromised key as data encrypted with a new key cannot be accessed with a\nprevious key that may have been exposed.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '2.8'\n  tag \"cis_level\": 2\n  tag \"csc_control\": ''\n  tag \"nist\": ['SC-12', 'Rev_4']\n  tag \"cce_id\": 'CCE-78920-6'\n  tag \"check\": \"Via the Management Console:\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam [https://console.aws.amazon.com/iam].\n\n 'In the left navigation pane, choose Encryption Keys.\n* Select a customer created master key (CMK)\n* Under the Key Policy section, move down to Key Rotation_._\n* Ensure the Rotate this key every year checkbox is checked.\n\n'Via CLI\n\n* Run the following command to get a list of all keys and their associated\nKeyIds\n\n'aws kms list-keys\n\n* For each key, note the KeyId and run the following command\n\n'aws kms get-key-rotation-status --key-id _<kms_key_id>_\n* Ensure KeyRotationEnabled is set to true\"\n  tag \"fix\": \"Via the Management Console:\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam [https://console.aws.amazon.com/iam].\n\n 'In the left navigation pane, choose Encryption Keys.\n* Select a customer created master key (CMK)\n* Under the Key Policy section, move down to Key Rotation_._\n* Check the Rotate this key every year checkbox.\n\n'Via CLI\n\n* Run the following command to enable key rotation:\n\n'aws kms enable-key-rotation --key-id _<kms_key_id>_\n\"\n  aws_kms_keys.key_arns.each do |key|\n    next unless aws_kms_key(key).enabled? && !aws_kms_key(key).managed_by_aws?\n\n    describe aws_kms_key(key) do\n      it { should have_rotation_enabled }\n    end\n  end\n\n  if aws_kms_keys.key_arns.none? { |key| aws_kms_key(key).enabled? && !aws_kms_key(key).managed_by_aws? }\n    describe 'Control skipped because no enabled kms keys were found' do\n      skip 'This control is skipped since the aws_kms_keys resource returned an empty coustomer managed and enabled kms key list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.8.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"KMS Key 08545b2c-79f3-4979-9f39-63ff94cd9e19 is expected to have rotation enabled","run_time":0.013821353,"start_time":"2020-06-19T14:44:13+00:00","message":"expected #has_rotation_enabled? to return true, got false"},{"status":"failed","code_desc":"KMS Key 428fac8f-6f09-48c4-aa57-58477af00a87 is expected to have rotation enabled","run_time":0.00378647,"start_time":"2020-06-19T14:44:13+00:00","message":"expected #has_rotation_enabled? to return true, got false"}]},{"id":"cis-aws-foundations-1.13","title":"Ensure MFA is enabled for the 'root' account","desc":"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device.\n\n'NOTE: When virtual MFA is used for root accounts, it is recommended that the\ndevice used is NOT a personal device, but rather a dedicated mobile device\n(tablet or phone) that is managed to be kept charged and secured independent of\nany individual personal devices. ('non-personal virtual MFA') This lessens the\nrisks of losing access to the MFA due to device loss, device trade-in or if the\nindividual owning the device is no longer employed at the company.","descriptions":[{"label":"default","data":"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device.\n\n'NOTE: When virtual MFA is used for root accounts, it is recommended that the\ndevice used is NOT a personal device, but rather a dedicated mobile device\n(tablet or phone) that is managed to be kept charged and secured independent of\nany individual personal devices. ('non-personal virtual MFA') This lessens the\nrisks of losing access to the MFA due to device loss, device trade-in or if the\nindividual owning the device is no longer employed at the company."}],"impact":0.3,"refs":[],"tags":{"rationale":"Enabling MFA provides increased security for console access\nas it requires the authenticating principal to possess a device that emits a\ntime-sensitive key and have knowledge of a credential.","cis_impact":"","cis_rid":"1.13","cis_level":1,"csc_control":[["5.6","11.4","12.6","16.11"],"6.0"],"nist":["IA-2(1)","SC-23","Rev_4"],"cce_id":"CCE-78911-5","check":"Perform the following to determine if the root account has MFA\nsetup:\n\n\n* Run the following command:\n\n'aws iam get-account-summary | grep 'AccountMFAEnabled'\n* Ensure the AccountMFAEnabled property is set to 1\n\n\n","fix":"Perform the following to establish MFA for the root account:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].<div\nclass='aws-note'>\n\n'Note: to manage MFA devices for the root AWS account, you must use your root\naccount credentials to sign in to AWS. You cannot manage MFA devices for the\nroot account using other credentials.\n\n\n 'Choose Dashboard, and under Security Status, expand Activate MFA on your root\naccount.\n\n 'Choose Activate MFA\n\n 'In the wizard, choose A virtual MFA device and then choose Next Step.\n\n 'IAM generates and displays configuration information for the virtual MFA\ndevice, including a QR code graphic. The graphic is a representation of the\n'secret configuration key' that is available for manual entry on devices that\ndo not support QR codes.\n\n 'Open your virtual MFA application. (For a list of apps that you can use for\nhosting virtual MFA devices, see Virtual MFA Applications\n[http://aws.amazon.com/iam/details/mfa/#Virtual_MFA_Applications].) If the\nvirtual MFA application supports multiple accounts (multiple virtual MFA\ndevices), choose the option to create a new account (a new virtual MFA device).\n\n 'Determine whether the MFA app supports QR codes, and then do one of the\nfollowing:\n\n 'Use the app to scan the QR code. For example, you might choose the camera icon\nor choose an option similar to Scan code, and then use the device's camera to\nscan the code.\n\n 'In the Manage MFA Device wizard, choose Show secret key for manual\nconfiguration, and then type the secret configuration key into your MFA\napplication.\n\n\n'When you are finished, the virtual MFA device starts generating one-time\npasswords.\n\n 'In the Manage MFA Device wizard, in the Authentication Code 1 box, type the\none-time password that currently appears in the virtual MFA device. Wait up to\n30 seconds for the device to generate a new one-time password. Then type the\nsecond one-time password into the Authentication Code 2 box. Choose Active\nVirtual MFA.\n"},"code":"control 'cis-aws-foundations-1.13' do\n  title \"Ensure MFA is enabled for the 'root' account\"\n  desc  \"The root account is the most privileged user in an AWS account. MFA\nadds an extra layer of protection on top of a user name and password. With MFA\nenabled, when a user signs in to an AWS website, they will be prompted for\ntheir user name and password as well as for an authentication code from their\nAWS MFA device.\n\n'NOTE: When virtual MFA is used for root accounts, it is recommended that the\ndevice used is NOT a personal device, but rather a dedicated mobile device\n(tablet or phone) that is managed to be kept charged and secured independent of\nany individual personal devices. ('non-personal virtual MFA') This lessens the\nrisks of losing access to the MFA due to device loss, device trade-in or if the\nindividual owning the device is no longer employed at the company.\"\n  impact 0.3\n  tag \"rationale\": \"Enabling MFA provides increased security for console access\nas it requires the authenticating principal to possess a device that emits a\ntime-sensitive key and have knowledge of a credential.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.13'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['5.6', '11.4', '12.6', '16.11'], '6.0']\n  tag \"nist\": ['IA-2(1)', 'SC-23', 'Rev_4']\n  tag \"cce_id\": 'CCE-78911-5'\n  tag \"check\": \"Perform the following to determine if the root account has MFA\nsetup:\n\n\n* Run the following command:\n\n'aws iam get-account-summary | grep 'AccountMFAEnabled'\n* Ensure the AccountMFAEnabled property is set to 1\n\n\n\"\n  tag \"fix\": \"Perform the following to establish MFA for the root account:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].<div\nclass='aws-note'>\n\n'Note: to manage MFA devices for the root AWS account, you must use your root\naccount credentials to sign in to AWS. You cannot manage MFA devices for the\nroot account using other credentials.\n\n\n 'Choose Dashboard, and under Security Status, expand Activate MFA on your root\naccount.\n\n 'Choose Activate MFA\n\n 'In the wizard, choose A virtual MFA device and then choose Next Step.\n\n 'IAM generates and displays configuration information for the virtual MFA\ndevice, including a QR code graphic. The graphic is a representation of the\n'secret configuration key' that is available for manual entry on devices that\ndo not support QR codes.\n\n 'Open your virtual MFA application. (For a list of apps that you can use for\nhosting virtual MFA devices, see Virtual MFA Applications\n[http://aws.amazon.com/iam/details/mfa/#Virtual_MFA_Applications].) If the\nvirtual MFA application supports multiple accounts (multiple virtual MFA\ndevices), choose the option to create a new account (a new virtual MFA device).\n\n 'Determine whether the MFA app supports QR codes, and then do one of the\nfollowing:\n\n 'Use the app to scan the QR code. For example, you might choose the camera icon\nor choose an option similar to Scan code, and then use the device's camera to\nscan the code.\n\n 'In the Manage MFA Device wizard, choose Show secret key for manual\nconfiguration, and then type the secret configuration key into your MFA\napplication.\n\n\n'When you are finished, the virtual MFA device starts generating one-time\npasswords.\n\n 'In the Manage MFA Device wizard, in the Authentication Code 1 box, type the\none-time password that currently appears in the virtual MFA device. Wait up to\n30 seconds for the device to generate a new one-time password. Then type the\nsecond one-time password into the Authentication Code 2 box. Choose Active\nVirtual MFA.\n\"\n  describe aws_iam_root_user do\n    it { should have_mfa_enabled }\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.13.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"AWS Root-User is expected to have mfa enabled","run_time":0.241702732,"start_time":"2020-06-19T14:44:13+00:00","message":"expected #has_mfa_enabled? to return true, got false"}]},{"id":"cis-aws-foundations-1.10","title":"Ensure IAM password policy prevents password reuse","desc":"IAM password policies can prevent the reuse of a given password by the\nsame user. It is recommended that the password policy prevent the reuse of\npasswords.","descriptions":[{"label":"default","data":"IAM password policies can prevent the reuse of a given password by the\nsame user. It is recommended that the password policy prevent the reuse of\npasswords."}],"impact":0.3,"refs":[],"tags":{"rationale":"Preventing password reuse increases account resiliency\nagainst brute force login attempts.","cis_impact":"","cis_rid":"1.10","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78908-1","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Prevent password reuse' is checked\n* Ensure 'Number of passwords to remember' is set to 24\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'PasswordReusePrevention': 24","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Prevent password reuse'\n* Set 'Number of passwords to remember' is set to 24\n\n' Via CLI\n\n' aws iam update-account-password-policy --password-reuse-prevention 24\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.10' do\n  title 'Ensure IAM password policy prevents password reuse'\n  desc  \"IAM password policies can prevent the reuse of a given password by the\nsame user. It is recommended that the password policy prevent the reuse of\npasswords.\"\n  impact 0.3\n  tag \"rationale\": \"Preventing password reuse increases account resiliency\nagainst brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.10'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78908-1'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Prevent password reuse' is checked\n* Ensure 'Number of passwords to remember' is set to 24\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'PasswordReusePrevention': 24\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Prevent password reuse'\n* Set 'Number of passwords to remember' is set to 24\n\n' Via CLI\n\n' aws iam update-account-password-policy --password-reuse-prevention 24\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('prevent_password_reuse?') { should be true }\n    its('number_of_passwords_to_remember') { should cmp <= 24 }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.10.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000189504,"start_time":"2020-06-19T14:44:13+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-4.1","title":"Ensure no security groups allow ingress from 0.0.0.0/0 to port 22","desc":"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 22.","descriptions":[{"label":"default","data":"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 22."}],"impact":0.3,"refs":[],"tags":{"rationale":"Removing unfettered connectivity to remote console\nservices, such as SSH, reduces a server's exposure to risk.","cis_impact":"For updating an existing environment, care should be taken\nto ensure that administrators currently relying on an existing ingress from\n0.0.0.0/0 have access to ports 22 and/or 3389 through another security group.","cis_rid":"4.1","cis_level":1,"cis_control_number":"","nist":["SC-7(5)","Rev_4"],"cce_id":"","check":"Perform the following to determine if the account is configured\nas prescribed:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Ensure no rule exists that has a port range that includes port 22 and has a\nSource of 0.0.0.0/0\n\nNote: A Port value of ALL or a port range such as 0-1024 are inclusive of port\n22.\n","fix":"Perform the following to implement the prescribed state:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Identify the rules to be removed\n* Click the x in the Remove column\n* Click Save"},"code":"control 'cis-aws-foundations-4.1' do\n  title 'Ensure no security groups allow ingress from 0.0.0.0/0 to port 22'\n  desc  \"Security groups provide stateful filtering of ingress/egress network\ntraffic to AWS resources. It is recommended that no security group allows\nunrestricted ingress access to port 22.\"\n  impact 0.3\n  tag \"rationale\": \"Removing unfettered connectivity to remote console\nservices, such as SSH, reduces a server's exposure to risk.\"\n  tag \"cis_impact\": \"For updating an existing environment, care should be taken\nto ensure that administrators currently relying on an existing ingress from\n0.0.0.0/0 have access to ports 22 and/or 3389 through another security group.\"\n  tag \"cis_rid\": '4.1'\n  tag \"cis_level\": 1\n  tag \"cis_control_number\": ''\n  tag \"nist\": ['SC-7(5)', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Perform the following to determine if the account is configured\nas prescribed:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Ensure no rule exists that has a port range that includes port 22 and has a\nSource of 0.0.0.0/0\n\nNote: A Port value of ALL or a port range such as 0-1024 are inclusive of port\n22.\n\"\n  tag \"fix\": \"Perform the following to implement the prescribed state:\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* In the left pane, click Security Groups\n* For each security group, perform the following:\n\n* Select the security group\n* Click the Inbound Rules tab\n* Identify the rules to be removed\n* Click the x in the Remove column\n* Click Save\"\n\n  aws_security_groups.group_ids.each do |group_id|\n    if exception_security_group_list.include?(group_id)\n      describe 'Security Group not inspected because it is defined as an exception' do\n        skip \"Security Group:: #{group_id} not inspected because it is defined in exception_security_group_list.\"\n      end\n    end\n\n    next if exception_security_group_list.include?(group_id)\n\n    describe aws_security_group(group_id) do\n      it { should_not allow_in(port: 22, ipv4_range: '0.0.0.0/0') }\n    end\n  end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-4.1.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"EC2 Security Group sg-0445e37d is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>22}","run_time":0.003387962,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"EC2 Security Group sg-096195c1021874188 is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>22}","run_time":0.003289661,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"EC2 Security Group sg-0f4cc17ad346000a8 is expected not to allow in {:ipv4_range=>\"0.0.0.0/0\", :port=>22}","run_time":0.003374361,"start_time":"2020-06-19T14:44:13+00:00"}]},{"id":"cis-aws-foundations-1.2","title":"Ensure multi-factor authentication (MFA) is enabled for all IAM users\nthat have a console password","desc":"Multi-Factor Authentication (MFA) adds an extra layer of protection on\ntop of a user name and password. With MFA enabled, when a user signs in to an\nAWS website, they will be prompted for their user name and password as well as\nfor an authentication code from their AWS MFA device. It is recommended that\nMFA be enabled for all accounts that have a console password.","descriptions":[{"label":"default","data":"Multi-Factor Authentication (MFA) adds an extra layer of protection on\ntop of a user name and password. With MFA enabled, when a user signs in to an\nAWS website, they will be prompted for their user name and password as well as\nfor an authentication code from their AWS MFA device. It is recommended that\nMFA be enabled for all accounts that have a console password."}],"impact":0.3,"refs":[],"tags":{"rationale":"Enabling MFA provides increased security for console access\nas it requires the authenticating principal to possess a device that emits a\ntime-sensitive key and have knowledge of a credential.","cis_impact":"","cis_rid":"1.2","cis_level":1,"csc_control":[["5.6","11.4","12.6","16.11"],"6.0"],"nist":["IA-2(1)","SC-23","Rev_4"],"cce_id":"CCE-78901-6","check":"Perform the following to determine if a MFA device is enabled\nfor all IAM users having a console password:\nVia Management Console\n\n\n 'Open the IAM console at https://console.aws.amazon.com/iam/\n[https://console.aws.amazon.com/iam/].\n\n 'In the left pane, select Users\n\n 'If the MFA Device or Password columns are not visible in the table, click the\ngear icon at the upper right corner of the table and ensure a checkmark is next\nto both, then click Close.\n\n 'Ensure each user having a checkmark in the Password column also has a value in\nthe MFA Device column.\n\n\nVia the CLI\n\n\n* Run the following command (OSX/Linux/UNIX) to generate a list of all IAM\nusers along with their password and MFA status:\n\n'aws iam generate-credential-report\n\n'aws iam get-credential-report --query 'Content' --output text | base64 -d |\ncut -d, -f1,4,8\n\n* The output of this command will produce a table similar to the following:\n\n'user,password_enabled,mfa_active\nelise,false,false\nbrandon,true,true\nrakesh,false,false\nhelene,false,false\nparas,true,true\nanitha,false,false\n* For any column having password_enabled set to true, ensure mfa_active is also\nset to true.\n\n\n","fix":"Perform the following to enable MFA:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, choose Users.\n\n 'In the User Name list, choose the name of the intended MFA user.\n\n 'Choose the Security Credentials tab, and then choose Manage MFA Device.\n\n 'In the Manage MFA Device wizard, choose A virtual MFA device, and then choose\nNext Step.\n\n'IAM generates and displays configuration information for the virtual MFA\ndevice, including a QR code graphic. The graphic is a representation of the\n'secret configuration key' that is available for manual entry on devices that\ndo not support QR codes.\n\n 'Open your virtual MFA application. (For a list of apps that you can use for\nhosting virtual MFA devices, see Virtual MFA Applications\n[http://aws.amazon.com/iam/details/mfa/#Virtual_MFA_Applications].) If the\nvirtual MFA application supports multiple accounts (multiple virtual MFA\ndevices), choose the option to create a new account (a new virtual MFA device).\n\n 'Determine whether the MFA app supports QR codes, and then do one of the\nfollowing:<div class='itemizedlist'>\n\n 'Use the app to scan the QR code. For example, you might choose the camera icon\nor choose an option similar to Scan code, and then use the device's camera to\nscan the code.\n\n 'In the Manage MFA Device wizard, choose Show secret key for manual\nconfiguration, and then type the secret configuration key into your MFA\napplication.\n\n\n'When you are finished, the virtual MFA device starts generating one-time\npasswords.\n\n 'In the Manage MFA Device wizard, in the Authentication Code 1 box, type the\none-time password that currently appears in the virtual MFA device. Wait up to\n30 seconds for the device to generate a new one-time password. Then type the\nsecond one-time password into the Authentication Code 2 box. Choose Active\nVirtual MFA.\n\n\n'FORCED IAM USER SELF-SERVICE REMEDIATION\n\n'Amazon has published a pattern that forces users to self-service setup MFA\nbefore they have access to their complete permissions set. Until they complete\nthis step, they cannot access their full permissions. This pattern can be used\non new AWS accounts. It can also be used on existing accounts - it is\nrecommended users are given instructions and a grace period to accomplish MFA\nenrollment before active enforcement on existing AWS accounts.\n\n'How to Delegate Management of Multi-Factor Authentication to AWS IAM Users\n[http://blogs.aws.amazon.com/security/post/Tx2SJJYE082KBUK/How-to-Delegate-Management-of-Multi-Factor-Authentication-to-AWS-IAM-Users]"},"code":"control 'cis-aws-foundations-1.2' do\n  title \"Ensure multi-factor authentication (MFA) is enabled for all IAM users\nthat have a console password\"\n  desc  \"Multi-Factor Authentication (MFA) adds an extra layer of protection on\ntop of a user name and password. With MFA enabled, when a user signs in to an\nAWS website, they will be prompted for their user name and password as well as\nfor an authentication code from their AWS MFA device. It is recommended that\nMFA be enabled for all accounts that have a console password.\"\n  impact 0.3\n  tag \"rationale\": \"Enabling MFA provides increased security for console access\nas it requires the authenticating principal to possess a device that emits a\ntime-sensitive key and have knowledge of a credential.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.2'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['5.6', '11.4', '12.6', '16.11'], '6.0']\n  tag \"nist\": ['IA-2(1)', 'SC-23', 'Rev_4']\n  tag \"cce_id\": 'CCE-78901-6'\n  tag \"check\": \"Perform the following to determine if a MFA device is enabled\nfor all IAM users having a console password:\nVia Management Console\n\n\n 'Open the IAM console at https://console.aws.amazon.com/iam/\n[https://console.aws.amazon.com/iam/].\n\n 'In the left pane, select Users\n\n 'If the MFA Device or Password columns are not visible in the table, click the\ngear icon at the upper right corner of the table and ensure a checkmark is next\nto both, then click Close.\n\n 'Ensure each user having a checkmark in the Password column also has a value in\nthe MFA Device column.\n\n\nVia the CLI\n\n\n* Run the following command (OSX/Linux/UNIX) to generate a list of all IAM\nusers along with their password and MFA status:\n\n'aws iam generate-credential-report\n\n'aws iam get-credential-report --query 'Content' --output text | base64 -d |\ncut -d, -f1,4,8\n\n* The output of this command will produce a table similar to the following:\n\n'user,password_enabled,mfa_active\nelise,false,false\nbrandon,true,true\nrakesh,false,false\nhelene,false,false\nparas,true,true\nanitha,false,false\n* For any column having password_enabled set to true, ensure mfa_active is also\nset to true.\n\n\n\"\n  tag \"fix\": \"Perform the following to enable MFA:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, choose Users.\n\n 'In the User Name list, choose the name of the intended MFA user.\n\n 'Choose the Security Credentials tab, and then choose Manage MFA Device.\n\n 'In the Manage MFA Device wizard, choose A virtual MFA device, and then choose\nNext Step.\n\n'IAM generates and displays configuration information for the virtual MFA\ndevice, including a QR code graphic. The graphic is a representation of the\n'secret configuration key' that is available for manual entry on devices that\ndo not support QR codes.\n\n 'Open your virtual MFA application. (For a list of apps that you can use for\nhosting virtual MFA devices, see Virtual MFA Applications\n[http://aws.amazon.com/iam/details/mfa/#Virtual_MFA_Applications].) If the\nvirtual MFA application supports multiple accounts (multiple virtual MFA\ndevices), choose the option to create a new account (a new virtual MFA device).\n\n 'Determine whether the MFA app supports QR codes, and then do one of the\nfollowing:<div class='itemizedlist'>\n\n 'Use the app to scan the QR code. For example, you might choose the camera icon\nor choose an option similar to Scan code, and then use the device's camera to\nscan the code.\n\n 'In the Manage MFA Device wizard, choose Show secret key for manual\nconfiguration, and then type the secret configuration key into your MFA\napplication.\n\n\n'When you are finished, the virtual MFA device starts generating one-time\npasswords.\n\n 'In the Manage MFA Device wizard, in the Authentication Code 1 box, type the\none-time password that currently appears in the virtual MFA device. Wait up to\n30 seconds for the device to generate a new one-time password. Then type the\nsecond one-time password into the Authentication Code 2 box. Choose Active\nVirtual MFA.\n\n\n'FORCED IAM USER SELF-SERVICE REMEDIATION\n\n'Amazon has published a pattern that forces users to self-service setup MFA\nbefore they have access to their complete permissions set. Until they complete\nthis step, they cannot access their full permissions. This pattern can be used\non new AWS accounts. It can also be used on existing accounts - it is\nrecommended users are given instructions and a grace period to accomplish MFA\nenrollment before active enforcement on existing AWS accounts.\n\n'How to Delegate Management of Multi-Factor Authentication to AWS IAM Users\n[http://blogs.aws.amazon.com/security/post/Tx2SJJYE082KBUK/How-to-Delegate-Management-of-Multi-Factor-Authentication-to-AWS-IAM-Users]\"\n\n  users_without_mfa = aws_iam_users.where(has_console_password?: true).where(has_mfa_enabled?: false).usernames\n\n  if service_account_mfa_exceptions.compact.empty?\n    describe 'The active IAM users that do not have MFA enabled' do\n      subject { users_without_mfa }\n      it { should be_empty }\n    end\n  end\n\n  unless service_account_mfa_exceptions.compact.empty?\n    describe \"The active IAM users that do not have MFA enabled\n    (except for the documented service accounts: #{service_account_mfa_exceptions})\" do\n      subject { users_without_mfa - service_account_mfa_exceptions }\n      it { should be_empty }\n    end\n  end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.2.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"The active IAM users that do not have MFA enabled\n    (except for the documented service accounts: [\"service_account_mfa_exceptions\"]) is expected to be empty","run_time":0.012777534,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `[\"test-one\"].empty?` to return true, got false"}]},{"id":"cis-aws-foundations-2.6","title":"Ensure S3 bucket access logging is enabled on the CloudTrail S3 bucket","desc":"S3 Bucket Access Logging generates a log that contains access records\nfor each request made to your S3 bucket. An access log record contains details\nabout the request, such as the request type, the resources specified in the\nrequest worked, and the time and date the request was processed. It is\nrecommended that bucket access logging be enabled on the CloudTrail S3 bucket.","descriptions":[{"label":"default","data":"S3 Bucket Access Logging generates a log that contains access records\nfor each request made to your S3 bucket. An access log record contains details\nabout the request, such as the request type, the resources specified in the\nrequest worked, and the time and date the request was processed. It is\nrecommended that bucket access logging be enabled on the CloudTrail S3 bucket."}],"impact":0.3,"refs":[],"tags":{"rationale":"By enabling S3 bucket logging on target S3 buckets, it is\npossible to capture all events which may affect objects within an target\nbuckets. Configuring logs to be placed in a separate bucket allows access to\nlog information which can be useful in security and incident response\nworkflows.","cis_impact":"","cis_rid":"2.6","cis_level":1,"csc_control":[["14.6"],"6.0"],"nist":["AU-2","Rev_4"],"cce_id":"CCE-78918-0","check":"Perform the following ensure the CloudTrail S3 bucket has\naccess logging is enabled:\n\n'Via the management Console\n\n* Go to the Amazon CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/home\n[https://console.aws.amazon.com/cloudtrail/home]\n* In the API activity history pane on the left, click Trails\n* In the Trails pane, note the bucket names in the S3 bucket column\n* Sign in to the AWS Management Console and open the S3 console at\nhttps://console.aws.amazon.com/s3 [https://console.aws.amazon.com/s3].\n* Under All Buckets click on a target S3 bucket\n* Click on Properties in the top right of the console\n* Under Bucket:_<bucket_name>_ click on Logging\n* Ensure Enabled is checked.\n\n'Via CLI\n\n'aws s3api get-bucket-logging --bucket <s3_bucket_for_cloudtrail>","fix":"Perform the following to enable S3 bucket logging:\n\n'Via the Management Console\n\n* Sign in to the AWS Management Console and open the S3 console at\nhttps://console.aws.amazon.com/s3 [https://console.aws.amazon.com/s3].\n* Under All Buckets click on the target S3 bucket\n* Click on Properties in the top right of the console\n* Under Bucket:<s3_bucket_for_cloudtrail> click on Logging\n\n* Configure bucket logging\n\n* Click on Enabled checkbox\n* Select Target Bucket from list\n* Enter a Target Prefix\n* Click Save"},"code":"control 'cis-aws-foundations-2.6' do\n  title 'Ensure S3 bucket access logging is enabled on the CloudTrail S3 bucket'\n  desc  \"S3 Bucket Access Logging generates a log that contains access records\nfor each request made to your S3 bucket. An access log record contains details\nabout the request, such as the request type, the resources specified in the\nrequest worked, and the time and date the request was processed. It is\nrecommended that bucket access logging be enabled on the CloudTrail S3 bucket.\"\n  impact 0.3\n  tag \"rationale\": \"By enabling S3 bucket logging on target S3 buckets, it is\npossible to capture all events which may affect objects within an target\nbuckets. Configuring logs to be placed in a separate bucket allows access to\nlog information which can be useful in security and incident response\nworkflows.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '2.6'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['14.6'], '6.0']\n  tag \"nist\": ['AU-2', 'Rev_4']\n  tag \"cce_id\": 'CCE-78918-0'\n  tag \"check\": \"Perform the following ensure the CloudTrail S3 bucket has\naccess logging is enabled:\n\n'Via the management Console\n\n* Go to the Amazon CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail/home\n[https://console.aws.amazon.com/cloudtrail/home]\n* In the API activity history pane on the left, click Trails\n* In the Trails pane, note the bucket names in the S3 bucket column\n* Sign in to the AWS Management Console and open the S3 console at\nhttps://console.aws.amazon.com/s3 [https://console.aws.amazon.com/s3].\n* Under All Buckets click on a target S3 bucket\n* Click on Properties in the top right of the console\n* Under Bucket:_<bucket_name>_ click on Logging\n* Ensure Enabled is checked.\n\n'Via CLI\n\n'aws s3api get-bucket-logging --bucket <s3_bucket_for_cloudtrail>\"\n  tag \"fix\": \"Perform the following to enable S3 bucket logging:\n\n'Via the Management Console\n\n* Sign in to the AWS Management Console and open the S3 console at\nhttps://console.aws.amazon.com/s3 [https://console.aws.amazon.com/s3].\n* Under All Buckets click on the target S3 bucket\n* Click on Properties in the top right of the console\n* Under Bucket:<s3_bucket_for_cloudtrail> click on Logging\n\n* Configure bucket logging\n\n* Click on Enabled checkbox\n* Select Target Bucket from list\n* Enter a Target Prefix\n* Click Save\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    bucket_name = aws_cloudtrail_trail(trail).s3_bucket_name\n    if exception_bucket_list.include?(bucket_name)\n      describe 'Bucket not inspected because it is defined as an exception' do\n        skip \"Bucket: #{bucket_name} not inspected because it is defined in exception_bucket_list.\"\n      end\n    end\n\n    next if exception_bucket_list.include?(bucket_name)\n\n    describe aws_s3_bucket(bucket_name) do\n      it { should have_access_logging_enabled }\n    end\n  end\n\n  # Use this after skeletal aws_cloudtrail_trails is enhanced to expose s3_bucket_name\n  # aws_cloudtrail_trails.s3_bucket_name.uniq.each do |bucket|\n  #   describe aws_s3_bucket( bucket ) do\n  #     it{ should be_logging_enabled }\n  #   end\n  # end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.6.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000176603,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"S3 Bucket aws-cis-storage is expected to have access logging enabled","run_time":0.114297196,"start_time":"2020-06-19T14:44:13+00:00"}]},{"id":"cis-aws-foundations-4.4","title":"Ensure the default security group of every VPC restricts all traffic","desc":"A VPC comes with a default security group whose initial settings deny\nall inbound traffic, allow all outbound traffic, and allow all traffic between\ninstances assigned to the security group. If you don't specify a security group\nwhen you launch an instance, the instance is automatically assigned to this\ndefault security group. Security groups provide stateful filtering of\ningress/egress network traffic to AWS resources. It is recommended that the\ndefault security group restrict all traffic.\n\n'The default VPC in every region should have it's default security group\nupdated to comply. Any newly created VPCs will automatically contain a default\nsecurity group that will need remediation to comply with this recommendation.\n\n'NOTE: When implementing this recommendation, VPC flow logging is invaluable in\ndetermining the least privilege port access required by systems to work\nproperly because it can log all packet acceptances and rejections occurring\nunder the current security groups. This dramatically reduces the primary\nbarrier to least privilege engineering - discovering the minimum ports required\nby systems in the environment. Even if the VPC flow logging recommendation in\nthis benchmark is not adopted as a permanent security measure, it should be\nused during any period of discovery and engineering for least privileged\nsecurity groups.","descriptions":[{"label":"default","data":"A VPC comes with a default security group whose initial settings deny\nall inbound traffic, allow all outbound traffic, and allow all traffic between\ninstances assigned to the security group. If you don't specify a security group\nwhen you launch an instance, the instance is automatically assigned to this\ndefault security group. Security groups provide stateful filtering of\ningress/egress network traffic to AWS resources. It is recommended that the\ndefault security group restrict all traffic.\n\n'The default VPC in every region should have it's default security group\nupdated to comply. Any newly created VPCs will automatically contain a default\nsecurity group that will need remediation to comply with this recommendation.\n\n'NOTE: When implementing this recommendation, VPC flow logging is invaluable in\ndetermining the least privilege port access required by systems to work\nproperly because it can log all packet acceptances and rejections occurring\nunder the current security groups. This dramatically reduces the primary\nbarrier to least privilege engineering - discovering the minimum ports required\nby systems in the environment. Even if the VPC flow logging recommendation in\nthis benchmark is not adopted as a permanent security measure, it should be\nused during any period of discovery and engineering for least privileged\nsecurity groups."}],"impact":0.7,"refs":[],"tags":{"rationale":"Configuring all VPC default security groups to restrict all\ntraffic will encourage least privilege security group development and mindful\nplacement of AWS resources into security groups which will in-turn reduce the\nexposure of those resources.","cis_impact":"Implementing this recommendation in an existing VPC\ncontaining operating resources requires extremely careful migration planning as\nthe default security groups are likely to be enabling many ports that are\nunknown. Enabling VPC flow logging (of accepts) in an existing environment that\nis know to be breach free will reveal the current pattern of ports being used\nfor each instance to communicate successfully.","cis_rid":"4.4","cis_level":2,"csc_control":[["9.2"],"6.0"],"nist":["SC-7(5)","Rev_4"],"cce_id":"CCE-79201-0","check":"Perform the following to determine if the account is configured\nas prescribed:\n\n'Security Group State\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all VPCs - including the default VPC in each AWS\nregion:\n* In the left pane, click Security Groups\n* For each default security group, perform the following:\n\n* Select the default security group\n* Click the Inbound Rules tab\n* Ensure no rule exist\n* Click the Outbound Rules tab\n* Ensure no rules exist\n\n'Security Group Members\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all default groups in all VPCs - including the\ndefault VPC in each AWS region:\n* In the left pane, click Security Groups\n* Copy the id of the default security group.\n* Change to the EC2 Management Console at\nhttps://console.aws.amazon.com/ec2/v2/home\n* In the filter column type 'Security Group ID : <security group id from #4>'","fix":"Security Group Members\n\n'Perform the following to implement the prescribed state:\n\n* Identify AWS resources that exist within the default security group\n* Create a set of least privilege security groups for those resources\n* Place the resources in those security groups\n* Remove the resources noted in #1 from the default security group\n\n'Security Group State\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all VPCs - including the default VPC in each AWS\nregion:\n* In the left pane, click Security Groups\n* For each default security group, perform the following:\n\n* Select the default security group\n* Click the Inbound Rules tab\n* Remove any inbound rules\n* Click the Outbound Rules tab\n* Remove any inbound rules\n\n'Recommended:\n\n'IAM groups allow you to edit the 'name' field. After remediating default\ngroups rules for all VPCs in all regions, edit this field to add text similar\nto 'DO NOT USE. DO NOT ADD RULES'"},"code":"control 'cis-aws-foundations-4.4' do\n  title 'Ensure the default security group of every VPC restricts all traffic'\n  desc  \"A VPC comes with a default security group whose initial settings deny\nall inbound traffic, allow all outbound traffic, and allow all traffic between\ninstances assigned to the security group. If you don't specify a security group\nwhen you launch an instance, the instance is automatically assigned to this\ndefault security group. Security groups provide stateful filtering of\ningress/egress network traffic to AWS resources. It is recommended that the\ndefault security group restrict all traffic.\n\n'The default VPC in every region should have it's default security group\nupdated to comply. Any newly created VPCs will automatically contain a default\nsecurity group that will need remediation to comply with this recommendation.\n\n'NOTE: When implementing this recommendation, VPC flow logging is invaluable in\ndetermining the least privilege port access required by systems to work\nproperly because it can log all packet acceptances and rejections occurring\nunder the current security groups. This dramatically reduces the primary\nbarrier to least privilege engineering - discovering the minimum ports required\nby systems in the environment. Even if the VPC flow logging recommendation in\nthis benchmark is not adopted as a permanent security measure, it should be\nused during any period of discovery and engineering for least privileged\nsecurity groups.\"\n  impact 0.7\n  tag \"rationale\": \"Configuring all VPC default security groups to restrict all\ntraffic will encourage least privilege security group development and mindful\nplacement of AWS resources into security groups which will in-turn reduce the\nexposure of those resources.\"\n  tag \"cis_impact\": \"Implementing this recommendation in an existing VPC\ncontaining operating resources requires extremely careful migration planning as\nthe default security groups are likely to be enabling many ports that are\nunknown. Enabling VPC flow logging (of accepts) in an existing environment that\nis know to be breach free will reveal the current pattern of ports being used\nfor each instance to communicate successfully.\"\n  tag \"cis_rid\": '4.4'\n  tag \"cis_level\": 2\n  tag \"csc_control\": [['9.2'], '6.0']\n  tag \"nist\": ['SC-7(5)', 'Rev_4']\n  tag \"cce_id\": 'CCE-79201-0'\n  tag \"check\": \"Perform the following to determine if the account is configured\nas prescribed:\n\n'Security Group State\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all VPCs - including the default VPC in each AWS\nregion:\n* In the left pane, click Security Groups\n* For each default security group, perform the following:\n\n* Select the default security group\n* Click the Inbound Rules tab\n* Ensure no rule exist\n* Click the Outbound Rules tab\n* Ensure no rules exist\n\n'Security Group Members\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all default groups in all VPCs - including the\ndefault VPC in each AWS region:\n* In the left pane, click Security Groups\n* Copy the id of the default security group.\n* Change to the EC2 Management Console at\nhttps://console.aws.amazon.com/ec2/v2/home\n* In the filter column type 'Security Group ID : <security group id from #4>'\"\n  tag \"fix\": \"Security Group Members\n\n'Perform the following to implement the prescribed state:\n\n* Identify AWS resources that exist within the default security group\n* Create a set of least privilege security groups for those resources\n* Place the resources in those security groups\n* Remove the resources noted in #1 from the default security group\n\n'Security Group State\n\n* Login to the AWS Management Console at\nhttps://console.aws.amazon.com/vpc/home\n[https://console.aws.amazon.com/vpc/home]\n* Repeat the next steps for all VPCs - including the default VPC in each AWS\nregion:\n* In the left pane, click Security Groups\n* For each default security group, perform the following:\n\n* Select the default security group\n* Click the Inbound Rules tab\n* Remove any inbound rules\n* Click the Outbound Rules tab\n* Remove any inbound rules\n\n'Recommended:\n\n'IAM groups allow you to edit the 'name' field. After remediating default\ngroups rules for all VPCs in all regions, edit this field to add text similar\nto 'DO NOT USE. DO NOT ADD RULES'\"\n\n  aws_vpcs.vpc_ids.each do |vpc|\n    describe aws_security_group(group_name: 'default', vpc_id: vpc) do\n      its('inbound_rules') { should be_empty }\n      its('outbound_rules') { should be_empty }\n    end\n  end\n  if aws_vpcs.vpc_ids.empty?\n    describe 'Control skipped because no vpcs were found' do\n      skip 'This control is skipped since the aws_vpcs resource returned an empty vpc list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-4.4.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"EC2 Security Group sg-0f4cc17ad346000a8 inbound_rules is expected to be empty","run_time":0.003653667,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `[{:ip_protocol=>\"-1\", :ip_ranges=>[], :ipv_6_ranges=>[], :prefix_list_ids=>[], :user_id_group_pairs=>[{:group_id=>\"sg-0f4cc17ad346000a8\", :user_id=>\"400122527520\"}]}].empty?` to return true, got false"},{"status":"failed","code_desc":"EC2 Security Group sg-0f4cc17ad346000a8 outbound_rules is expected to be empty","run_time":0.003482364,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `[{:ip_protocol=>\"-1\", :ip_ranges=>[{:cidr_ip=>\"0.0.0.0/0\"}], :ipv_6_ranges=>[], :prefix_list_ids=>[], :user_id_group_pairs=>[]}].empty?` to return true, got false"},{"status":"failed","code_desc":"EC2 Security Group sg-0445e37d inbound_rules is expected to be empty","run_time":0.003473264,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `[{:ip_protocol=>\"-1\", :ip_ranges=>[], :ipv_6_ranges=>[], :prefix_list_ids=>[], :user_id_group_pairs=>[{:group_id=>\"sg-0445e37d\", :user_id=>\"400122527520\"}]}].empty?` to return true, got false"},{"status":"failed","code_desc":"EC2 Security Group sg-0445e37d outbound_rules is expected to be empty","run_time":0.003472463,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `[{:ip_protocol=>\"-1\", :ip_ranges=>[{:cidr_ip=>\"0.0.0.0/0\"}], :ipv_6_ranges=>[], :prefix_list_ids=>[], :user_id_group_pairs=>[]}].empty?` to return true, got false"}]},{"id":"cis-aws-foundations-1.15","title":"Ensure security questions are registered in the AWS account","desc":"The AWS support portal allows account owners to establish security\nquestions that can be used to authenticate individuals calling AWS customer\nservice for support. It is recommended that security questions be established.","descriptions":[{"label":"default","data":"The AWS support portal allows account owners to establish security\nquestions that can be used to authenticate individuals calling AWS customer\nservice for support. It is recommended that security questions be established."}],"impact":0.3,"refs":[],"tags":{"rationale":"When creating a new AWS account, a default super user is\nautomatically created. This account is referred to as the 'root' account. It is\nrecommended that the use of this account be limited and highly controlled.\nDuring events in which the Root password is no longer accessible or the MFA\ntoken associated with root is lost/destroyed it is possible, through\nauthentication using secret questions and associated answers, to recover root\nlogin access.","cis_impact":"","cis_rid":"1.15","cis_level":1,"cis_control_number":"","nist":["IA-2","Rev_4"],"cce_id":"","check":"Perform the following in the AWS Management Console:\n\n* Login to the AWS account as root\n* On the top right you will see the _<Root_Account_Name>_\n* Click on the _<Root_Account_Name>_\n* From the drop-down menu Click My Account\n* In the Configure Security Challenge Questions section on the Personal\nInformation page, configure three security challenge questions.\n* Click Save questions.","fix":"Perform the following in the AWS Management Console:\n\n* Login to the AWS Account as root\n* Click on the _<Root_Account_Name>_ from the top right of the console\n* From the drop-down menu Click _My Account_\n* Scroll down to the Configure Security Questions section\n* Click on Edit\n\n* Click on each Question\n\n* From the drop-down select an appropriate question\n* Click on the Answer section\n\n* Enter an appropriate answer\n\n* Follow process for all 3 questions\n\n\n* Click Update when complete\n* Place Questions and Answers and place in a secure physical location"},"code":"control 'cis-aws-foundations-1.15' do\n  title 'Ensure security questions are registered in the AWS account'\n  desc  \"The AWS support portal allows account owners to establish security\nquestions that can be used to authenticate individuals calling AWS customer\nservice for support. It is recommended that security questions be established.\"\n  impact 0.3\n  tag \"rationale\": \"When creating a new AWS account, a default super user is\nautomatically created. This account is referred to as the 'root' account. It is\nrecommended that the use of this account be limited and highly controlled.\nDuring events in which the Root password is no longer accessible or the MFA\ntoken associated with root is lost/destroyed it is possible, through\nauthentication using secret questions and associated answers, to recover root\nlogin access.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.15'\n  tag \"cis_level\": 1\n  tag \"cis_control_number\": ''\n  tag \"nist\": ['IA-2', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Perform the following in the AWS Management Console:\n\n* Login to the AWS account as root\n* On the top right you will see the _<Root_Account_Name>_\n* Click on the _<Root_Account_Name>_\n* From the drop-down menu Click My Account\n* In the Configure Security Challenge Questions section on the Personal\nInformation page, configure three security challenge questions.\n* Click Save questions.\"\n  tag \"fix\": \"Perform the following in the AWS Management Console:\n\n* Login to the AWS Account as root\n* Click on the _<Root_Account_Name>_ from the top right of the console\n* From the drop-down menu Click _My Account_\n* Scroll down to the Configure Security Questions section\n* Click on Edit\n\n* Click on each Question\n\n* From the drop-down select an appropriate question\n* Click on the Answer section\n\n* Enter an appropriate answer\n\n* Follow process for all 3 questions\n\n\n* Click Update when complete\n* Place Questions and Answers and place in a secure physical location\"\n\n  describe 'Control has to be tested manually' do\n    skip 'This control must be manually reviewed'\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.15.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"Control has to be tested manually","run_time":7.9e-06,"start_time":"2020-06-19T14:44:13+00:00","resource":"","skip_message":"This control must be manually reviewed"}]},{"id":"cis-aws-foundations-4.5","title":"Ensure routing tables for VPC peering are 'least access'","desc":"Once a VPC peering connection is estalished, routing tables must be\nupdated to establish any connections between the peered VPCs. These routes can\nbe as specific as desired - even peering a VPC to only a single host on the\nother side of the connection.","descriptions":[{"label":"default","data":"Once a VPC peering connection is estalished, routing tables must be\nupdated to establish any connections between the peered VPCs. These routes can\nbe as specific as desired - even peering a VPC to only a single host on the\nother side of the connection."}],"impact":0.7,"refs":[],"tags":{"rationale":"Being highly selective in peering routing tables is a very\neffective way of minimizing the impact of breach as resources outside of these\nroutes are inaccessible to the peered VPC.","cis_impact":"","cis_rid":"4.5","cis_level":2,"csc_control":"","nist":["SC-7","Rev_4"],"cce_id":"","check":"Review routing tables of peered VPCs for whether they route all\nsubnets of each VPC and whether that is necessary to accomplish the intended\npurposes for peering the VPCs.\n\n'Via CLI:\n\n* List all the route tables from a VPC and check if 'GatewayId' is pointing to\na _<peering_connection_id>_ (e.g. pcx-1a2b3c4d) and if 'DestinationCidrBlock'\nis as specific as desired.\n\n'aws ec2 describe-route-tables --filter 'Name=vpc-id,Values=_<vpc_id>_' --query\n'RouteTables[*].{RouteTableId:RouteTableId, VpcId:VpcId, Routes:Routes,\nAssociatedSubnets:Associations[*].SubnetId}'","fix":"Remove and add route table entries to ensure that the least\nnumber of subnets or hosts as is required to accomplish the purpose for peering\nare routable.\n\n'Via CLI:\n\n* For each _<route_table_id> _containing routes non compliant with your routing\npolicy (which grants more than desired 'least access'), delete the non\ncompliant route:\n\n'aws ec2 delete-route --route-table-id _<route_table_id>_\n--destination-cidr-block _<non_compliant_destination_CIDR>_\n\n' 2. Create a new compliant route:\n\n'aws ec2 create-route --route-table-id _<route_table_id>_\n--destination-cidr-block _<compliant_destination_CIDR>_\n--vpc-peering-connection-id _<peering_connection_id>_"},"code":"control 'cis-aws-foundations-4.5' do\n  title \"Ensure routing tables for VPC peering are 'least access'\"\n  desc  \"Once a VPC peering connection is estalished, routing tables must be\nupdated to establish any connections between the peered VPCs. These routes can\nbe as specific as desired - even peering a VPC to only a single host on the\nother side of the connection.\"\n  impact 0.7\n  tag \"rationale\": \"Being highly selective in peering routing tables is a very\neffective way of minimizing the impact of breach as resources outside of these\nroutes are inaccessible to the peered VPC.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '4.5'\n  tag \"cis_level\": 2\n  tag \"csc_control\": ''\n  tag \"nist\": ['SC-7', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Review routing tables of peered VPCs for whether they route all\nsubnets of each VPC and whether that is necessary to accomplish the intended\npurposes for peering the VPCs.\n\n'Via CLI:\n\n* List all the route tables from a VPC and check if 'GatewayId' is pointing to\na _<peering_connection_id>_ (e.g. pcx-1a2b3c4d) and if 'DestinationCidrBlock'\nis as specific as desired.\n\n'aws ec2 describe-route-tables --filter 'Name=vpc-id,Values=_<vpc_id>_' --query\n'RouteTables[*].{RouteTableId:RouteTableId, VpcId:VpcId, Routes:Routes,\nAssociatedSubnets:Associations[*].SubnetId}'\"\n  tag \"fix\": \"Remove and add route table entries to ensure that the least\nnumber of subnets or hosts as is required to accomplish the purpose for peering\nare routable.\n\n'Via CLI:\n\n* For each _<route_table_id> _containing routes non compliant with your routing\npolicy (which grants more than desired 'least access'), delete the non\ncompliant route:\n\n'aws ec2 delete-route --route-table-id _<route_table_id>_\n--destination-cidr-block _<non_compliant_destination_CIDR>_\n\n' 2. Create a new compliant route:\n\n'aws ec2 create-route --route-table-id _<route_table_id>_\n--destination-cidr-block _<compliant_destination_CIDR>_\n--vpc-peering-connection-id _<peering_connection_id>_\"\n\n  aws_route_tables.route_table_ids.each do |route_table_id|\n    aws_route_table(route_table_id).routes.each do |route|\n      next unless route.key?(:vpc_peering_connection_id)\n\n      describe route do\n        its([:destination_cidr_block]) { should_not be nil }\n      end\n    end\n    next unless aws_route_table(route_table_id).routes.none? { |route| route.key?(:vpc_peering_connection_id) }\n\n    describe 'No routes with peering connection were found for the route table' do\n      skip \"No routes with peering connection were found for the route_table #{route_table_id}\"\n    end\n  end\n  if aws_route_tables.route_table_ids.empty?\n    describe 'Control skipped because no route tables were found' do\n      skip 'This control is skipped since the aws_route_tables resource returned an empty route table list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-4.5.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"No routes with peering connection were found for the route table","run_time":5.0e-06,"start_time":"2020-06-19T14:44:13+00:00","resource":"","skip_message":"No routes with peering connection were found for the route_table rtb-fe32af95"},{"status":"passed","code_desc":"{:destination_cidr_block=>\"10.0.0.0/30\", :origin=>\"CreateRoute\", :state=>\"active\", :vpc_peering_connection_id=>\"pcx-06b0f1cadd298de67\"} [:destination_cidr_block] is expected not to equal nil","run_time":0.000152003,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"{:destination_cidr_block=>\"172.31.0.0/30\", :origin=>\"CreateRoute\", :state=>\"active\", :vpc_peering_connection_id=>\"pcx-06b0f1cadd298de67\"} [:destination_cidr_block] is expected not to equal nil","run_time":0.000115803,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"skipped","code_desc":"No routes with peering connection were found for the route table","run_time":5.1e-06,"start_time":"2020-06-19T14:44:13+00:00","resource":"","skip_message":"No routes with peering connection were found for the route_table rtb-0523a0afa85cba910"}]},{"id":"cis-aws-foundations-1.3","title":"Ensure credentials unused for 90 days or greater are disabled","desc":"AWS IAM users can access AWS resources using different types of\ncredentials, such as passwords or access keys. It is recommended that all\ncredentials that have been unused in 90 or greater days be removed or\ndeactivated.","descriptions":[{"label":"default","data":"AWS IAM users can access AWS resources using different types of\ncredentials, such as passwords or access keys. It is recommended that all\ncredentials that have been unused in 90 or greater days be removed or\ndeactivated."}],"impact":0.3,"refs":[],"tags":{"rationale":"Disabling or removing unnecessary credentials will reduce\nthe window of opportunity for credentials associated with a compromised or\nabandoned account to be used.","cis_impact":"","cis_rid":"1.3","cis_level":1,"csc_control":[["16.6"],"6.0"],"nist":["IA-4","Rev_4"],"cce_id":"CCE-78900-8","check":"Perform the following to determine if unused credentials exist:\n\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains credential usage for all users\nwithin an AWS Account - open this file\n* For each user having password_enabled set to TRUE, ensure password_last_used\nis less than 90 days ago.\n* For each user having access_key_1_active or access_key_2_active to TRUE,\nensure the corresponding access_key_n_last_used_date is less than 90 days ago.\n\n\n'Via CLI\n\n* Run the following commands:\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d | cut\n-d, -f1,9,10,11,14,15,16\n* For each user having password_enabled set to TRUE, ensure\npassword_last_used_date is less than 90 days ago.\n* For each user having an access_key_1_active or access_key_2_active to TRUE,\nensure the corresponding access_key_n_last_used_date is less than 90 days ago.","fix":"Perform the following to remove or deactivate credentials:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Make Inactive for credentials that have not been used in 90 Days\n\n* As an IAM User\n\n* Click on Make Inactive or Delete for credentials which have not been used in\n90 Days\n"},"code":"control 'cis-aws-foundations-1.3' do\n  title 'Ensure credentials unused for 90 days or greater are disabled'\n  desc  \"AWS IAM users can access AWS resources using different types of\ncredentials, such as passwords or access keys. It is recommended that all\ncredentials that have been unused in 90 or greater days be removed or\ndeactivated.\"\n  impact 0.3\n  tag \"rationale\": \"Disabling or removing unnecessary credentials will reduce\nthe window of opportunity for credentials associated with a compromised or\nabandoned account to be used.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.3'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['16.6'], '6.0']\n  tag \"nist\": ['IA-4', 'Rev_4']\n  tag \"cce_id\": 'CCE-78900-8'\n  tag \"check\": \"Perform the following to determine if unused credentials exist:\n\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains credential usage for all users\nwithin an AWS Account - open this file\n* For each user having password_enabled set to TRUE, ensure password_last_used\nis less than 90 days ago.\n* For each user having access_key_1_active or access_key_2_active to TRUE,\nensure the corresponding access_key_n_last_used_date is less than 90 days ago.\n\n\n'Via CLI\n\n* Run the following commands:\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d | cut\n-d, -f1,9,10,11,14,15,16\n* For each user having password_enabled set to TRUE, ensure\npassword_last_used_date is less than 90 days ago.\n* For each user having an access_key_1_active or access_key_2_active to TRUE,\nensure the corresponding access_key_n_last_used_date is less than 90 days ago.\"\n  tag \"fix\": \"Perform the following to remove or deactivate credentials:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Make Inactive for credentials that have not been used in 90 Days\n\n* As an IAM User\n\n* Click on Make Inactive or Delete for credentials which have not been used in\n90 Days\n\"\n  describe aws_iam_users.where(has_console_password?: true).where(password_never_used?: true) do\n    it { should_not exist }\n  end\n\n  describe aws_iam_users.where(has_console_password?: true).where(password_ever_used?: true).where { password_last_used_days_ago >= 90 } do\n    it { should_not exist }\n  end\n\n  aws_iam_access_keys.where(active: true).entries.each do |key|\n    describe key.username do\n      context key do\n        its('last_used_days_ago') { should cmp < 90 }\n      end\n    end\n  end\n\n  if aws_iam_access_keys.where(active: true).entries.empty?\n    describe 'Control skipped because no active iam access keys were found' do\n      skip 'This control is skipped since the aws_iam_access_keys resource returned an empty active access key list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.3.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"IAM Users with has_console_password? == true password_never_used? == true is expected not to exist","run_time":0.000118402,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"IAM Users with has_console_password? == true password_ever_used? == true password_last_used_days_ago >= 90 is expected not to exist","run_time":0.000292306,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"test-one IAM Access Keys with active == true one entry last_used_days_ago is expected to cmp < 90","run_time":0.000255704,"start_time":"2020-06-19T14:44:13+00:00"}]},{"id":"cis-aws-foundations-1.4","title":"Ensure access keys are rotated every 90 days or less","desc":"Access keys consist of an access key ID and secret access key, which\nare used to sign programmatic requests that you make to AWS. AWS users need\ntheir own access keys to make programmatic calls to AWS from the AWS Command\nLine Interface (AWS CLI), Tools for Windows PowerShell, the AWS SDKs, or direct\nHTTP calls using the APIs for individual AWS services. It is recommended that\nall access keys be regularly rotated.","descriptions":[{"label":"default","data":"Access keys consist of an access key ID and secret access key, which\nare used to sign programmatic requests that you make to AWS. AWS users need\ntheir own access keys to make programmatic calls to AWS from the AWS Command\nLine Interface (AWS CLI), Tools for Windows PowerShell, the AWS SDKs, or direct\nHTTP calls using the APIs for individual AWS services. It is recommended that\nall access keys be regularly rotated."}],"impact":0.3,"refs":[],"tags":{"rationale":"Rotating access keys will reduce the window of opportunity\nfor an access key that is associated with a compromised or terminated account\nto be used.\n\n'Access keys should be rotated to ensure that data cannot be accessed with an\nold key which might have been lost, cracked, or stolen.","cis_impact":"","cis_rid":"1.4","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78902-4","check":"Perform the following to determine if access keys are rotated\nas prescribed:\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains Access Key usage for all IAM\nusers within an AWS Account - open this file\n\n* Focus on the following columns (where x = 1 or 2)\n\n* access_key_X_active\n* access_key_X_last_rotated\n* access_key_X_last_used_date\n\n\n* Ensure all active keys have been rotated within 90 days\n\n* Ensure all active keys have been used since last rotation\n\n* Keys not in-use since last rotation should be disabled/deleted\n\n'Via CLI\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d","fix":"Perform the following to rotate access keys:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Make Inactive for keys that have not been rotated in 90 Days\n\n* As an IAM User\n\n* Click on Make Inactive or Delete for keys which have not been rotated or used\nin the last 90 days\n\n\n* Click on Create Access Key\n* Update programmatic call with new Access Key credentials\n\n'Via CLI\n\n'aws iam update-access-key\naws iam create-access-key\naws iam delete-access-key"},"code":"control 'cis-aws-foundations-1.4' do\n  title \"Ensure access keys are rotated every #{aws_key_age} days or less\"\n  desc  \"Access keys consist of an access key ID and secret access key, which\nare used to sign programmatic requests that you make to AWS. AWS users need\ntheir own access keys to make programmatic calls to AWS from the AWS Command\nLine Interface (AWS CLI), Tools for Windows PowerShell, the AWS SDKs, or direct\nHTTP calls using the APIs for individual AWS services. It is recommended that\nall access keys be regularly rotated.\"\n  impact 0.3\n  tag \"rationale\": \"Rotating access keys will reduce the window of opportunity\nfor an access key that is associated with a compromised or terminated account\nto be used.\n\n'Access keys should be rotated to ensure that data cannot be accessed with an\nold key which might have been lost, cracked, or stolen.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.4'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78902-4'\n  tag \"check\": \"Perform the following to determine if access keys are rotated\nas prescribed:\n\n* Login to the AWS Management Console\n* Click Services\n* Click IAM\n* Click on Credential Report\n* This will download an .xls file which contains Access Key usage for all IAM\nusers within an AWS Account - open this file\n\n* Focus on the following columns (where x = 1 or 2)\n\n* access_key_X_active\n* access_key_X_last_rotated\n* access_key_X_last_used_date\n\n\n* Ensure all active keys have been rotated within #{aws_key_age} days\n\n* Ensure all active keys have been used since last rotation\n\n* Keys not in-use since last rotation should be disabled/deleted\n\n'Via CLI\n\n'aws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d\"\n  tag \"fix\": \"Perform the following to rotate access keys:\n\n* Login to the AWS Management Console:\n* Click Services\n* Click IAM\n* Click on Users\n* Click on Security Credentials\n\n* As an Administrator\n\n* Click on Make Inactive for keys that have not been rotated in #{aws_key_age} Days\n\n* As an IAM User\n\n* Click on Make Inactive or Delete for keys which have not been rotated or used\nin the last #{aws_key_age} days\n\n\n* Click on Create Access Key\n* Update programmatic call with new Access Key credentials\n\n'Via CLI\n\n'aws iam update-access-key\naws iam create-access-key\naws iam delete-access-key\"\n\n  aws_iam_access_keys.where(active: true).entries.each do |key|\n    describe key.username do\n      context key do\n        its('created_days_ago') { should cmp <= aws_key_age }\n        its('ever_used') { should be true }\n      end\n    end\n  end\n\n  if aws_iam_access_keys.where(active: true).entries.empty?\n    describe 'Control skipped because no active iam access keys were found' do\n      skip 'This control is skipped since the aws_iam_access_keys resource returned an empty active access key list'\n    end\n  end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.4.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"test-one IAM Access Keys with active == true one entry created_days_ago is expected to cmp <= 90","run_time":0.000267205,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"test-one IAM Access Keys with active == true one entry ever_used is expected to equal true","run_time":0.000131603,"start_time":"2020-06-19T14:44:13+00:00"}]},{"id":"cis-aws-foundations-1.17","title":"Enable detailed billing","desc":"Enable Detailed Billing to cause the generation of a log record for\nevery event or hourly ongoing activity which incurs cost in an AWS account.\nThese records are aggregated into CSV files of hourly records, and written to\nan S3 bucket. A CSV (Comma Separated Values) file of billing records is written\nat least every 24 hours; writing of files is often more frequent.","descriptions":[{"label":"default","data":"Enable Detailed Billing to cause the generation of a log record for\nevery event or hourly ongoing activity which incurs cost in an AWS account.\nThese records are aggregated into CSV files of hourly records, and written to\nan S3 bucket. A CSV (Comma Separated Values) file of billing records is written\nat least every 24 hours; writing of files is often more frequent."}],"impact":0.3,"refs":[],"tags":{"rationale":"Detailed Billing records can be used as an overview of AWS\nactivity across the whole of an account, in addition to per-Region CloudTrail,\nConfig and other service-specific JSON-based logs. Billing records can be\ngraphed over time using the Cost Explorer tool, and budgeting alerts can be\nconfigured on billing records and pushed to SNS in the event of spend over\ntime, or predicted spend at current rate, going above a customer-set threshold\n- this can be used as a simple means of detecting anomalous utilisation of AWS\nresources and thereby triggering investigation activities. Billing records can\nalso be broken out by tag, which can serve as a starting point in identifying\nwhich part of the environment, or organisation, the anomalous activity is\noccurring in.","cis_impact":"","cis_rid":"1.17","cis_level":1,"csc_control":"","nist":["AU-12","Rev_4"],"cce_id":"","check":"There is currently no AWS CLI support for this operation, so it\nis necessary to use the Management Console.\n\nAs a user with IAM permission to read billing information\n(aws-portal:ViewBilling):\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation pane, choose Preferences.\n* Verify whether the 'Receive Billing Reports' check box is ticked. If it is\nnot, billing reports are not being generated.","fix":"There is currently no AWS CLI support for this operation, so it\nis necessary to use the Management Console.\n\n'As a user with IAM permission to read and write billing information\n(aws-portal:*Billing):\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/\n[https://console.aws.amazon.com/billing/home#/].\n* On the navigation pane, choose Preferences.\n* Select the Receive Billing Reports check box.\n* Designate the Amazon S3 bucket _<S3_billing_bucket>_ where you want AWS to\npublish your detailed billing reports.\n* Ensure that policy allows read access only to appropriate groups of users\n(finance, auditors, etc). For appropriate groups in IAM who you want to have\nread access, include the following policy element:\n\n' 'Statement':[\n\n' {\n\n' 'Effect':'Allow',\n\n' 'Action':[\n\n' 's3:GetObject',\n\n' 's3:GetObjectVersion',\n\n' 's3:GetBucketLocation'\n\n' ],\n\n' 'Resource':'arn:aws:s3:::_<S3_billing_bucket>_/*'\n\n' }\n\n' ]\n\n* After your S3 bucket has been verified, under Report, select the check boxes\nfor the reports that you want to receive.\n* Choose Save preferences\n* Detailed billing reports can take up to 24 hours to start being generated.\nWait >24 hours, and examine your designated S3 bucket to verify that files with\nnames of the form (eg) <AWS account\nnumber>-<aws-billing-detailed-line-items-with-resources-and-tags-yyyy-mm>.csv.zip\nare being generated."},"code":"control 'cis-aws-foundations-1.17' do\n  title 'Enable detailed billing'\n  desc  \"Enable Detailed Billing to cause the generation of a log record for\nevery event or hourly ongoing activity which incurs cost in an AWS account.\nThese records are aggregated into CSV files of hourly records, and written to\nan S3 bucket. A CSV (Comma Separated Values) file of billing records is written\nat least every 24 hours; writing of files is often more frequent.\"\n  impact 0.3\n  tag \"rationale\": \"Detailed Billing records can be used as an overview of AWS\nactivity across the whole of an account, in addition to per-Region CloudTrail,\nConfig and other service-specific JSON-based logs. Billing records can be\ngraphed over time using the Cost Explorer tool, and budgeting alerts can be\nconfigured on billing records and pushed to SNS in the event of spend over\ntime, or predicted spend at current rate, going above a customer-set threshold\n- this can be used as a simple means of detecting anomalous utilisation of AWS\nresources and thereby triggering investigation activities. Billing records can\nalso be broken out by tag, which can serve as a starting point in identifying\nwhich part of the environment, or organisation, the anomalous activity is\noccurring in.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.17'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['AU-12', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"There is currently no AWS CLI support for this operation, so it\nis necessary to use the Management Console.\n\nAs a user with IAM permission to read billing information\n(aws-portal:ViewBilling):\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation pane, choose Preferences.\n* Verify whether the 'Receive Billing Reports' check box is ticked. If it is\nnot, billing reports are not being generated.\"\n  tag \"fix\": \"There is currently no AWS CLI support for this operation, so it\nis necessary to use the Management Console.\n\n'As a user with IAM permission to read and write billing information\n(aws-portal:*Billing):\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/\n[https://console.aws.amazon.com/billing/home#/].\n* On the navigation pane, choose Preferences.\n* Select the Receive Billing Reports check box.\n* Designate the Amazon S3 bucket _<S3_billing_bucket>_ where you want AWS to\npublish your detailed billing reports.\n* Ensure that policy allows read access only to appropriate groups of users\n(finance, auditors, etc). For appropriate groups in IAM who you want to have\nread access, include the following policy element:\n\n' 'Statement':[\n\n' {\n\n' 'Effect':'Allow',\n\n' 'Action':[\n\n' 's3:GetObject',\n\n' 's3:GetObjectVersion',\n\n' 's3:GetBucketLocation'\n\n' ],\n\n' 'Resource':'arn:aws:s3:::_<S3_billing_bucket>_/*'\n\n' }\n\n' ]\n\n* After your S3 bucket has been verified, under Report, select the check boxes\nfor the reports that you want to receive.\n* Choose Save preferences\n* Detailed billing reports can take up to 24 hours to start being generated.\nWait >24 hours, and examine your designated S3 bucket to verify that files with\nnames of the form (eg) <AWS account\nnumber>-<aws-billing-detailed-line-items-with-resources-and-tags-yyyy-mm>.csv.zip\nare being generated.\"\n\n  describe 'Control has to be tested manually' do\n    skip 'This control must be manually reviewed'\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.17.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"Control has to be tested manually","run_time":5.8e-06,"start_time":"2020-06-19T14:44:13+00:00","resource":"","skip_message":"This control must be manually reviewed"}]},{"id":"cis-aws-foundations-1.19","title":"Maintain current contact details","desc":"Ensure contact email and telephone details for AWS accounts are\ncurrent and map to more than one individual in your organisation.\n\n'An AWS account supports a number of contact details, and AWS will use these to\ncontact the account owner if activity judged to be in breach of Acceptable Use\nPolicy or indicative of likely security compromise is observed by the AWS Abuse\nteam. Contact details should not be for a single individual, as circumstances\nmay arise where that individual is unavailable. Email contact details should\npoint to a mail alias which forwards email to multiple individuals within the\norganisation; where feasible, phone contact details should point to a PABX hunt\ngroup or other call-forwarding system.","descriptions":[{"label":"default","data":"Ensure contact email and telephone details for AWS accounts are\ncurrent and map to more than one individual in your organisation.\n\n'An AWS account supports a number of contact details, and AWS will use these to\ncontact the account owner if activity judged to be in breach of Acceptable Use\nPolicy or indicative of likely security compromise is observed by the AWS Abuse\nteam. Contact details should not be for a single individual, as circumstances\nmay arise where that individual is unavailable. Email contact details should\npoint to a mail alias which forwards email to multiple individuals within the\norganisation; where feasible, phone contact details should point to a PABX hunt\ngroup or other call-forwarding system."}],"impact":0.3,"refs":[],"tags":{"rationale":"If an AWS account is observed to be behaving in a\nprohibited or suspicious manner, AWS will attempt to contact the account owner\nby email and phone using the contact details listed. If this is unsuccessful\nand the account behaviour needs urgent mitigation, proactive measures may be\ntaken, including throttling of traffic between the account exhibiting\nsuspicious behaviour and the AWS API endpoints and the Internet. This will\nresult in impaired service to and from the account in question, so it is in\nboth the customers' and AWS' best interests that prompt contact can be\nestablished. This is best achieved by setting AWS account contact details to\npoint to resources which have multiple individuals as recipients, such as email\naliases and PABX hunt groups.","cis_impact":"","cis_rid":"1.19","cis_level":1,"csc_control":"","nist":["IA-4","Rev_4"],"cce_id":"","check":"This activity can only be performed via the AWS Console, with a\nuser who has permission to read and write Billing information\n(aws-portal:*Billing ).\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation bar, choose your account name, and then choose My Account.\n\n* On the Account Settings page, review and verify the current details.\n* Under Contact Information, review and verify the current details.","fix":"This activity can only be performed via the AWS Console, with a\nuser who has permission to read and write Billing information\n(aws-portal:*Billing ).\n\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation bar, choose your account name, and then choose My Account.\n\n* On the Account Settings page, next to Account Settings, choose Edit.\n* Next to the field that you need to update, choose Edit.\n* After you have entered your changes, choose Save changes.\n* After you have made your changes, choose Done.\n* To edit your contact information, under Contact Information, choose Edit.\n* For the fields that you want to change, type your updated information, and\nthen choose Update."},"code":"control 'cis-aws-foundations-1.19' do\n  title 'Maintain current contact details'\n  desc  \"Ensure contact email and telephone details for AWS accounts are\ncurrent and map to more than one individual in your organisation.\n\n'An AWS account supports a number of contact details, and AWS will use these to\ncontact the account owner if activity judged to be in breach of Acceptable Use\nPolicy or indicative of likely security compromise is observed by the AWS Abuse\nteam. Contact details should not be for a single individual, as circumstances\nmay arise where that individual is unavailable. Email contact details should\npoint to a mail alias which forwards email to multiple individuals within the\norganisation; where feasible, phone contact details should point to a PABX hunt\ngroup or other call-forwarding system.\"\n  impact 0.3\n  tag \"rationale\": \"If an AWS account is observed to be behaving in a\nprohibited or suspicious manner, AWS will attempt to contact the account owner\nby email and phone using the contact details listed. If this is unsuccessful\nand the account behaviour needs urgent mitigation, proactive measures may be\ntaken, including throttling of traffic between the account exhibiting\nsuspicious behaviour and the AWS API endpoints and the Internet. This will\nresult in impaired service to and from the account in question, so it is in\nboth the customers' and AWS' best interests that prompt contact can be\nestablished. This is best achieved by setting AWS account contact details to\npoint to resources which have multiple individuals as recipients, such as email\naliases and PABX hunt groups.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.19'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-4', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"This activity can only be performed via the AWS Console, with a\nuser who has permission to read and write Billing information\n(aws-portal:*Billing ).\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation bar, choose your account name, and then choose My Account.\n\n* On the Account Settings page, review and verify the current details.\n* Under Contact Information, review and verify the current details.\"\n  tag \"fix\": \"This activity can only be performed via the AWS Console, with a\nuser who has permission to read and write Billing information\n(aws-portal:*Billing ).\n\n\n* Sign in to the AWS Management Console and open the Billing and Cost\nManagement console at https://console.aws.amazon.com/billing/home#/.\n* On the navigation bar, choose your account name, and then choose My Account.\n\n* On the Account Settings page, next to Account Settings, choose Edit.\n* Next to the field that you need to update, choose Edit.\n* After you have entered your changes, choose Save changes.\n* After you have made your changes, choose Done.\n* To edit your contact information, under Contact Information, choose Edit.\n* For the fields that you want to change, type your updated information, and\nthen choose Update.\"\n\n  describe 'Control has to be tested manually' do\n    skip 'This control must be manually reviewed'\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.19.rb"},"waiver_data":{},"results":[{"status":"skipped","code_desc":"Control has to be tested manually","run_time":4.9e-06,"start_time":"2020-06-19T14:44:13+00:00","resource":"","skip_message":"This control must be manually reviewed"}]},{"id":"cis-aws-foundations-1.7","title":"Ensure IAM password policy require at least one symbol","desc":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one symbol.","descriptions":[{"label":"default","data":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one symbol."}],"impact":0.3,"refs":[],"tags":{"rationale":"Setting a password complexity policy increases account\nresiliency against brute force login attempts.","cis_impact":"","cis_rid":"1.7","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78905-7","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Require at least one non-alphanumeric character' is checked under\n'Password Policy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireSymbols': true","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Require at least one non-alphanumeric character'\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --require-symbols\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.7' do\n  title 'Ensure IAM password policy require at least one symbol'\n  desc  \"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one symbol.\"\n  impact 0.3\n  tag \"rationale\": \"Setting a password complexity policy increases account\nresiliency against brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.7'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78905-7'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Require at least one non-alphanumeric character' is checked under\n'Password Policy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireSymbols': true\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Require at least one non-alphanumeric character'\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --require-symbols\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('require_symbols?') { should be true }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.7.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000183304,"start_time":"2020-06-19T14:44:13+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-1.22","title":"Ensure a support role has been created to manage incidents with AWS\nSupport","desc":"AWS provides a support center that can be used for incident\nnotification and response, as well as technical support and customer services.\nCreate an IAM Role to allow authorized users to manage incidents with AWS\nSupport.","descriptions":[{"label":"default","data":"AWS provides a support center that can be used for incident\nnotification and response, as well as technical support and customer services.\nCreate an IAM Role to allow authorized users to manage incidents with AWS\nSupport."}],"impact":0.3,"refs":[],"tags":{"rationale":"By implementing least privilege for access control, an IAM\nRole will require an appropriate IAM Policy to allow Support Center Access in\norder to manage Incidents with AWS Support.","cis_impact":"All AWS Support plans include an unlimited number of\naccount and billing support cases, with no long-term contracts.\n\nSupport billing calculations are performed on a per-account basis for all\nplans. Enterprise Support plan customers have the option to include multiple\nenabled accounts in an aggregated monthly billing calculation.\n\nMonthly charges for the Business and Enterprise support plans are based on each\nmonth's AWS usage charges, subject to a monthly minimum, billed in advance.","cis_rid":"1.22","cis_level":1,"csc_control":"","nist":["IR-7","Rev_4"],"cce_id":"","check":"Using the Amazon unified command line interface:\n\n* List IAM policies, filter for the 'AWSSupportAccess' managed policy, and note\nthe 'Arn' element value:\n\n 'aws iam list-policies --query 'Policies[?PolicyName == 'AWSSupportAccess']'\n\n\n* Check if the 'AWSSupportAccess' is attached to any IAM user, group or role:\n\n 'aws iam list-entities-for-policy --policy-arn <iam_policy_arn>\n","fix":"Using the Amazon unified command line interface:\n\n* Create an IAM role for managing incidents with AWS:\n\n* Create a trust relationship policy document that allows <iam_user> to manage\nAWS incidents, and save it locally as /tmp/TrustPolicy.json:\n\n '{\n 'Version': '2012-10-17',\n 'Statement': [\n {\n 'Effect': 'Allow',\n 'Principal': {\n 'AWS': '<iam_user>'\n },\n 'Action': 'sts:AssumeRole'\n }\n ]\n}\n\n\n * Create the IAM role using the above trust policy:\n\n 'aws iam create-role --role-name <_aws_support_iam_role_>\n--assume-role-policy-document file:///tmp/TrustPolicy.json\n\n\n * Attach 'AWSSupportAccess' managed policy to the created IAM role:\n\n 'aws iam attach-role-policy --policy-arn <iam_policy_arn> --role-name\n<_aws_support_iam_role_>\n\n"},"code":"control 'cis-aws-foundations-1.22' do\n  title \"Ensure a support role has been created to manage incidents with AWS\nSupport\"\n  desc  \"AWS provides a support center that can be used for incident\nnotification and response, as well as technical support and customer services.\nCreate an IAM Role to allow authorized users to manage incidents with AWS\nSupport.\"\n  impact 0.3\n  tag \"rationale\": \"By implementing least privilege for access control, an IAM\nRole will require an appropriate IAM Policy to allow Support Center Access in\norder to manage Incidents with AWS Support.\"\n  tag \"cis_impact\": \"All AWS Support plans include an unlimited number of\naccount and billing support cases, with no long-term contracts.\n\nSupport billing calculations are performed on a per-account basis for all\nplans. Enterprise Support plan customers have the option to include multiple\nenabled accounts in an aggregated monthly billing calculation.\n\nMonthly charges for the Business and Enterprise support plans are based on each\nmonth's AWS usage charges, subject to a monthly minimum, billed in advance.\"\n  tag \"cis_rid\": '1.22'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IR-7', 'Rev_4']\n  tag \"cce_id\": ''\n  tag \"check\": \"Using the Amazon unified command line interface:\n\n* List IAM policies, filter for the 'AWSSupportAccess' managed policy, and note\nthe 'Arn' element value:\n\n 'aws iam list-policies --query 'Policies[?PolicyName == 'AWSSupportAccess']'\n\n\n* Check if the 'AWSSupportAccess' is attached to any IAM user, group or role:\n\n 'aws iam list-entities-for-policy --policy-arn <iam_policy_arn>\n\"\n  tag \"fix\": \"Using the Amazon unified command line interface:\n\n* Create an IAM role for managing incidents with AWS:\n\n* Create a trust relationship policy document that allows <iam_user> to manage\nAWS incidents, and save it locally as /tmp/TrustPolicy.json:\n\n '{\n 'Version': '2012-10-17',\n 'Statement': [\n {\n 'Effect': 'Allow',\n 'Principal': {\n 'AWS': '<iam_user>'\n },\n 'Action': 'sts:AssumeRole'\n }\n ]\n}\n\n\n * Create the IAM role using the above trust policy:\n\n 'aws iam create-role --role-name <_aws_support_iam_role_>\n--assume-role-policy-document file:///tmp/TrustPolicy.json\n\n\n * Attach 'AWSSupportAccess' managed policy to the created IAM role:\n\n 'aws iam attach-role-policy --policy-arn <iam_policy_arn> --role-name\n<_aws_support_iam_role_>\n\n\"\n\n  describe aws_iam_policy('AWSSupportAccess') do\n    it { should be_attached }\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.22.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"Policy AWSSupportAccess is expected to be attached","run_time":0.012945137,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `Policy AWSSupportAccess.attached?` to return true, got false"}]},{"id":"cis-aws-foundations-2.1","title":"Ensure CloudTrail is enabled in all regions","desc":"AWS CloudTrail is a web service that records AWS API calls for your\naccount and delivers log files to you. The recorded information includes the\nidentity of the API caller, the time of the API call, the source IP address of\nthe API caller, the request parameters, and the response elements returned by\nthe AWS service. CloudTrail provides a history of AWS API calls for an account,\nincluding API calls made via the Management Console, SDKs, command line tools,\nand higher-level AWS services (such as CloudFormation).","descriptions":[{"label":"default","data":"AWS CloudTrail is a web service that records AWS API calls for your\naccount and delivers log files to you. The recorded information includes the\nidentity of the API caller, the time of the API call, the source IP address of\nthe API caller, the request parameters, and the response elements returned by\nthe AWS service. CloudTrail provides a history of AWS API calls for an account,\nincluding API calls made via the Management Console, SDKs, command line tools,\nand higher-level AWS services (such as CloudFormation)."}],"impact":0.3,"refs":[],"tags":{"rationale":"The AWS API call history produced by CloudTrail enables\nsecurity analysis, resource change tracking, and compliance auditing.\nAdditionally, ensuring that a multi-regions trail exists will ensure that\nunexpected activity occurring in otherwise unused regions is detected.","cis_impact":"S3 lifecycle features can be used to manage the\naccumulation and management of logs over time. See the following AWS resource\nfor more information on these features:\n\n* http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html","cis_rid":"2.1","cis_level":1,"csc_control":[["14.6"],"6.0"],"nist":["AU-2","Rev_4"],"cce_id":"CCE-78913-1","check":"Perform the following to determine if CloudTrail is enabled for\nall regions:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n\n* Click on Trails_ _on the left navigation pane\n\n* You will be presented with a list of trails across all regions\n\n\n* Ensure at least one Trail has All specified in the Region column\n* Click on a trail via the link in the _Name_ column\n* Ensure Logging is set to ON\n\n* Ensure Apply trail to all regions is set to Yes\n\n'Via CLI\n\n' aws cloudtrail describe-trails\n\n'Ensure IsMultiRegionTrail is set to true","fix":"Perform the following to enable global CloudTrail logging:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* Click on _Trails_ on the left navigation pane\n\n* Click Get Started Now, if presented\n\n* Click Add new trail\n* Enter a trail name in the Trail name box\n* Set the Apply trail to all regions option to Yes\n* Specify an S3 bucket name in the S3 bucket box\n* Click Create\n\n\n* If 1 or more trails already exist, select the target trail to enable for\nglobal logging\n\n* Click the edit icon (pencil) next to Apply trail to all regions\n* Click Yes\n* Click Save\n`\n'Via CLI\n\n'aws cloudtrail create-trail --name _<trail_name>_ --bucket-name\n_<s3_bucket_for_cloudtrail>_ --is-multi-region-trail\naws cloudtrail update-trail --name _<trail_name>_ --is-multi-region-trail"},"code":"control 'cis-aws-foundations-2.1' do\n  title 'Ensure CloudTrail is enabled in all regions'\n  desc  \"AWS CloudTrail is a web service that records AWS API calls for your\naccount and delivers log files to you. The recorded information includes the\nidentity of the API caller, the time of the API call, the source IP address of\nthe API caller, the request parameters, and the response elements returned by\nthe AWS service. CloudTrail provides a history of AWS API calls for an account,\nincluding API calls made via the Management Console, SDKs, command line tools,\nand higher-level AWS services (such as CloudFormation).\"\n  impact 0.3\n  tag \"rationale\": \"The AWS API call history produced by CloudTrail enables\nsecurity analysis, resource change tracking, and compliance auditing.\nAdditionally, ensuring that a multi-regions trail exists will ensure that\nunexpected activity occurring in otherwise unused regions is detected.\"\n  tag \"cis_impact\": \"S3 lifecycle features can be used to manage the\naccumulation and management of logs over time. See the following AWS resource\nfor more information on these features:\n\n* http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html\"\n  tag \"cis_rid\": '2.1'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['14.6'], '6.0']\n  tag \"nist\": ['AU-2', 'Rev_4']\n  tag \"cce_id\": 'CCE-78913-1'\n  tag \"check\": \"Perform the following to determine if CloudTrail is enabled for\nall regions:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the CloudTrail console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n\n* Click on Trails_ _on the left navigation pane\n\n* You will be presented with a list of trails across all regions\n\n\n* Ensure at least one Trail has All specified in the Region column\n* Click on a trail via the link in the _Name_ column\n* Ensure Logging is set to ON\n\n* Ensure Apply trail to all regions is set to Yes\n\n'Via CLI\n\n' aws cloudtrail describe-trails\n\n'Ensure IsMultiRegionTrail is set to true\"\n  tag \"fix\": \"Perform the following to enable global CloudTrail logging:\n\n'Via the management Console\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/cloudtrail\n[https://console.aws.amazon.com/cloudtrail]\n* Click on _Trails_ on the left navigation pane\n\n* Click Get Started Now, if presented\n\n* Click Add new trail\n* Enter a trail name in the Trail name box\n* Set the Apply trail to all regions option to Yes\n* Specify an S3 bucket name in the S3 bucket box\n* Click Create\n\n\n* If 1 or more trails already exist, select the target trail to enable for\nglobal logging\n\n* Click the edit icon (pencil) next to Apply trail to all regions\n* Click Yes\n* Click Save\n`\n'Via CLI\n\n'aws cloudtrail create-trail --name _<trail_name>_ --bucket-name\n_<s3_bucket_for_cloudtrail>_ --is-multi-region-trail\naws cloudtrail update-trail --name _<trail_name>_ --is-multi-region-trail\"\n\n  describe aws_cloudtrail_trails do\n    it { should exist }\n  end\n\n  aws_cloudtrail_trails.trail_arns.each do |trail|\n    describe aws_cloudtrail_trail(trail) do\n      it { should be_multi_region_trail }\n      its('status.is_logging') { should be true }\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.1.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"CloudTrail Trails is expected to exist","run_time":0.000172203,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"passed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis is expected to be multi region trail","run_time":0.012933937,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"failed","code_desc":"CloudTrail arn:aws:cloudtrail:us-east-2:400122527520:trail/aws-cis status.is_logging ","run_time":0.028519523,"start_time":"2020-06-19T14:44:13+00:00","message":"uninitialized constant #<Class:0x0000559ad0e94e98>::AwsCloudTrailTrail::Hashie","exception":"NameError","backtrace":["libraries/aws_cloudtrail_trail.rb:51:in `status'","/var/lib/gems/2.5.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:115:in `block (3 levels) in its'","/var/lib/gems/2.5.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:114:in `each'","/var/lib/gems/2.5.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:114:in `inject'","/var/lib/gems/2.5.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:114:in `block (2 levels) in its'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:317:in `block (2 levels) in let'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:157:in `block (3 levels) in fetch_or_store'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:157:in `fetch'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:157:in `block (2 levels) in fetch_or_store'","/var/lib/gems/2.5.0/gems/rspec-support-3.9.3/lib/rspec/support/reentrant_mutex.rb:23:in `synchronize'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:156:in `block in fetch_or_store'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:155:in `fetch'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:155:in `fetch_or_store'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb:317:in `block in let'","/var/lib/gems/2.5.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:126:in `should'","cis-aws-foundations-baseline/controls/cis-aws-foundations-2.1.rb:88:in `block (4 levels) in load_with_context'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:257:in `instance_exec'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:257:in `block in run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:503:in `block in with_around_and_singleton_context_hooks'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:460:in `block in with_around_example_hooks'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/hooks.rb:481:in `block in run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/hooks.rb:619:in `run_around_example_hooks_for'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/hooks.rb:481:in `run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:460:in `with_around_example_hooks'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:503:in `with_around_and_singleton_context_hooks'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb:254:in `run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:644:in `block in run_examples'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:640:in `map'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:640:in `run_examples'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:606:in `run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:607:in `block in run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:607:in `map'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb:607:in `run'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:121:in `map'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb:2058:in `with_suite_hooks'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:116:in `block in run_specs'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/reporter.rb:74:in `report'","/var/lib/gems/2.5.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb:115:in `run_specs'","/var/lib/gems/2.5.0/gems/inspec-core-4.19.2/lib/inspec/runner_rspec.rb:82:in `run'","/var/lib/gems/2.5.0/gems/inspec-core-4.19.2/lib/inspec/runner.rb:159:in `run_tests'","/var/lib/gems/2.5.0/gems/inspec-core-4.19.2/lib/inspec/runner.rb:130:in `run'","/var/lib/gems/2.5.0/gems/inspec-core-4.19.2/lib/inspec/cli.rb:279:in `exec'","/var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'","/var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'","/var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'","/var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'","/var/lib/gems/2.5.0/gems/inspec-core-4.19.2/lib/inspec/base_cli.rb:35:in `start'","/var/lib/gems/2.5.0/gems/inspec-bin-4.19.2/bin/inspec:11:in `<top (required)>'","/usr/local/bin/inspec:23:in `load'","/usr/local/bin/inspec:23:in `<main>'"]}]},{"id":"cis-aws-foundations-1.9","title":"Ensure IAM password policy requires minimum length of 14 or greater","desc":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are at least\na given length. It is recommended that the password policy require a minimum\npassword length 14.","descriptions":[{"label":"default","data":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are at least\na given length. It is recommended that the password policy require a minimum\npassword length 14."}],"impact":0.3,"refs":[],"tags":{"rationale":"Setting a password complexity policy increases account\nresiliency against brute force login attempts.","cis_impact":"","cis_rid":"1.9","cis_level":1,"csc_control":[["5.7","16.12"],"6.0"],"nist":["IA-5(1)","IA-2","Rev_4"],"cce_id":"CCE-78907-3","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Minimum password length' is set to 14 or greater.\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'MinimumPasswordLength': 14 (or\nhigher)","fix":"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Set 'Minimum password length' to 14 or greater.\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --minimum-password-length 14\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.9' do\n  title \"Ensure IAM password policy requires minimum length of #{pwd_length} or greater\"\n  desc  \"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are at least\na given length. It is recommended that the password policy require a minimum\npassword length #{pwd_length}.\"\n  impact 0.3\n  tag \"rationale\": \"Setting a password complexity policy increases account\nresiliency against brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.9'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['5.7', '16.12'], '6.0']\n  tag \"nist\": ['IA-5(1)', 'IA-2', 'Rev_4']\n  tag \"cce_id\": 'CCE-78907-3'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Minimum password length' is set to #{pwd_length} or greater.\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'MinimumPasswordLength': #{pwd_length} (or\nhigher)\"\n\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Set 'Minimum password length' to #{pwd_length} or greater.\n* Click 'Apply password policy'\n\n' Via CLI\n\n' aws iam update-account-password-policy --minimum-password-length #{pwd_length}\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('minimum_password_length') { should cmp >= pwd_length }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.9.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000166803,"start_time":"2020-06-19T14:44:13+00:00","message":"expected IAM Password-Policy to exist"}]},{"id":"cis-aws-foundations-2.5","title":"Ensure AWS Config is enabled in all regions","desc":"AWS Config is a web service that performs configuration management of\nsupported AWS resources within your account and delivers log files to you. The\nrecorded information includes the configuration item (AWS resource),\nrelationships between configuration items (AWS resources), any configuration\nchanges between resources. It is recommended to enable AWS Config be enabled in\nall regions.","descriptions":[{"label":"default","data":"AWS Config is a web service that performs configuration management of\nsupported AWS resources within your account and delivers log files to you. The\nrecorded information includes the configuration item (AWS resource),\nrelationships between configuration items (AWS resources), any configuration\nchanges between resources. It is recommended to enable AWS Config be enabled in\nall regions."}],"impact":0.3,"refs":[],"tags":{"rationale":"The AWS configuration item history captured by AWS Config\nenables security analysis, resource change tracking, and compliance auditing.","cis_impact":"","cis_rid":"2.5","cis_level":1,"csc_control":[["1.1","1.3","1.4","5.2","11.1","11.3","14.6"],"6.0"],"nist":["CM-8(3)","CM-8(2)","CM-8","AC-6(7)","CM-6(1)","CM-6(2)","AU-2","Rev_4"],"cce_id":"CCE-78917-2","check":"Process to evaluate AWS Config configuration per region\n\n'Via AWS Management Console\n\n 'Sign in to the AWS Management Console and open the AWS Config console at\nhttps://console.aws.amazon.com/config/ [https://console.aws.amazon.com/config/].\n* On the top right of the console select target Region.\n* If presented with Setup AWS Config - follow remediation procedure:\n\n 'On the Resource inventory page, Click on edit (the gear icon). The Set Up AWS\nConfig page appears.\n\n* Ensure 1 or both check-boxes under 'All Resources' is checked.\n\n* Include global resources related to IAM resources - which needs to be enabled\nin 1 region only\n\n\n* Ensure the correct S3 bucket has been defined.\n* Ensure the correct SNS topic has been defined.\n* Repeat steps 2 to 7 for each region.","fix":"Perform the following in the AWS Management Console:\n\n* Select the region you want to focus on in the top right of the console\n* Click Services\n* Click Config\n* Define which resources you want to record in the selected region\n* Choose to include global resources (IAM resources)\n* Specify an S3 bucket in the same account or in another managed AWS account\n* Create an SNS Topic from the same AWS account or another managed AWS account\n\n\n'API Call:\n\n'aws configservice start-configuration-recorder"},"code":"control 'cis-aws-foundations-2.5' do\n  title 'Ensure AWS Config is enabled in all regions'\n  desc  \"AWS Config is a web service that performs configuration management of\nsupported AWS resources within your account and delivers log files to you. The\nrecorded information includes the configuration item (AWS resource),\nrelationships between configuration items (AWS resources), any configuration\nchanges between resources. It is recommended to enable AWS Config be enabled in\nall regions.\"\n  impact 0.3\n  tag \"rationale\": \"The AWS configuration item history captured by AWS Config\nenables security analysis, resource change tracking, and compliance auditing.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '2.5'\n  tag \"cis_level\": 1\n  tag \"csc_control\": [['1.1', '1.3', '1.4', '5.2', '11.1', '11.3', '14.6'], '6.0']\n  tag \"nist\": ['CM-8(3)', 'CM-8(2)', 'CM-8', 'AC-6(7)', 'CM-6(1)', 'CM-6(2)', 'AU-2', 'Rev_4']\n  tag \"cce_id\": 'CCE-78917-2'\n  tag \"check\": \"Process to evaluate AWS Config configuration per region\n\n'Via AWS Management Console\n\n 'Sign in to the AWS Management Console and open the AWS Config console at\nhttps://console.aws.amazon.com/config/ [https://console.aws.amazon.com/config/].\n* On the top right of the console select target Region.\n* If presented with Setup AWS Config - follow remediation procedure:\n\n 'On the Resource inventory page, Click on edit (the gear icon). The Set Up AWS\nConfig page appears.\n\n* Ensure 1 or both check-boxes under 'All Resources' is checked.\n\n* Include global resources related to IAM resources - which needs to be enabled\nin 1 region only\n\n\n* Ensure the correct S3 bucket has been defined.\n* Ensure the correct SNS topic has been defined.\n* Repeat steps 2 to 7 for each region.\"\n  tag \"fix\": \"Perform the following in the AWS Management Console:\n\n* Select the region you want to focus on in the top right of the console\n* Click Services\n* Click Config\n* Define which resources you want to record in the selected region\n* Choose to include global resources (IAM resources)\n* Specify an S3 bucket in the same account or in another managed AWS account\n* Create an SNS Topic from the same AWS account or another managed AWS account\n\n\n'API Call:\n\n'aws configservice start-configuration-recorder\"\n\n  region = ENV['AWS_REGION']\n\n  describe aws_config_recorder do\n    it { should exist }\n    it { should be_recording }\n    it { should be_recording_all_resource_types }\n    it { should be_recording_all_global_types }\n  end\n\n  describe aws_config_delivery_channel do\n    it { should exist }\n  end\n\n  if aws_config_delivery_channel.exists?\n    describe aws_config_delivery_channel do\n      its('s3_bucket_name') { should cmp config_delivery_channels[region]['s3_bucket_name'] } \n      its('sns_topic_arn') { should cmp config_delivery_channels[region]['sns_topic_arn'] } \n    end\n  end\nend\n","source_location":{"line":3,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-2.5.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"Configuration_Recorder:  is expected to exist","run_time":0.000149803,"start_time":"2020-06-19T14:44:13+00:00","message":"expected Configuration_Recorder:  to exist"},{"status":"failed","code_desc":"Configuration_Recorder:  is expected to be recording","run_time":0.012281425,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `Configuration_Recorder: .recording?` to return true, got nil"},{"status":"failed","code_desc":"Configuration_Recorder:  is expected to be recording all resource types","run_time":0.012700033,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `Configuration_Recorder: .recording_all_resource_types?` to return true, got nil"},{"status":"failed","code_desc":"Configuration_Recorder:  is expected to be recording all global types","run_time":0.01252113,"start_time":"2020-06-19T14:44:13+00:00","message":"expected `Configuration_Recorder: .recording_all_global_types?` to return true, got nil"},{"status":"failed","code_desc":"Config_Delivery_Channel:  is expected to exist","run_time":0.000145303,"start_time":"2020-06-19T14:44:13+00:00","message":"expected Config_Delivery_Channel:  to exist"}]},{"id":"cis-aws-foundations-1.16","title":"Ensure IAM policies are attached only to groups or roles","desc":"By default, IAM users, groups, and roles have no access to AWS\nresources. IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended that IAM policies be applied directly to\ngroups and roles but not users.","descriptions":[{"label":"default","data":"By default, IAM users, groups, and roles have no access to AWS\nresources. IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended that IAM policies be applied directly to\ngroups and roles but not users."}],"impact":0.3,"refs":[],"tags":{"rationale":"Assigning privileges at the group or role level reduces the\ncomplexity of access management as the number of users grow. Reducing access\nmanagement complexity may in-turn reduce opportunity for a principal to\ninadvertently receive or retain excessive privileges.","cis_impact":"","cis_rid":"1.16","cis_level":1,"csc_control":"","nist":["AC-6(7)","Rev_4"],"cce_id":"CCE-78912-3","check":"Perform the following to determine if policies are attached\ndirectly to users:\n\n* Run the following to get a list of IAM users:\n\n'aws iam list-users --query 'Users[*].UserName' --output text\n\n* For each user returned, run the following command to determine if any\npolicies are attached to them:\n\n'aws iam list-attached-user-policies --user-name <_iam_user_>\naws iam list-user-policies --user-name _<iam_user>_\n* If any policies are returned, the user has a direct policy attachment.","fix":"Perform the following to create an IAM group and assign a policy\nto it:\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Groups and then click Create New Group.\n\n 'In the Group Name box, type the name of the group and then click Next Step.\n\n 'In the list of policies, select the check box for each policy that you want to\napply to all members of the group. Then click Next Step.\n\n 'Click Create Group\n\n\nPerform the following to add a user to a given group:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Groups\n\n 'Select the group to add a user to\n\n 'Click Add Users To Group\n\n 'Select the users to be added to the group\n* Click Add Users\n\n\nPerform the following to remove a direct association between a user and policy:\n\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n* In the left navigation pane, click on Users\n\n* For each user:\n\n* Select the user\n* Click on the Permissions tab\n* Expand Managed Policies\n* Click Detach Policy for each policy\n* Expand Inline Policies\n* Click Remove Policy for each policy\n\n'\n"},"code":"control 'cis-aws-foundations-1.16' do\n  title 'Ensure IAM policies are attached only to groups or roles'\n  desc  \"By default, IAM users, groups, and roles have no access to AWS\nresources. IAM policies are the means by which privileges are granted to users,\ngroups, or roles. It is recommended that IAM policies be applied directly to\ngroups and roles but not users.\"\n  impact 0.3\n  tag \"rationale\": \"Assigning privileges at the group or role level reduces the\ncomplexity of access management as the number of users grow. Reducing access\nmanagement complexity may in-turn reduce opportunity for a principal to\ninadvertently receive or retain excessive privileges.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.16'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['AC-6(7)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78912-3'\n  tag \"check\": \"Perform the following to determine if policies are attached\ndirectly to users:\n\n* Run the following to get a list of IAM users:\n\n'aws iam list-users --query 'Users[*].UserName' --output text\n\n* For each user returned, run the following command to determine if any\npolicies are attached to them:\n\n'aws iam list-attached-user-policies --user-name <_iam_user_>\naws iam list-user-policies --user-name _<iam_user>_\n* If any policies are returned, the user has a direct policy attachment.\"\n  tag \"fix\": \"Perform the following to create an IAM group and assign a policy\nto it:\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Groups and then click Create New Group.\n\n 'In the Group Name box, type the name of the group and then click Next Step.\n\n 'In the list of policies, select the check box for each policy that you want to\napply to all members of the group. Then click Next Step.\n\n 'Click Create Group\n\n\nPerform the following to add a user to a given group:\n\n\n 'Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n\n 'In the navigation pane, click Groups\n\n 'Select the group to add a user to\n\n 'Click Add Users To Group\n\n 'Select the users to be added to the group\n* Click Add Users\n\n\nPerform the following to remove a direct association between a user and policy:\n\n\n* Sign in to the AWS Management Console and open the IAM console at\nhttps://console.aws.amazon.com/iam/ [https://console.aws.amazon.com/iam/].\n* In the left navigation pane, click on Users\n\n* For each user:\n\n* Select the user\n* Click on the Permissions tab\n* Expand Managed Policies\n* Click Detach Policy for each policy\n* Expand Inline Policies\n* Click Remove Policy for each policy\n\n'\n\"\n  aws_iam_users.entries.each do |user|\n    describe aws_iam_user(username: user.user_name) do\n      it { should_not have_inline_policies }\n      it { should_not have_attached_policies }\n    end\n  end\n\n  if aws_iam_users.entries.empty?\n    describe 'Control skipped because no iam users were found' do\n      skip 'This control is skipped since the aws_iam_users resource returned an empty user list'\n    end\n  end\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.16.rb"},"waiver_data":{},"results":[{"status":"passed","code_desc":"IAM User test-one is expected not to have inline policies","run_time":0.012395327,"start_time":"2020-06-19T14:44:13+00:00"},{"status":"failed","code_desc":"IAM User test-one is expected not to have attached policies","run_time":0.012919537,"start_time":"2020-06-19T14:44:13+00:00","message":"expected #has_attached_policies? to return false, got true"}]},{"id":"cis-aws-foundations-1.6","title":"Ensure IAM password policy require at least one lowercase letter","desc":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one lowercase letter.","descriptions":[{"label":"default","data":"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one lowercase letter."}],"impact":0.3,"refs":[],"tags":{"rationale":"Setting a password complexity policy increases account\nresiliency against brute force login attempts.","cis_impact":"","cis_rid":"1.6","cis_level":1,"csc_control":"","nist":["IA-5(1)","Rev_4"],"cce_id":"CCE-78904-0","check":"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via the AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Requires at least one lowercase letter' is checked under 'Password\nPolicy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireLowercaseCharacters':\ntrue","fix":"Perform the following to set the password policy as prescribed:\n\n'Via the AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Requires at least one lowercase letter'\n* Click 'Apply password policy'\n\n'Via CLI\n\n' aws iam update-account-password-policy --require-lowercase-characters\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command."},"code":"control 'cis-aws-foundations-1.6' do\n  title 'Ensure IAM password policy require at least one lowercase letter'\n  desc  \"Password policies are, in part, used to enforce password complexity\nrequirements. IAM password policies can be used to ensure password are\ncomprised of different character sets. It is recommended that the password\npolicy require at least one lowercase letter.\"\n  impact 0.3\n  tag \"rationale\": \"Setting a password complexity policy increases account\nresiliency against brute force login attempts.\"\n  tag \"cis_impact\": ''\n  tag \"cis_rid\": '1.6'\n  tag \"cis_level\": 1\n  tag \"csc_control\": ''\n  tag \"nist\": ['IA-5(1)', 'Rev_4']\n  tag \"cce_id\": 'CCE-78904-0'\n  tag \"check\": \"Perform the following to ensure the password policy is\nconfigured as prescribed:\n\n'Via the AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Ensure 'Requires at least one lowercase letter' is checked under 'Password\nPolicy'\n\n'Via CLI\n\n'aws iam get-account-password-policy\n\nEnsure the output of the above command includes 'RequireLowercaseCharacters':\ntrue\"\n  tag \"fix\": \"Perform the following to set the password policy as prescribed:\n\n'Via the AWS Console\n\n* Login to AWS Console (with appropriate permissions to View Identity Access\nManagement Account Settings)\n* Go to IAM Service on the AWS Console\n* Click on Account Settings on the Left Pane\n* Check 'Requires at least one lowercase letter'\n* Click 'Apply password policy'\n\n'Via CLI\n\n' aws iam update-account-password-policy --require-lowercase-characters\n\n'Note: All commands starting with 'aws iam update-account-password-policy' can\nbe combined into a single command.\"\n\n\n  describe aws_iam_password_policy do\n    it { should exist }\n  end\n\n  describe aws_iam_password_policy do\n    its('require_lowercase_characters?') { should be true }\n  end if aws_iam_password_policy.exists?\nend\n","source_location":{"line":1,"ref":"cis-aws-foundations-baseline/controls/cis-aws-foundations-1.6.rb"},"waiver_data":{},"results":[{"status":"failed","code_desc":"IAM Password-Policy is expected to exist","run_time":0.000198103,"start_time":"2020-06-19T14:44:13+00:00","message":"expected IAM Password-Policy to exist"}]}],"status":"loaded"}],"statistics":{"duration":6.08376615},"version":"4.19.2"}