Skip to content

Commit f80be74

Browse files
authored
Merge pull request #270 from ooni/anonc-test-instance
Anonc test instance
2 parents 4ed32f9 + f6d6b68 commit f80be74

4 files changed

Lines changed: 134 additions & 1 deletion

File tree

ansible/deploy-anonc.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Deploy anoncenv
3+
hosts:
4+
- anonc.dev.ooni.io
5+
become: true
6+
roles:
7+
- role: bootstrap
8+
- role: nginx
9+
- role: prometheus_node_exporter
10+
vars:
11+
node_exporter_port: 9100
12+
node_exporter_host: "0.0.0.0"
13+
prometheus_nginx_proxy_config:
14+
- location: /metrics/node_exporter
15+
proxy_pass: http://127.0.0.1:9100/metrics
16+
- role: anonc

ansible/inventory

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ openvpn2.htz-fsn.prod.ooni.nu
4545

4646
[aws-backend]
4747
fastpath.dev.ooni.io
48-
fastpath.prod.ooni.io
48+
fastpath.prod.ooni.io
49+
anonc.dev.ooni.io

ansible/roles/anonc/tasks/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# For prometheus scrape requests
3+
- name: Flush all handlers
4+
meta: flush_handlers
5+
6+
- name: Allow traffic on port 9200
7+
become: true
8+
tags: prometheus-proxy
9+
blockinfile:
10+
path: /etc/ooni/nftables/tcp/9100.nft
11+
create: yes
12+
block: |
13+
add rule inet filter input tcp dport 9100 counter accept comment "node exporter"
14+
notify:
15+
- reload nftables
16+
17+
# Add Michele's user
18+
- name: Ensure user exists
19+
ansible.builtin.user:
20+
name: morru
21+
comment: "Michele Orru"
22+
shell: /bin/bash
23+
groups: sudo
24+
append: yes
25+
create_home: yes
26+
tags:
27+
- morru
28+
29+
- name: Add SSH key for Michele
30+
ansible.builtin.authorized_key:
31+
user: morru
32+
state: present
33+
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLQroCtPsBHX3AqI+0w3sF+0GP8TnFSfekp1JU5jqkk m@orru.net"
34+
tags:
35+
- morru
36+
37+
- name: Ensure passwordless sudo for deploy user
38+
ansible.builtin.copy:
39+
dest: "/etc/sudoers.d/morru"
40+
content: "morru ALL=(ALL) NOPASSWD:ALL\n"
41+
owner: root
42+
group: root
43+
mode: '0440'
44+
tags:
45+
- morru

tf/environments/dev/main.tf

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,3 +1021,74 @@ module "ooni_monitoring" {
10211021

10221022
tags = local.tags
10231023
}
1024+
1025+
### Anonymous credentials testing instance
1026+
module "ooni_anonc" {
1027+
source = "../../modules/ec2"
1028+
1029+
stage = local.environment
1030+
1031+
vpc_id = module.network.vpc_id
1032+
subnet_id = module.network.vpc_subnet_public[0].id
1033+
private_subnet_cidr = module.network.vpc_subnet_private[*].cidr_block
1034+
dns_zone_ooni_io = local.dns_zone_ooni_io
1035+
1036+
key_name = module.adm_iam_roles.oonidevops_key_name
1037+
instance_type = "t3a.small"
1038+
1039+
name = "oonifastpath"
1040+
ingress_rules = [{
1041+
from_port = 22,
1042+
to_port = 22,
1043+
protocol = "tcp",
1044+
cidr_blocks = ["0.0.0.0/0"],
1045+
}, {
1046+
from_port = 80, # for dehydrated challenge
1047+
to_port = 80,
1048+
protocol = "tcp",
1049+
cidr_blocks = ["0.0.0.0/0"],
1050+
}, {
1051+
from_port = 443, # for the POC hosting
1052+
to_port = 443,
1053+
protocol = "tcp",
1054+
cidr_blocks = ["0.0.0.0/0"],
1055+
}, {
1056+
from_port = 9100, # for node exporter metrics
1057+
to_port = 9100,
1058+
protocol = "tcp"
1059+
cidr_blocks = ["${module.ooni_monitoring_proxy.aws_instance_private_ip}/32"],
1060+
}]
1061+
1062+
egress_rules = [{
1063+
from_port = 0,
1064+
to_port = 0,
1065+
protocol = "-1",
1066+
cidr_blocks = ["0.0.0.0/0"],
1067+
}, {
1068+
from_port = 0,
1069+
to_port = 0,
1070+
protocol = "-1",
1071+
ipv6_cidr_blocks = ["::/0"],
1072+
}]
1073+
1074+
sg_prefix = "oonianonc"
1075+
tg_prefix = "anon"
1076+
1077+
disk_size = 20
1078+
1079+
tags = merge(
1080+
local.tags,
1081+
{ Name = "ooni-tier0-anonc" }
1082+
)
1083+
}
1084+
1085+
resource "aws_route53_record" "anonc_alias" {
1086+
zone_id = local.dns_zone_ooni_io
1087+
name = "anonc.${local.environment}.ooni.io"
1088+
type = "CNAME"
1089+
ttl = 300
1090+
1091+
records = [
1092+
module.ooni_anonc.aws_instance_public_dns
1093+
]
1094+
}

0 commit comments

Comments
 (0)