From 3ad51924ebf52af22f2fe64b82477d7d08512628 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Tue, 16 Mar 2021 00:56:59 +0000 Subject: [PATCH] Add fsol02.home.foo.sh --- group_vars/fsol.yml | 12 +++++++ host_vars/fsol02.home.foo.sh.yml | 15 +++++++++ hosts | 4 +++ playbooks/fsol.yml | 32 +++++++++++++++++++ roles/pf/files/pf.conf.gw_fsol | 55 ++++++++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 group_vars/fsol.yml create mode 100644 host_vars/fsol02.home.foo.sh.yml create mode 100644 playbooks/fsol.yml create mode 100644 roles/pf/files/pf.conf.gw_fsol diff --git a/group_vars/fsol.yml b/group_vars/fsol.yml new file mode 100644 index 0000000..af7bba5 --- /dev/null +++ b/group_vars/fsol.yml @@ -0,0 +1,12 @@ +--- +network_carp_interfaces: + - device: vio2 + vhid: 145 + ipaddr: 37.16.96.145 + netmask: 255.255.255.240 + pass: "{{ carp145_pass }}" + advskew: 128 +network_dns_servers: [172.20.20.10, 172.20.21.1, 172.20.21.2] + +# use custom firewall config +firewall_src: pf.conf.gw_fsol diff --git a/host_vars/fsol02.home.foo.sh.yml b/host_vars/fsol02.home.foo.sh.yml new file mode 100644 index 0000000..3a384e9 --- /dev/null +++ b/host_vars/fsol02.home.foo.sh.yml @@ -0,0 +1,15 @@ +--- +vmhost: vmhost02.home.foo.sh +network_interfaces: + - device: vio0 + vlan: 20 + mac: 52:54:00:ac:dc:40 + ipaddr: 172.20.21.64 + netmask: 255.255.252.0 + proto: static + - device: vio1 + vlan: 103 + proto: dhcp + - device: vio2 + vlan: 102 + proto: none diff --git a/hosts b/hosts index 57fbce2..43dda7f 100644 --- a/hosts +++ b/hosts @@ -4,6 +4,9 @@ adm01.home.foo.sh [collab] collab01.home.foo.sh +[fsol] +fsol02.home.foo.sh + [git] git02.home.foo.sh @@ -62,6 +65,7 @@ ldap collab [openbsd:children] +fsol gw log ns diff --git a/playbooks/fsol.yml b/playbooks/fsol.yml new file mode 100644 index 0000000..3325314 --- /dev/null +++ b/playbooks/fsol.yml @@ -0,0 +1,32 @@ +--- +- import_playbook: "include/deploy-kvm-guest.yml myhosts=fsol" + +- name: configure instance + hosts: fsol + user: root + gather_facts: true + + vars_files: + - "{{ ansible_private }}/vars.yml" + + tasks: + - name: enable ip forwarding + sysctl: + name: "{{ item }}" + sysctl_set: true + value: "1" + with_items: + - net.inet.ip.forwarding + - net.inet6.ip6.forwarding + - name: use manual dns servers + copy: + dest: /etc/dhclient.conf + content: "ignore domain-name-servers, domain-name;\n" + mode: 0644 + owner: root + group: "{{ ansible_wheel }}" + + roles: + - base + - bird + - openvpn diff --git a/roles/pf/files/pf.conf.gw_fsol b/roles/pf/files/pf.conf.gw_fsol new file mode 100644 index 0000000..89bc9fd --- /dev/null +++ b/roles/pf/files/pf.conf.gw_fsol @@ -0,0 +1,55 @@ +# interfaces +int_if = "vio0" +ext_if = "vio1" +dmz_if = "vio2" +fsol_if = "tap0" + +# networks +int_net = "(" $int_if:network ")" +ext_net = "(" $ext_if:network ")" +dmz_net = "(" carp145:network ")" + +# my addrss +int_me = "(" $int_if:0 ")" +ext_me = "(" $ext_if:0 ")" + +# options +set block-policy return +set loginterface $int_if +set skip on lo0 + +# assemble fragmented packets +match in all scrub (no-df) + +# allow icmp +pass quick inet proto icmp +pass quick inet6 proto icmp6 + +# antispoof at this point +antispoof for lo0 +antispoof for vio0 + +# admin connection (internal) +pass in quick on $int_if proto tcp from $int_net to self port ssh + +# internal network +block in quick from any to self +pass out quick on $int_if from $int_me to $int_net + +# dmz network +pass in quick on $dmz_if inet from $dmz_net to any +pass out quick on $dmz_if inet from any to $dmz_net + +# allow myself to communicate dna network but don't use pfsync +pass out quick on $ext_if from self to any + +# fsol (router) network +pass in quick on $fsol_if proto ospf from any to any +pass out quick on $fsol_if proto ospf from self to any +pass in quick on $fsol_if inet from any to $dmz_net +pass out quick on $fsol_if inet from $dmz_net to any +pass out quick on $fsol_if inet from self to any + +# drop rest +block in quick log all +block out quick log all