-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit refactors the entire sg-base role to use the newest configuration refactor. This refactor includes exciting new features such as CARP, cleaner ways to specify multiple networks, and more! The most notable change with this commit is that the gateway now implements fairly advanced firewalling based on what services are loaded. Ideally in a future version this will be factored out to the individual roles, but right now the template logic to do so would make this commit too complex to review. This refactor includes significant work from @m-wynn.
- Loading branch information
1 parent
534c8f8
commit bfaa814
Showing
16 changed files
with
247 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
cp /etc/resolv.conf.final /etc/resolv.conf |
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 @@ | ||
This system is for authorized use only! |
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 |
---|---|---|
|
@@ -22,3 +22,6 @@ | |
|
||
- name: pf | ||
command: pfctl -f /etc/pf.conf | ||
|
||
- name: sshd | ||
command: /etc/rc.d/sshd restart |
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 |
---|---|---|
@@ -1,7 +1,24 @@ | ||
{% if item.name == sg_interfaces[0].name %} | ||
{# This handles the case where we boot faster that the upstream resolver #} | ||
!cp /etc/resolv.conf.boot /etc/resolv.conf | ||
{% endif %} | ||
{% if item.syncdev is defined %} | ||
up syncdev {{ item.syncdev }} | ||
{% else %} | ||
{% if item.address is defined %} | ||
{% if item.carpdev is defined %} | ||
inet {{ item.address | ipaddr('address') }} {{ item.address | ipaddr('netmask') }} NONE vhid {{ item.vhid }} carpdev {{ item.carpdev }} advskew {{ item.advskew }} | ||
{% else %} | ||
{% if item.address | ipaddr %} | ||
inet {{ item.address }} {{ item.cidr | ipaddr('netmask') }} NONE | ||
inet {{ item.address | ipaddr('address') }} {{ item.address | ipaddr('netmask') }} NONE | ||
{% if item.aliases is defined %} | ||
{% for alias in item.aliases %} | ||
inet alias {{ alias | ipaddr('address') }} {{ alias | ipaddr('netmask') }} | ||
{% endfor %} | ||
{% endif %} | ||
{% elif item.address == "dhcp" %} | ||
dhcp | ||
{% endif %} | ||
-inet6 | ||
up | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} |
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,13 @@ | ||
127.0.0.1 localhost | ||
::1 localhost | ||
|
||
{# This might seem like an epic kludge, but really this allows us to | ||
absolutely know that pf will come up even if the external boot | ||
resolver is absolutely dead. This list must contain all symbolic | ||
names that are used in the pf rules for hosts managed by this | ||
router. #} | ||
{% if sg_globalconf.boothosts is defined %} | ||
{% for host in sg_globalconf.boothosts %} | ||
{{ host.ip }} {{ host.name }} | ||
{% endfor %} | ||
{% endif %} |
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,2 @@ | ||
{# This defaults to localhost to account for if dhcp is used for egress #} | ||
{{ sg_globalconf.default_gateway | default('127.0.0.1') }} |
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 +1 @@ | ||
{{ sg_globalconf.hostname }}.{{ sg_globalconf.domain }} | ||
{{ sg_globalconf.hostname }} |
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,2 @@ | ||
installpath = {{ sg_pkg_path }} | ||
|
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 @@ | ||
lookup file bind | ||
{% for resolver in sg_globalconf.bootresolvers %} | ||
nameserver {{ resolver }} | ||
{% endfor %} |
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,7 @@ | ||
lookup file bind | ||
{# Abandon all hope ye who enter here #} | ||
{# This gets the address of the first adapter that has dns running on it #} | ||
{% set net = sg_networks|selectattr('services', 'issuperset', ['dns'])|list|first %} | ||
{% set interface = sg_interfaces|selectattr('name', 'equalto', net.attach_to) %} | ||
{% set address = interface|map(attribute='address')|ipaddr('address')|first %} | ||
nameserver {{ address }} |
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 @@ | ||
PermitRootLogin no | ||
|
||
AuthorizedKeysFile .ssh/authorized_keys | ||
{% if sg_globalconf.ssh is defined and sg_globalconf.ssh.permit_password is defined %} | ||
PasswordAuthentication {{ sg_globalconf.ssh.permit_password | ternary('yes', 'no') }} | ||
{% endif %} | ||
|
||
Banner /etc/ssh/sshd_banner | ||
|
||
Subsystem sftp /usr/libexec/sftp-server |