Skip to content

Commit 55a0801

Browse files
authored
Enable/Disable HTTP access is flexible now (#14)
1 parent e09fc38 commit 55a0801

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ 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_
21+
* **whitelist_http:** List of IP addresses that you can allow HTTP connections.
22+
* **internal_cidrs:** List of CIDRs that will be whitelisted to access the VPN server internally.
2223
* **tags:** Map of AWS Tag key and values
2324
* **resource_name_prefix:** All the resources will be prefixed with the value of this variable
2425
* **healthchecks_io_key:** Health check key for healthchecks.io

main.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,13 @@ resource "aws_security_group" "pritunl" {
167167

168168
# HTTP access for Let's Encrypt validation
169169
ingress {
170-
from_port = 80
171-
to_port = 80
172-
protocol = "tcp"
173-
cidr_blocks = ["0.0.0.0/0"]
170+
from_port = 80
171+
to_port = 80
172+
protocol = "tcp"
173+
174+
cidr_blocks = [
175+
"${var.whitelist_http}",
176+
]
174177
}
175178

176179
# HTTPS access
@@ -240,7 +243,7 @@ resource "aws_security_group" "allow_from_office" {
240243
ingress {
241244
description = "Allow ICMPv4 from select CIDRs"
242245
from_port = -1
243-
to_port = -1
246+
to_port = -1
244247
protocol = "icmp"
245248
cidr_blocks = ["${var.whitelist}"]
246249
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ variable "whitelist" {
2525
type = "list"
2626
}
2727

28+
variable "whitelist_http" {
29+
description = "[List] Whitelist for HTTP port"
30+
type = "list"
31+
default = ["0.0.0.0/0"]
32+
}
33+
2834
variable "tags" {
2935
description = "A map of tags to add to all resources"
3036
default = {}

0 commit comments

Comments
 (0)