quickstart-cisco-asav-ravpn-instance.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. AWSTemplateFormatVersion: 2010-09-09
  2. Description: >-
  3. Cisco Systems - Creates the necessary policies, roles, security group and
  4. launches Cisco ASAv Instance(s). (qs-1qp7e9tnh)
  5. Metadata:
  6. ParameterLabels:
  7. InstanceTypeParam:
  8. default: ASAv instance type
  9. KeyPair:
  10. default: keypair name
  11. MgmtSubnet1CIDR:
  12. default: Mgmt subnet 1
  13. PrivateSubnet1ID:
  14. default: Private subnet 1
  15. PublicSubnet1ID:
  16. default: Public subnet 1
  17. VPCID:
  18. default: VPC ID
  19. DnsName:
  20. default: Dns name
  21. ASAv1HostName:
  22. default: ASAv1 Hostname
  23. VPNPoolFrom1:
  24. default: VPN Pool Start
  25. VPNPoolTo1:
  26. default: VPN Pool Finish
  27. VPNPoolCIDRMask1:
  28. default: NETMASK of VPN Pool
  29. VPCCIDRMASK:
  30. default: netmask of VPCCIDR
  31. VPCPOOL:
  32. default: pool of VPC
  33. VPNUser:
  34. default: VPN User
  35. VPNPassword:
  36. default: VPN Password
  37. OnPremCIDRMask:
  38. default: onprem network MASK
  39. OnPremPool:
  40. default: onprem pool
  41. PrivateSubnet1GW:
  42. default: private subnet GW
  43. PrivateSubnet1CIDR:
  44. default: private subnet CIDR format
  45. PrivateSubnet1Pool:
  46. default: Private subnet pool
  47. PrivateSubnet1CIDRMask:
  48. default: Private subnet mask
  49. PublicHostedZone:
  50. default: Private hosted zone Id
  51. MgmtRouteTable:
  52. default: Management route table Id
  53. ASAvInstanceSGMGMT:
  54. default: ASAv Instance Management Security group Id
  55. ASAvInstanceSGOUTSIDE:
  56. default: ASAv Instance Outside Security group Id
  57. ASAvInstanceSGINSIDE:
  58. default: ASAv Instance Inside Security group Id
  59. Parameters:
  60. InstanceTypeParam:
  61. Type: String
  62. Default: c5.large
  63. AllowedValues:
  64. - m4.large
  65. - m4.xlarge
  66. - m4.2xlarge
  67. - c3.large
  68. - c3.xlarge
  69. - c3.2xlarge
  70. - c4.large
  71. - c4.xlarge
  72. - c4.2xlarge
  73. - c5.large
  74. - c5.xlarge
  75. - c5.2xlarge
  76. Description: Select an instance size for the ASAv.
  77. KeyPair:
  78. Type: AWS::EC2::KeyPair::KeyName
  79. Description: ASAv instances will launch with this keypair
  80. VPCID:
  81. Type: AWS::EC2::VPC::Id
  82. Description: Select VPC which ASAv will be deployed in
  83. VPNUser:
  84. Type: String
  85. Description: Test VPN Username
  86. VPNPassword:
  87. Type: String
  88. Description: Test VPN Password
  89. NoEcho: true
  90. MgmtSubnet1CIDR:
  91. AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
  92. ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  93. Description: CIDR block for Mgmt subnet 1 in Availability Zone 1
  94. Type: String
  95. PrivateSubnet1ID:
  96. Type: AWS::EC2::Subnet::Id
  97. Description: Private Subnet 1 ID
  98. PublicSubnet1ID:
  99. Type: AWS::EC2::Subnet::Id
  100. Description: Public Subnet 1 ID
  101. DnsName:
  102. Type: String
  103. Description: DNS name of PublicHostedZone
  104. ASAv1HostName:
  105. Type: String
  106. Description: ASAv1 Hostname
  107. VPNPoolFrom1:
  108. Type: String
  109. Description: VPN Pool Start
  110. VPNPoolTo1:
  111. Type: String
  112. Description: VPN Pool Finish
  113. VPNPoolCIDRMask1:
  114. Type: String
  115. Description: NETMASK of VPN CIDR Pool
  116. VPCCIDRMASK:
  117. Type: String
  118. Description: netmask of VPC
  119. VPCPOOL:
  120. Type: String
  121. Description: pool of VPC
  122. OnPremCIDRMask:
  123. Type: String
  124. Description: onprem network MASK
  125. OnPremPool:
  126. Type: String
  127. Description: onprem pool
  128. PrivateSubnet1GW:
  129. Type: String
  130. Description: private subnet GW
  131. PrivateSubnet1CIDR:
  132. AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
  133. ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
  134. Description: CIDR block for the On-prem network
  135. Type: String
  136. PrivateSubnet1Pool:
  137. Type: String
  138. Description: Private subnet pool
  139. PrivateSubnet1CIDRMask:
  140. Type: String
  141. Description: Private subnet mask
  142. PublicHostedZone:
  143. Type: String
  144. Description: Resource ID of the Public Hosted Zone
  145. MgmtRouteTable:
  146. Type: String
  147. Description: Resource ID of the Management Route Table
  148. ASAvInstanceSGMGMT:
  149. Type: String
  150. Description: Security Group ID for Management instance
  151. ASAvInstanceSGOUTSIDE:
  152. Type: String
  153. Description: Security Group ID for Outside instance
  154. ASAvInstanceSGINSIDE:
  155. Type: String
  156. Description: Security Group ID for Inside instance
  157. InstanceIdentifier:
  158. Type: Number
  159. Description: RAVPN Instance No.
  160. Mappings:
  161. AWSAMIRegionMap:
  162. eu-north-1:
  163. HVM64: ami-005e678f521ec99d0
  164. ap-south-1:
  165. HVM64: ami-024dc7bfa98b41ec6
  166. eu-west-3:
  167. HVM64: ami-06c7b0231eb402d16
  168. eu-west-2:
  169. HVM64: ami-0bec420a926af5be6
  170. eu-west-1:
  171. HVM64: ami-09cc7f08a29818836
  172. ap-northeast-2:
  173. HVM64: ami-08d0dad22fc46b6d9
  174. ap-northeast-1:
  175. HVM64: ami-09bdeeb4666c0bb9d
  176. sa-east-1:
  177. HVM64: ami-08e47d7858321f80c
  178. ca-central-1:
  179. HVM64: ami-07f9b49973a350949
  180. ap-southeast-1:
  181. HVM64: ami-0e397151d9d5c4e82
  182. ap-southeast-2:
  183. HVM64: ami-07781517dd89226fb
  184. eu-central-1:
  185. HVM64: ami-000b858ff24a0d33f
  186. us-east-1:
  187. HVM64: ami-0408c1a8f87e2e0d4
  188. us-east-2:
  189. HVM64: ami-06554acf8888fbe0d
  190. us-west-1:
  191. HVM64: ami-0312fb96da1e1fe74
  192. us-west-2:
  193. HVM64: ami-00a1cfa66bfdcfe76
  194. CIDRtoSubnetmask:
  195. '16':
  196. mask: '255.255.0.0'
  197. '17':
  198. mask: '255.255.128.0'
  199. '18':
  200. mask: '255.255.192.0'
  201. '19':
  202. mask: '255.255.224.0'
  203. '20':
  204. mask: '255.255.240.0'
  205. '21':
  206. mask: '255.255.248.0'
  207. '22':
  208. mask: '255.255.252.0'
  209. '23':
  210. mask: '255.255.254.0'
  211. '24':
  212. mask: '255.255.255.0'
  213. '25':
  214. mask: '255.255.255.128'
  215. '26':
  216. mask: '255.255.255.192'
  217. '27':
  218. mask: '255.255.255.224'
  219. '28':
  220. mask: '255.255.255.240'
  221. Resources:
  222. ASAvDNSRecord:
  223. Type: AWS::Route53::RecordSet
  224. Properties:
  225. HostedZoneId: !Ref PublicHostedZone
  226. Name: !Join
  227. - '.'
  228. - - 'vpn'
  229. - !Ref DnsName
  230. TTL: 5
  231. Type: A
  232. HealthCheckId: !Ref R53HealthCheck
  233. SetIdentifier: !Sub 'Frontend-${InstanceIdentifier}'
  234. Weight: 4
  235. ResourceRecords:
  236. - !Ref outsideIP
  237. R53HealthCheck:
  238. Type: 'AWS::Route53::HealthCheck'
  239. Properties:
  240. HealthCheckConfig:
  241. IPAddress: !Ref outsideIP
  242. Port: 443
  243. Type: HTTPS_STR_MATCH
  244. ResourcePath: '/'
  245. RequestInterval: 30
  246. FailureThreshold: 5
  247. MeasureLatency: true
  248. SearchString: '+CSCOE+'
  249. HealthCheckTags:
  250. -
  251. Key: Name
  252. Value: ASAvHealthcheck
  253. MgmtSubnet1:
  254. Type: AWS::EC2::Subnet
  255. Properties:
  256. VpcId: !Ref VPCID
  257. CidrBlock: !Ref 'MgmtSubnet1CIDR'
  258. AvailabilityZone:
  259. Fn::Select:
  260. - !Ref InstanceIdentifier
  261. - Fn::GetAZs: ""
  262. Tags:
  263. - Key: Name
  264. Value: !Sub 'Mgmt subnet ${InstanceIdentifier}'
  265. MGMTRouteTableAssociation:
  266. Type: AWS::EC2::SubnetRouteTableAssociation
  267. Properties:
  268. SubnetId: !Ref 'MgmtSubnet1'
  269. RouteTableId: !Ref 'MgmtRouteTable'
  270. outsideIP:
  271. Type: AWS::EC2::EIP
  272. Properties:
  273. Domain: vpc
  274. associateOutsideIP:
  275. Type: AWS::EC2::EIPAssociation
  276. Properties:
  277. AllocationId: !GetAtt outsideIP.AllocationId
  278. NetworkInterfaceId: !Ref outsideENI
  279. mgmtENI:
  280. Type: AWS::EC2::NetworkInterface
  281. Properties:
  282. Tags:
  283. - Key: Name
  284. Value: MgmtEni
  285. Description: A nice description.
  286. SourceDestCheck: false
  287. GroupSet:
  288. - !Ref 'ASAvInstanceSGMGMT'
  289. SubnetId: !Ref MgmtSubnet1
  290. outsideENI:
  291. Type: AWS::EC2::NetworkInterface
  292. Properties:
  293. Tags:
  294. - Key: Name
  295. Value: OutsideEni
  296. Description: A nice description.
  297. SourceDestCheck: false
  298. GroupSet:
  299. - !Ref 'ASAvInstanceSGOUTSIDE'
  300. SubnetId: !Ref PublicSubnet1ID
  301. InsideENI:
  302. Type: AWS::EC2::NetworkInterface
  303. Properties:
  304. Tags:
  305. - Key: Name
  306. Value: InsideEni
  307. Description: A nice description.
  308. SourceDestCheck: false
  309. GroupSet:
  310. - !Ref 'ASAvInstanceSGINSIDE'
  311. SubnetId: !Ref PrivateSubnet1ID
  312. ASAvInstance:
  313. Type: 'AWS::EC2::Instance'
  314. Properties:
  315. Tags:
  316. - Key: Name
  317. Value: !Ref ASAv1HostName
  318. InstanceType: !Ref InstanceTypeParam
  319. KeyName: !Ref KeyPair
  320. ImageId: !FindInMap
  321. - AWSAMIRegionMap
  322. - !Ref 'AWS::Region'
  323. - HVM64
  324. NetworkInterfaces:
  325. - NetworkInterfaceId: !Ref 'mgmtENI'
  326. DeviceIndex: '0'
  327. - NetworkInterfaceId: !Ref 'outsideENI'
  328. DeviceIndex: '1'
  329. - NetworkInterfaceId: !Ref 'InsideENI'
  330. DeviceIndex: '2'
  331. UserData:
  332. Fn::Base64: !Sub
  333. - |
  334. ! ASA Version
  335. hostname ${ASAv1HostName}
  336. !
  337. ip local pool VPN-POOL ${VPNPoolFrom1}-${VPNPoolTo1} mask ${VPNPoolMask1}
  338. access-list split standard permit ${VPCPOOL} ${VPCMASK}
  339. access-list split standard permit ${OnPremPool} ${OnPremMask}
  340. !
  341. username ${VPNUser} password ${VPNPassword}
  342. username ${VPNUser} attributes
  343. service-type remote-access
  344. !
  345. int tengi 0/0
  346. nameif outside
  347. security-level 0
  348. ip address dhcp setroute
  349. no shut
  350. int tengi 0/1
  351. nameif inside
  352. security-level 100
  353. ip address dhcp
  354. no shut
  355. interface management0/0
  356. nameif management
  357. security-level 100
  358. ip address dhcp
  359. no shut
  360. !
  361. !
  362. webvpn
  363. enable outside
  364. anyconnect image disk0:/anyconnect-macos-4.8.02045-webdeploy-k9.pkg 1
  365. anyconnect enable
  366. tunnel-group-list enable
  367. group-policy LAB internal
  368. group-policy LAB attributes
  369. vpn-tunnel-protocol ssl-client ssl-clientless
  370. address-pools value VPN-POOL
  371. split-tunnel-policy tunnelspecified
  372. split-tunnel-network-list value split
  373. dynamic-access-policy-record DfltAccessPolicy
  374. username admin nopassword privilege 15
  375. tunnel-group LAB type remote-access
  376. tunnel-group LAB general-attributes
  377. default-group-policy LAB
  378. address-pool VPN-POOL
  379. tunnel-group LAB webvpn-attributes
  380. group-alias LAB-VPN enable
  381. !
  382. dns domain-lookup outside
  383. dns server-group DefaultDNS
  384. name-server 208.67.222.222
  385. name-server 208.67.220.220
  386. !
  387. same-security-traffic permit inter-interface
  388. same-security-traffic permit intra-interface
  389. !
  390. route inside ${OnPremPool} ${OnPremMask} ${PrivateSubnet1GW}
  391. !
  392. policy-map global_policy
  393. class inspection_default
  394. inspect icmp
  395. !
  396. access-list 101 extended permit ip any any
  397. access-group 101 in interface outside
  398. access-group 101 in interface inside
  399. !
  400. object network NET-${PrivateSubnet1CIDR}
  401. subnet ${PrivateSubnet1Pool} ${PrivateSubnet1Mask}
  402. nat (inside,outside) dynamic interface
  403. !
  404. crypto key generate rsa modulus 2048
  405. ssh 0 0 inside
  406. ssh 0 0 outside
  407. ssh 0 0 management
  408. ssh timeout 30
  409. aaa authentication ssh console LOCAL
  410. username admin nopassword privilege 15
  411. username admin attributes
  412. service-type admin
  413. !
  414. name 129.6.15.28 time-a.nist.gov
  415. name 129.6.15.29 time-b.nist.gov
  416. name 129.6.15.30 time-c.nist.gov
  417. ntp server time-c.nist.gov
  418. ntp server time-b.nist.gov
  419. ntp server time-a.nist.gov
  420. icmp permit any outside
  421. icmp permit any inside
  422. icmp permit any management
  423. !
  424. - VPCMASK: !FindInMap
  425. - CIDRtoSubnetmask
  426. - !Ref VPCCIDRMASK
  427. - mask
  428. VPNPoolMask1: !FindInMap
  429. - CIDRtoSubnetmask
  430. - !Ref VPNPoolCIDRMask1
  431. - mask
  432. OnPremMask: !FindInMap
  433. - CIDRtoSubnetmask
  434. - !Ref OnPremCIDRMask
  435. - mask
  436. PrivateSubnet1Mask: !FindInMap
  437. - CIDRtoSubnetmask
  438. - !Ref PrivateSubnet1CIDRMask
  439. - mask
  440. Outputs:
  441. AccountId:
  442. Description: Amazon Account ID
  443. Value: !Ref 'AWS::AccountId'
  444. MgmtSubnet1CIDR:
  445. Description: Mgmt subnet CIDR
  446. Value: !Ref 'MgmtSubnet1CIDR'
  447. MgmtSubnet1ID:
  448. Description: Mgmt subnet ID
  449. Value: !Ref 'MgmtSubnet1'
  450. InsideENI:
  451. Description: ASAv Instance Inside Network Interface ID
  452. Value: !Ref 'InsideENI'
  453. ASAv1MGMTIP:
  454. Description: ASAv Instance Management IP
  455. Value: !GetAtt mgmtENI.PrimaryPrivateIpAddress
  456. ASAv1PublicIP:
  457. Description: ASAv Instance Public IP
  458. Value: !Ref outsideIP
  459. VPNPoolFrom1:
  460. Description: ASAv Instance VPN Pool From
  461. Value: !Ref VPNPoolFrom1
  462. VPNPoolTo1:
  463. Description: ASAv Instance VPN Pool To
  464. Value: !Ref VPNPoolTo1
  465. VPNPoolCIDRMask1:
  466. Description: ASAv Instance VPN Pool Mask
  467. Value: !Ref VPNPoolCIDRMask1