Skip to content

Commit e0b6cd6

Browse files
Merge pull request #25 from sourcefuse/feature/site-to-site-vpn
Feature - Site to Site VPN
2 parents 2c7b895 + 84bb5c7 commit e0b6cd6

31 files changed

+1304
-494
lines changed

.github/workflows/snyk.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: snyk
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches:
7+
- "**" # matches every branch
8+
- "!main" # excludes main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
security:
15+
runs-on: ubuntu-latest
16+
name: snyk
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Vulnerability scan
22+
uses: snyk/actions/iac@master
23+
with:
24+
command: monitor
25+
args: --severity-threshold=low
26+
27+
- name: Set up Node 18
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
32+
- name: install Snyk CLI
33+
run: npm install -g snyk
34+
35+
- name: snyk monitor
36+
run: snyk iac test --report --severity-threshold=medium
37+
env:
38+
SNYK_TOKEN: ${{ secrets.ARC_SNYK_TOKEN }}

.github/workflows/tflint.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,3 @@ jobs:
3333

3434
- name: Run tflint
3535
run: tflint -f compact
36-
37-
security:
38-
runs-on: ubuntu-latest
39-
name: snyk
40-
steps:
41-
- name: checkout
42-
uses: actions/checkout@v2
43-
- name: Vulnerability scan
44-
uses: snyk/actions/iac@master
45-
with:
46-
command: monitor
47-
args: --severity-threshold=low
48-
- name: Set up Node 18
49-
uses: actions/setup-node@v3
50-
with:
51-
node-version: 18
52-
- name: install Snyk CLI
53-
run: npm install -g snyk
54-
- name: snyk monitor
55-
run: snyk iac test --report
56-
env:
57-
SNYK_TOKEN: ${{ secrets.ARC_SNYK_TOKEN }}

README.md

Lines changed: 17 additions & 49 deletions
Large diffs are not rendered by default.

docs/module-usage-guide/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ For a list of outputs, see the README [Outputs](https://github.com/sourcefuse/te
6969

7070
### Basic Usage
7171

72-
For basic usage, see the [example](https://github.com/sourcefuse/terraform-aws-arc-vpn/tree/main/example) folder.
72+
#### Client VPN
73+
For basic Client VPN usage, see the [example](https://github.com/sourcefuse/terraform-aws-arc-vpn/tree/main/examples/client-vpn) folder.
7374

7475
This example will create:
7576

@@ -93,7 +94,7 @@ This example will create:
9394

9495
The VPN setup allows users to securely connect to the AWS VPC from anywhere, using the created client VPN. The self-signed certificates are used to authenticate the users.
9596

96-
### How to create AWS Client VPN file
97+
##### How to create AWS Client VPN file
9798
- Download and install AWS Client VPN Application [download](https://aws.amazon.com/vpn/client-vpn-download/)
9899
- Download the AWS Client VPN Configuration File
99100
- Navigate to `VPC` > `Client VPN endpoints`
@@ -110,12 +111,29 @@ The VPN setup allows users to securely connect to the AWS VPC from anywhere, usi
110111
Copy from SSM PARAM self-signed-cert-ca.key
111112
</key>
112113
```
114+
#### Site to Site VPN
115+
For basic Site to Site VPN usage, see the [example](https://github.com/sourcefuse/terraform-aws-arc-vpn/tree/main/examples/site-to-site-vpn) folder.
113116

117+
This example will create:
114118

119+
- Customer Gateway (AWS Customer Gateway Resource)
120+
- Represents the on-premises customer gateway device.
121+
- Configured with BGP ASN, IP address, and optional certificate.
122+
- VPN Gateway (AWS Virtual Private Gateway Resource)
123+
- An AWS-side gateway for the VPN connection, attached to a specified VPC.
124+
- Optionally configured with Amazon-side ASN and availability zone.
125+
VPN Connection (AWS VPN Connection Resource)
126+
- Establishes the encrypted IPsec VPN tunnel between the customer gateway and VPN gateway (or Transit Gateway).
127+
- Supports configurations for static or BGP routing, encryption algorithms, and logging.
128+
- Tunnel configurations (e.g., inside CIDR, pre-shared keys, encryption and integrity algorithms) are managed for two tunnels (primary and secondary).
129+
- The module can create a connection to an existing Transit Gateway instead of a VPN Gateway.
130+
Logs and Monitoring
131+
- Enables detailed logging for the tunnels (e.g., CloudWatch logs) with configurable retention periods and output formats.
115132

116133
### Tips and Recommendations
117134

118-
To authenticate the AWS Client VPN, integration with Active Directory (AD) is possible.
135+
136+
To authenticate AWS Client VPN, integration with Active Directory (AD) is supported. This allows user authentication via AD credentials, enhancing security and centralizing access control within your organization's existing infrastructure.
119137

120138
## Troubleshooting
121139

File renamed without changes.
File renamed without changes.

example/README.md renamed to examples/client-vpn/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
| <a name="module_self_signed_cert_ca"></a> [self\_signed\_cert\_ca](#module\_self\_signed\_cert\_ca) | git::https://github.com/cloudposse/terraform-aws-ssm-tls-self-signed-cert.git | 1.3.0 |
2222
| <a name="module_self_signed_cert_root"></a> [self\_signed\_cert\_root](#module\_self\_signed\_cert\_root) | git::https://github.com/cloudposse/terraform-aws-ssm-tls-self-signed-cert.git | 1.3.0 |
2323
| <a name="module_tags"></a> [tags](#module\_tags) | sourcefuse/arc-tags/aws | 1.2.3 |
24-
| <a name="module_vpn"></a> [vpn](#module\_vpn) | sourcefuse/arc-vpn/aws | 1.0.0 |
24+
| <a name="module_vpn"></a> [vpn](#module\_vpn) | ../../ | n/a |
2525

2626
## Resources
2727

example/main.tf renamed to examples/client-vpn/main.tf

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,42 @@ module "self_signed_cert_root" {
140140
## vpn
141141
################################################################################
142142
module "vpn" {
143-
source = "sourcefuse/arc-vpn/aws"
144-
version = "1.0.0" # pin the correct version
145-
146-
vpc_id = data.aws_vpc.this.id
147-
148-
authentication_options_type = "certificate-authentication"
149-
authentication_options_root_certificate_chain_arn = module.self_signed_cert_root.certificate_arn
150-
151-
## access
152-
client_vpn_authorize_all_groups = true
153-
client_vpn_subnet_ids = data.aws_subnets.private.ids
154-
client_vpn_target_network_cidr = data.aws_vpc.this.cidr_block
155-
156-
## self signed certificate
157-
create_self_signed_server_cert = true
158-
self_signed_server_cert_server_common_name = "${var.namespace}-${var.environment}.arc-vpn-example.client"
159-
self_signed_server_cert_organization_name = var.namespace
160-
self_signed_server_cert_ca_pem = module.self_signed_cert_ca.certificate_pem
161-
self_signed_server_cert_private_ca_key_pem = join("", data.aws_ssm_parameter.ca_key[*].value)
162-
163-
## client vpn
164-
client_cidr = cidrsubnet(data.aws_vpc.this.cidr_block, 6, 1)
165-
client_vpn_name = "${var.namespace}-${var.environment}-client-vpn-example"
166-
client_vpn_gateway_name = "${var.namespace}-${var.environment}-vpn-gateway-example"
143+
source = "../../"
144+
#version = "1.0.0" # pin the correct version
145+
146+
name = "poc-dev-client-vpn-example"
147+
namespace = "poc"
148+
environment = "dev"
149+
vpc_id = data.aws_vpc.this.id
150+
151+
client_vpn_config = {
152+
153+
client_cidr_block = cidrsubnet(data.aws_vpc.this.cidr_block, 6, 1)
154+
self_signed_cert_data = {
155+
create = true
156+
secret_path_format = "/%s.%s"
157+
server_common_name = "${var.namespace}-${var.environment}.arc-vpn-example.client"
158+
organization_name = var.namespace
159+
ca_pem = module.self_signed_cert_ca.certificate_pem
160+
private_ca_key_pem = data.aws_ssm_parameter.ca_key.value
161+
}
162+
authentication_options = [
163+
{
164+
root_certificate_chain_arn = module.self_signed_cert_root.certificate_arn
165+
type = "certificate-authentication"
166+
}
167+
]
168+
authorization_options = {
169+
"auth-1" = {
170+
target_network_cidr = data.aws_vpc.this.cidr_block
171+
access_group_id = null
172+
authorize_all_groups = true
173+
}
174+
}
175+
176+
split_tunnel = true
177+
subnet_ids = data.aws_subnets.private.ids
178+
}
167179

168180
tags = module.tags.tags
169181
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)