Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. AWSTemplateFormatVersion: 2010-09-09
  2. Description: >-
  3. Provision EC2 instance running Qualys scanner + associated role for auditor
  4. Parameters:
  5. AuditorAccountId:
  6. Description: AccountId of auditor
  7. Type: String
  8. AuditorStsExternalId:
  9. Description: ExternalId of auditor
  10. Type: String
  11. VpcName:
  12. Description: Name of VPC where the scanner instance was deployed
  13. Type: String
  14. ScannerInstanceIP:
  15. Description: IPv4 address of Qualys scanner instance
  16. Type: String
  17. Department:
  18. Description: The department for this resource (i.e. Computational Oncology)
  19. Type: String
  20. Project:
  21. Description: The name of the project that this resource is used for (i.e. Resilience)
  22. Type: String
  23. OwnerEmail:
  24. Description: The owner's email address for this resource (i.e. jsmith@sagebase.org)
  25. Type: String
  26. Resources:
  27. AWSIAMSecurityAuditRole:
  28. Type: "AWS::IAM::Role"
  29. Properties:
  30. AssumeRolePolicyDocument:
  31. Version: "2012-10-17"
  32. Statement:
  33. -
  34. Effect: Allow
  35. Principal:
  36. AWS: !Sub
  37. - arn:aws:iam::${acctId}:root
  38. - { acctId: !Ref AuditorAccountId }
  39. Action:
  40. - sts:AssumeRole
  41. Condition: {
  42. StringEquals: {
  43. 'sts:ExternalId': !Ref AuditorStsExternalId
  44. }
  45. }
  46. Path: "/"
  47. ManagedPolicyArns:
  48. - arn:aws:iam::aws:policy/SecurityAudit
  49. ScannedInstancesSecurityGroup:
  50. Type: 'AWS::EC2::SecurityGroup'
  51. Properties:
  52. GroupDescription: 'Open all ports for incoming traffic'
  53. VpcId: !ImportValue
  54. 'Fn::Sub': '${AWS::Region}-${VpcName}-VPCId'
  55. SecurityGroupIngress:
  56. - CidrIp: !Sub
  57. - ${ip}/32
  58. - { ip: !Ref ScannerInstanceIP }
  59. FromPort: '-1'
  60. ToPort: '-1'
  61. IpProtocol: '-1'
  62. SecurityGroupEgress:
  63. - CidrIp: '0.0.0.0/0'
  64. FromPort: '-1'
  65. ToPort: '-1'
  66. IpProtocol: '-1'
  67. Outputs:
  68. SecurityGroup:
  69. Value: !Ref ScannedInstancesSecurityGroup
  70. Export:
  71. Name: !Sub '${AWS::Region}-${AWS::StackName}-ScanSecurityGroup'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement