-
Notifications
You must be signed in to change notification settings - Fork 18
I-ALiRT - vpn tunnel #1334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
laspsandoval
wants to merge
10
commits into
IMAP-Science-Operations-Center:dev
Choose a base branch
from
laspsandoval:vpn_tunnel
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
I-ALiRT - vpn tunnel #1334
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
faa2152
add virtual private gateway that decrypts the incoming IPSec packet a…
laspsandoval 1511dfe
add todo
laspsandoval 1f370c7
setup vpn construct
laspsandoval 36547cb
update stackbuilder
laspsandoval 4241e8c
minor updates
laspsandoval c60b180
fix test
laspsandoval 128bb30
update test
laspsandoval 151bad8
bugfix to networking construct
laspsandoval 7b96199
update algorithm
laspsandoval 1a966e9
update secrets manager
laspsandoval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| """Configure the I-ALiRT VPN connections to NOAA N-Wave.""" | ||
|
|
||
| from aws_cdk import aws_ec2 as ec2 | ||
| from constructs import Construct | ||
|
|
||
|
|
||
| class IalirtVpnConstruct(Construct): | ||
|
laspsandoval marked this conversation as resolved.
|
||
| """NOAA N-Wave customer gateways and VPN connections for I-ALiRT.""" | ||
|
|
||
| def __init__( | ||
| self, | ||
| scope: Construct, | ||
| construct_id: str, | ||
| vpn_gateway: ec2.CfnVPNGateway, | ||
| psk: str, | ||
| wash_ip: str, | ||
| denv_ip: str, | ||
| **kwargs, | ||
| ) -> None: | ||
| """Create NOAA N-Wave customer gateways and VPN connections. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| scope : Construct | ||
| Parent construct. | ||
| construct_id : str | ||
| A unique string identifier for this construct. | ||
| vpn_gateway : ec2.CfnVPNGateway | ||
| The Virtual Private Gateway to attach the VPN connections to. | ||
| psk : str | ||
| Pre-shared key for IKE authentication. Pass a CDK token from | ||
| ``secret_value_from_json(...).to_string()`` so the value is resolved | ||
| by CloudFormation at deploy time and never appears in the template. | ||
| wash_ip : str | ||
| NOAA border router public IP at McLean, VA (WASH), retrieved from SSM. | ||
| denv_ip : str | ||
| NOAA border router public IP at Denver, CO (DENV), retrieved from SSM. | ||
| kwargs : dict | ||
| Keyword arguments. | ||
| """ | ||
| super().__init__(scope, construct_id, **kwargs) | ||
|
|
||
| # Define the crypto settings for the IPSec tunnel, as specified | ||
| # in the N-Wave ICD (NOAA0550). | ||
| # | ||
| # Phase 1 (IKE) — the handshake phase where both sides authenticate each other | ||
| # and agree on encryption keys. Uses pre-shared key (PSK) | ||
| # resolved at deploy time. | ||
| # - IKEv2 only (NOAA requirement) | ||
| # - AES-256 encryption | ||
| # - SHA2-256 integrity | ||
| # - DH group 14 for key exchange | ||
| # - 28800s (8 hour) lifetime | ||
| # | ||
| # Phase 2 (ESP) — the data phase where actual traffic is encrypted. | ||
| # - AES-128 or AES-256 encryption | ||
| # - HMAC-SHA2-256-128 integrity | ||
| # - DH group 14 (PFS — Perfect Forward Secrecy) | ||
| # - 3600s (1 hour) lifetime | ||
| tunnel = ec2.CfnVPNConnection.VpnTunnelOptionsSpecificationProperty( | ||
| pre_shared_key=psk, | ||
| ike_versions=[ | ||
| ec2.CfnVPNConnection.IKEVersionsRequestListValueProperty(value="ikev2") | ||
| ], | ||
| phase1_encryption_algorithms=[ | ||
| ec2.CfnVPNConnection.Phase1EncryptionAlgorithmsRequestListValueProperty( | ||
| value="AES256" | ||
| ) | ||
| ], | ||
| phase1_integrity_algorithms=[ | ||
| ec2.CfnVPNConnection.Phase1IntegrityAlgorithmsRequestListValueProperty( | ||
| value="SHA2-256" | ||
| ) | ||
| ], | ||
| phase1_dh_group_numbers=[ | ||
| ec2.CfnVPNConnection.Phase1DHGroupNumbersRequestListValueProperty( | ||
| value=14 | ||
| ) | ||
| ], | ||
| phase1_lifetime_seconds=28800, | ||
| phase2_encryption_algorithms=[ | ||
| ec2.CfnVPNConnection.Phase2EncryptionAlgorithmsRequestListValueProperty( | ||
| value="AES128" | ||
| ), | ||
| ec2.CfnVPNConnection.Phase2EncryptionAlgorithmsRequestListValueProperty( | ||
| value="AES256" | ||
| ), | ||
| ], | ||
| phase2_integrity_algorithms=[ | ||
| ec2.CfnVPNConnection.Phase2IntegrityAlgorithmsRequestListValueProperty( | ||
| value="SHA2-256" | ||
| ) | ||
| ], | ||
| phase2_dh_group_numbers=[ | ||
| ec2.CfnVPNConnection.Phase2DHGroupNumbersRequestListValueProperty( | ||
| value=14 | ||
| ) | ||
| ], | ||
| phase2_lifetime_seconds=3600, | ||
| ) | ||
|
|
||
| # Customer Gateway - AWS's record of NOAA's router so that AWS can recognize | ||
| # and accept the incoming encrypted packets. | ||
|
|
||
| # Every AWS Site-to-Site VPN connection automatically provisions | ||
| # two auto-assigned tunnel IPs. | ||
| # These LASP IKE Gateways must be given to NOAA. | ||
| for site, ip in {"WASH": wash_ip, "DENV": denv_ip}.items(): | ||
| # AWS needs to know the router's public IP and ASN to establish the tunnel. | ||
| # bgp_asn=64583 is NOAA's ASN per the ICD. | ||
| cgw = ec2.CfnCustomerGateway( | ||
| self, | ||
| f"NoaaCustomerGateway{site}", | ||
| bgp_asn=64583, | ||
| ip_address=ip, | ||
| type="ipsec.1", | ||
| ) | ||
|
|
||
| # Create the VPN connection between our Virtual Private Gateway (VGW) | ||
| # and NOAA's customer gateway. Each connection gets two tunnels by default | ||
| # (AWS requirement for redundancy) — both use the same crypto settings. | ||
| # BGP is used (static_routes_only=False) so that if one site (WASH or DENV) | ||
| # goes down, BGP automatically reroutes traffic through the other. | ||
| # Data flows one way: NOAA sends to us. We do not send to NOAA. | ||
| ec2.CfnVPNConnection( | ||
| self, | ||
| f"NoaaVpnConnection{site}", | ||
| customer_gateway_id=cgw.ref, | ||
| vpn_gateway_id=vpn_gateway.ref, | ||
| type="ipsec.1", | ||
| static_routes_only=False, | ||
| vpn_tunnel_options_specifications=[tunnel, tunnel], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.