-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ifconfig fix Pre-tasks fixes fix hardcoded IP some refactoring disable system-based tags disable freebsd tags FreeBSD vpn role #35 add defaults ssh role freebsd default fix dns_adblocking freebsd ubuntu dict fix
- Loading branch information
1 parent
98558c4
commit a639111
Showing
24 changed files
with
613 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# FreeBSD | ||
|
||
It is only possible to install Algo on existing systems only in order to avoid recompiling the kernel while deploying | ||
|
||
## Pre-paring the system | ||
|
||
Ensure that the following kernel options are enabled: | ||
|
||
``` | ||
# sysctl kern.conftxt | grep -iE "IPSEC|crypto" | ||
options IPSEC | ||
options IPSEC_NAT_T | ||
device crypto | ||
``` | ||
|
||
## Available roles | ||
|
||
* vpn | ||
* ssh_tunneling | ||
* dns_adblocking | ||
|
||
## Installation | ||
|
||
`ansible-playbook deploy.yml -t local,vpn -e "server_ip=$server_ip server_user=$server_user IP_subject_alt_name=$server_ip Store_CAKEY=N" --skip-tags cloud` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
|
||
- set_fact: | ||
config_prefix: "/usr/local/" | ||
root_group: wheel | ||
ssh_service_name: sshd | ||
apparmor_enabled: false | ||
strongswan_additional_plugins: | ||
- kernel-pfroute | ||
- kernel-pfkey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: FreeBSD | Install prerequisites | ||
raw: sleep 10 && sudo pkg install -y python27 | ||
|
||
- name: FreeBSD | Configure defaults | ||
raw: sudo ln -sf /usr/local/bin/python2.7 /usr/bin/python2.7 | ||
|
||
- include: facts/FreeBSD.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Ubuntu | Install prerequisites | ||
raw: sleep 10 && sudo apt-get update -qq && sudo apt-get install -qq -y python2.7 | ||
|
||
- name: Ubuntu | Configure defaults | ||
raw: sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 | ||
tags: | ||
- update-alternatives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
- name: restart rsyslog | ||
service: name=rsyslog state=restarted | ||
|
||
- name: restart ipfw | ||
service: name=ipfw state=restarted | ||
|
||
- name: flush routing cache | ||
shell: echo 1 > /proc/sys/net/ipv4/route/flush | ||
|
||
- name: restart loopback | ||
shell: ifdown lo:100 && ifup lo:100 | ||
|
||
- name: restart loopback bsd | ||
shell: > | ||
ifconfig lo100 destroy || true && | ||
ifconfig lo100 create && | ||
ifconfig lo100 inet {{ local_service_ip }} netmask 255.255.255.255 && | ||
ifconfig lo100 inet6 FCAA::1/64; echo $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
|
||
- set_fact: | ||
tools: | ||
- git | ||
- screen | ||
- coreutils | ||
- openssl | ||
- bash | ||
- wget | ||
sysctl: | ||
forwarding: | ||
- net.inet.ip.forwarding | ||
- net.inet6.ip6.forwarding | ||
tags: | ||
- always | ||
|
||
- name: Loopback included into the rc config | ||
blockinfile: | ||
dest: /etc/rc.conf | ||
create: yes | ||
block: | | ||
cloned_interfaces="lo100" | ||
ifconfig_lo100="inet {{ local_service_ip }} netmask 255.255.255.255" | ||
ifconfig_lo100="inet6 FCAA::1/64" | ||
notify: | ||
- restart loopback bsd | ||
tags: | ||
- always | ||
|
||
- name: Enable the gateway features | ||
lineinfile: dest=/etc/rc.conf regexp='^{{ item.param }}.*' line='{{ item.param }}={{ item.value }}' | ||
with_items: | ||
- { param: firewall_enable, value: '"YES"' } | ||
- { param: firewall_type, value: '"open"' } | ||
- { param: gateway_enable, value: '"YES"' } | ||
- { param: natd_enable, value: '"YES"' } | ||
- { param: natd_interface, value: '"{{ ansible_default_ipv4.device|default() }}"' } | ||
- { param: natd_flags, value: '"-dynamic -m"' } | ||
notify: | ||
- restart ipfw | ||
tags: | ||
- always | ||
|
||
- name: FreeBSD | Activate IPFW | ||
shell: > | ||
kldstat -n ipfw.ko || kldload ipfw ; sysctl net.inet.ip.fw.enable=0 && | ||
bash /etc/rc.firewall && sysctl net.inet.ip.fw.enable=1 | ||
- meta: flush_handlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
|
||
- name: Install software updates | ||
apt: update_cache=yes upgrade=dist | ||
tags: | ||
- cloud | ||
|
||
- name: Check if reboot is required | ||
shell: > | ||
if [[ -e /var/run/reboot-required ]]; then echo "required"; else echo "no"; fi | ||
args: | ||
executable: /bin/bash | ||
register: reboot_required | ||
tags: | ||
- cloud | ||
|
||
- name: Reboot | ||
shell: sleep 2 && shutdown -r now "Ansible updates triggered" | ||
async: 1 | ||
poll: 0 | ||
when: reboot_required is defined and reboot_required.stdout == 'required' | ||
ignore_errors: true | ||
tags: | ||
- cloud | ||
|
||
- name: Wait until SSH becomes ready... | ||
local_action: | ||
module: wait_for | ||
port: 22 | ||
host: "{{ inventory_hostname }}" | ||
search_regex: OpenSSH | ||
delay: 10 | ||
timeout: 320 | ||
when: reboot_required is defined and reboot_required.stdout == 'required' | ||
become: false | ||
tags: | ||
- cloud | ||
|
||
- name: Disable MOTD on login and SSHD | ||
replace: dest="{{ item.file }}" regexp="{{ item.regexp }}" replace="{{ item.line }}" | ||
with_items: | ||
- { regexp: '^session.*optional.*pam_motd.so.*', line: '# MOTD DISABLED', file: '/etc/pam.d/login' } | ||
- { regexp: '^session.*optional.*pam_motd.so.*', line: '# MOTD DISABLED', file: '/etc/pam.d/sshd' } | ||
tags: | ||
- cloud | ||
|
||
- name: Loopback for services configured | ||
template: src=10-loopback-services.cfg.j2 dest=/etc/network/interfaces.d/10-loopback-services.cfg | ||
notify: | ||
- restart loopback | ||
tags: | ||
- always | ||
|
||
- name: Loopback included into the network config | ||
lineinfile: dest=/etc/network/interfaces line='source /etc/network/interfaces.d/10-loopback-services.cfg' state=present | ||
notify: | ||
- restart loopback | ||
tags: | ||
- always | ||
|
||
- meta: flush_handlers | ||
tags: | ||
- always | ||
|
||
- name: Check apparmor support | ||
shell: apparmor_status | ||
ignore_errors: yes | ||
register: apparmor_status | ||
|
||
- set_fact: | ||
apparmor_enabled: true | ||
when: '"profiles are in enforce mode" in apparmor_status.stdout' | ||
|
||
- set_fact: | ||
tools: | ||
- git | ||
- screen | ||
- apparmor-utils | ||
- uuid-runtime | ||
- coreutils | ||
- sendmail | ||
- iptables-persistent | ||
- cgroup-tools | ||
- openssl | ||
sysctl: | ||
forwarding: | ||
- net.ipv4.ip_forward | ||
- net.ipv4.conf.all.forwarding | ||
- net.ipv6.conf.all.forwarding | ||
tags: | ||
- always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
|
||
- name: FreeBSD | Enable dnsmasq | ||
lineinfile: dest=/etc/rc.conf regexp=^dnsmasq_enable= line='dnsmasq_enable="YES"' |
Oops, something went wrong.