Repository navigation
Feature/router #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feature/router #11
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0fde146
Add handler to refresh NodeSource apt package cache and update reposi…
embtom 8a55635
Add nftables role with installation, configuration, and service manag…
embtom f5dd75b
Enhance systemd-resolved setup by removing Avahi and NSS mDNS, config…
embtom b62da4e
Add router role with configuration, handlers, and templates for DHCP …
embtom e69b911
Add router role and update README with configuration details for DHCP…
embtom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -74,7 +74,9 @@ | |
| "options": [ | ||
| "common", | ||
| "git", | ||
| "nftables", | ||
| "podman", | ||
| "router", | ||
| "scripts", | ||
| "shell", | ||
| "ssh", | ||
|
|
||
This file contains hidden or 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 hidden or 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,3 @@ | ||
| --- | ||
| router_enabled: false | ||
| router_wan_interface: wlp2s0 |
This file contains hidden or 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 hidden or 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,5 @@ | ||
| --- | ||
| - name: Refresh NodeSource apt package cache | ||
| ansible.builtin.apt: | ||
| update_cache: true | ||
| become: true |
This file contains hidden or 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 hidden or 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,6 @@ | ||
| --- | ||
| - name: Restart nftables | ||
| ansible.builtin.systemd: | ||
| name: nftables | ||
| state: restarted | ||
| become: true |
This file contains hidden or 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,65 @@ | ||
| - name: Install nftables | ||
| ansible.builtin.apt: | ||
| name: | ||
| - nftables | ||
| state: present | ||
| update_cache: true | ||
| become: true | ||
|
|
||
| - name: Ensure nftables rules directory exists | ||
| ansible.builtin.file: | ||
| path: /etc/nftables.d | ||
| state: directory | ||
| owner: root | ||
| group: root | ||
| mode: "0755" | ||
| become: true | ||
|
|
||
| - name: Configure nftables base configuration | ||
| ansible.builtin.copy: | ||
| content: | | ||
| #!/usr/sbin/nft -f | ||
|
|
||
| flush ruleset | ||
|
|
||
| include "/etc/nftables.d/*.nft" | ||
| dest: /etc/nftables.conf | ||
| owner: root | ||
| group: root | ||
| mode: "0644" | ||
| become: true | ||
| notify: Restart nftables | ||
|
|
||
| - name: Configure nftables input filter | ||
| ansible.builtin.template: | ||
| src: 10-filter.nft.j2 | ||
| dest: /etc/nftables.d/10-filter.nft | ||
| owner: root | ||
| group: root | ||
| mode: "0644" | ||
| become: true | ||
| notify: Restart nftables | ||
|
|
||
| - name: Validate assembled nftables configuration | ||
| ansible.builtin.command: | ||
| cmd: /usr/sbin/nft -c -f /etc/nftables.conf | ||
| become: true | ||
| changed_when: false | ||
|
|
||
| - name: Gather service facts | ||
| ansible.builtin.service_facts: | ||
|
|
||
| - name: Disable firewalld | ||
| ansible.builtin.systemd: | ||
| name: firewalld | ||
| enabled: false | ||
| state: stopped | ||
| become: true | ||
| when: ansible_facts.services['firewalld.service'] is defined | ||
|
|
||
| - name: Enable nftables | ||
| ansible.builtin.systemd: | ||
| name: nftables | ||
| enabled: true | ||
| state: started | ||
| become: true |
This file contains hidden or 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,17 @@ | ||
| add table inet filter | ||
|
|
||
| add chain inet filter input { | ||
| type filter hook input priority 0; policy drop; | ||
|
|
||
| ct state invalid drop | ||
| ct state { established, related } accept | ||
| iifname "lo" accept | ||
| ip protocol icmp accept | ||
| ip6 nexthdr icmpv6 accept | ||
| meta nfproto ipv6 udp sport 547 udp dport 546 accept | ||
| # mDNS IPv4 multicast | ||
| ip daddr 224.0.0.251 udp dport 5353 accept | ||
| # mDNS IPv6 multicast | ||
| ip6 daddr ff02::fb udp dport 5353 accept | ||
| tcp dport 22 accept | ||
| } | ||
This file contains hidden or 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 @@ | ||
| --- | ||
| # Set to true for hosts that should route a LAN through a WAN connection. | ||
| router_enabled: false | ||
|
|
||
| # The LAN interface runs the DHCP server; the WAN interface is used for NAT. | ||
| router_lan_interface: usbnet | ||
| router_lan_mac_address: "3c:18:a0:0f:72:63" | ||
| router_wan_interface: wlp1s0 | ||
|
|
||
| # IPv4 configuration advertised to DHCP clients. | ||
| router_lan_address: 192.168.100.1/24 | ||
| router_lan_subnet: 192.168.100.0/24 | ||
| router_dhcp_gateway: 192.168.100.1 | ||
| router_dhcp_dns_servers: | ||
| - "{{ router_dhcp_gateway }}" | ||
|
embtom marked this conversation as resolved.
Resolved
|
||
| router_dhcp_pool_offset: 100 | ||
| router_dhcp_pool_size: 50 | ||
| router_dhcp_default_lease_time: 12h | ||
| router_dhcp_max_lease_time: 24h | ||
|
|
||
| # Distribution packages that provide the RTL8153 USB Ethernet firmware patch. | ||
| router_rtl8153_firmware_packages: | ||
| Debian: firmware-realtek | ||
| Ubuntu: linux-firmware | ||
This file contains hidden or 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,25 @@ | ||
| --- | ||
| - name: Restart NetworkManager | ||
| ansible.builtin.systemd: | ||
| name: NetworkManager | ||
| state: restarted | ||
| become: true | ||
|
|
||
| - name: Restart systemd-networkd | ||
| ansible.builtin.systemd: | ||
| name: systemd-networkd | ||
| state: restarted | ||
| become: true | ||
|
|
||
| - name: Restart systemd-resolved | ||
| ansible.builtin.systemd: | ||
| name: systemd-resolved | ||
| state: restarted | ||
| become: true | ||
|
|
||
| - name: Apply sysctl settings | ||
| ansible.builtin.command: | ||
| cmd: sysctl --system | ||
| become: true | ||
| changed_when: false | ||
| listen: Apply sysctl settings |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.