Skip to content

Commit e09fc38

Browse files
mclueppersleventyalcin
authored andcommitted
* Open port 80 for Let's encrypt validation to pass. (#12)
* Move away from the hardcoded 10.0.0.0/8 network range to proper list * Ammended the documentation with the new option * Minor variable typo fixed
1 parent 4ea8e08 commit e09fc38

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ After provisioning, don't forget to run commands below:
1818
* **ami_id:** Amazon Linux AMI ID
1919
* **instance_type:** Instance type of the VPN box (t2.small is mostly enough)
2020
* **whitelist:** List of office IP addresses that you can SSH and non-VPN connected users can reach temporary profile download pages
21+
* **internal_cidrs:** List of CIDRs that will be whitelisted to access the VPN server internally. _This option replaced the hard-coded 10.0.0.0/8 network range_
2122
* **tags:** Map of AWS Tag key and values
2223
* **resource_name_prefix:** All the resources will be prefixed with the value of this variable
2324
* **healthchecks_io_key:** Health check key for healthchecks.io
2425

2526
# Outputs
2627
* **vpn_instance_private_ip_address:** Private IP address of the instance
27-
* **vpn_public_ip_addres:** EIP of the VPN box
28+
* **vpn_public_ip_address:** EIP of the VPN box
2829
* **vpn_management_ui:** URL for the management UI
2930

3031

main.tf

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,23 @@ resource "aws_security_group" "pritunl" {
162162
from_port = 22
163163
to_port = 22
164164
protocol = "tcp"
165-
cidr_blocks = ["10.0.0.0/8"]
165+
cidr_blocks = ["${var.internal_cidrs}"]
166166
}
167167

168-
# HTTP access
168+
# HTTP access for Let's Encrypt validation
169+
ingress {
170+
from_port = 80
171+
to_port = 80
172+
protocol = "tcp"
173+
cidr_blocks = ["0.0.0.0/0"]
174+
}
175+
176+
# HTTPS access
169177
ingress {
170178
from_port = 443
171179
to_port = 443
172180
protocol = "tcp"
173-
cidr_blocks = ["10.0.0.0/8"]
181+
cidr_blocks = ["${var.internal_cidrs}"]
174182
}
175183

176184
# VPN WAN access
@@ -186,7 +194,7 @@ resource "aws_security_group" "pritunl" {
186194
from_port = -1
187195
to_port = -1
188196
protocol = "icmp"
189-
cidr_blocks = ["10.0.0.0/8"]
197+
cidr_blocks = ["${var.internal_cidrs}"]
190198
}
191199

192200
# outbound internet access
@@ -212,14 +220,16 @@ resource "aws_security_group" "allow_from_office" {
212220

213221
# SSH access
214222
ingress {
223+
description = "Allow SSH access from select CIDRs"
215224
from_port = 22
216225
to_port = 22
217226
protocol = "tcp"
218227
cidr_blocks = ["${var.whitelist}"]
219228
}
220229

221-
# HTTP access
230+
# HTTPS access
222231
ingress {
232+
description = "Allow HTTPS access from select CIDRs"
223233
from_port = 443
224234
to_port = 443
225235
protocol = "tcp"
@@ -228,8 +238,9 @@ resource "aws_security_group" "allow_from_office" {
228238

229239
# ICMP
230240
ingress {
241+
description = "Allow ICMPv4 from select CIDRs"
231242
from_port = -1
232-
to_port = -1
243+
to_port = -1
233244
protocol = "icmp"
234245
cidr_blocks = ["${var.whitelist}"]
235246
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ output "vpn_instance_private_ip_address" {
22
value = "${aws_instance.pritunl.private_ip}"
33
}
44

5-
output "vpn_public_ip_addres" {
5+
output "vpn_public_ip_address" {
66
value = "${aws_eip.pritunl.public_ip}"
77
}
88

variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ variable "ami_id" {
1616

1717
variable "instance_type" {
1818
description = "Instance type for VPN Box"
19+
type = "string"
20+
default = "t2.micro"
1921
}
2022

2123
variable "whitelist" {
@@ -37,3 +39,9 @@ variable "healthchecks_io_key" {
3739
description = "Health check key for healthchecks.io"
3840
default = "invalid"
3941
}
42+
43+
variable "internal_cidrs" {
44+
description = "[List] IP CIDRs to whitelist in the pritunl's security group"
45+
type = "list"
46+
default = ["10.0.0.0/8"]
47+
}

0 commit comments

Comments
 (0)