Skip to content

Commit ffed0dd

Browse files
committed
doc: update container documentation a bit
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent eab7fef commit ffed0dd

File tree

4 files changed

+151
-3
lines changed

4 files changed

+151
-3
lines changed

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,34 @@ compatible runtime.
2020

2121
The [KernelKit AppStore][2] on GHCR provides the following pre-built images.
2222

23+
2324
### [curiOS system][3]
2425

25-
A system container, example of how to run multiple services. Comes with the
26-
following services and tools:
26+
An example system container, shows how to run multiple services. Comes with
27+
the following services and tools:
2728

29+
- BusyBox (full configuration)
2830
- Dropbear SSH daemon
2931
- mini-snmpd
3032
- netopeer-cli
3133
- nftables
3234
- ntpd
3335

36+
See this blog post on how to use this container with Infix:
37+
38+
- [Infix Advanced Container Networking](https://kernelkit.org/posts/advanced-containers/)
39+
40+
3441
### [curiOS ntpd][4]
3542

36-
ISC ntpd supports [multicasting NTP][10] to a subnet.
43+
This container is only `ntpd`, started by `tini` with `-n -g` flags. The
44+
default configuration file is `/etc/ntp.conf`, see `doc/` for a sample. To
45+
override use a mount or volume, and remember to also set up a volume for the
46+
`/var` or `/var/lib` directory to let the daemon save drift data.
47+
48+
ISC ntpd supports [multicasting NTP][10] to a subnet. For more information
49+
see the [official ntpd site](https://www.ntp.org/).
50+
3751

3852
### [curiOS nftables][5]
3953

@@ -44,12 +58,28 @@ At shutdown `nft flush ruleset` is called.
4458
This container comes with a minimal set of BusyBox tools, including a shell,
4559
so the `nftables.conf` file can be modified from inside the container (vi).
4660
Although the most common use-case is to mount a file from the host system.
61+
See `doc/` for two samples: end-device and home router.
62+
63+
See this blog post on how to use this container with Infix:
64+
65+
- [Infix w/ WAN+LAN firewall setup](https://kernelkit.org/posts/firewall-container/)
66+
4767

4868
### [curiOS httpd][6]
4969

5070
Tiny web server container based on BusyBox httpd, suitable for embedding in a
5171
firmware image as an example container.
5272

73+
The server looks for `/var/www/index.html`, so use a volume on `/var/www` to
74+
change the default web page.
75+
76+
With a custom command you can also change the default command line, e.g, to
77+
run in foreground, with verbose mode, on port 8080:
78+
79+
- `/usr/sbin/httpd -f -v -p 8080`
80+
81+
For more help, see the [BusyBox docs](https://busybox.net/downloads/BusyBox.html#httpd)
82+
5383

5484
## Origin & References
5585

doc/nftables-router.conf.sample

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/sbin/nft -f
2+
# Simple home router ruleset with NAT, LAN access, and limited WAN exposure
3+
define WAN = eth0
4+
define LAN = br0
5+
define NET = 192.168.0.0/24
6+
7+
# Clear existing rules to avoid duplication or conflicts
8+
flush ruleset
9+
10+
table ip filter {
11+
chain wan {
12+
# Accept ping for diagnostics, with rate limit
13+
icmp type echo-request limit rate 5/second accept
14+
15+
# allow SSH connections from some well-known internet host
16+
#ip saddr 81.209.165.42 tcp dport ssh accept
17+
}
18+
19+
chain lan {
20+
icmp type echo-request accept
21+
22+
# allow DHCP, DNS and SSH from the private network
23+
ip protocol . th dport vmap {
24+
tcp . 22 : accept,
25+
udp . 53 : accept,
26+
tcp . 53 : accept,
27+
udp . 67 : accept,
28+
udp . 68 : accept
29+
}
30+
31+
# allow anything else from trusted subnet
32+
ip saddr $NET accept
33+
}
34+
35+
chain input {
36+
type filter hook input priority 0; policy drop;
37+
38+
# Allow traffic from established and related packets, drop invalid
39+
ct state vmap {
40+
established : accept,
41+
related : accept,
42+
invalid : drop
43+
}
44+
45+
# allow loopback traffic, anything else jump to chain for further evaluation
46+
iifname vmap {
47+
lo : accept,
48+
$WAN : jump wan,
49+
$LAN : jump lan
50+
}
51+
52+
# the rest is dropped by the above policy
53+
}
54+
55+
chain forward {
56+
type filter hook forward priority 0; policy drop;
57+
58+
# allow new connections from LAN
59+
iifname $LAN accept
60+
61+
# Allow traffic from established and related packets, drop invalid
62+
ct state vmap {
63+
established : accept,
64+
related : accept,
65+
invalid : drop
66+
}
67+
}
68+
}
69+
70+
table ip nat {
71+
chain prerouting {
72+
type nat hook prerouting priority filter; policy accept;
73+
}
74+
75+
chain postrouting {
76+
type nat hook postrouting priority srcnat; policy accept;
77+
ip saddr $NET oif $WAN masquerade
78+
}
79+
}

doc/nftables.conf.sample

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/sbin/nft -f
2+
# Simple firewall for end devices, allows SSH, HTTPS, NETCONF (SSH), and ICMP
3+
4+
table inet filter {
5+
chain input {
6+
type filter hook input priority 0;
7+
8+
ct state {established, related} accept
9+
ct state invalid drop
10+
11+
iifname lo accept
12+
13+
ip protocol icmp accept
14+
ip6 nexthdr icmpv6 accept
15+
16+
tcp dport {ssh, https, netconf} accept
17+
18+
reject with icmp type port-unreachable
19+
}
20+
21+
chain forward {
22+
type filter hook forward priority 0;
23+
drop
24+
}
25+
26+
chain output {
27+
type filter hook output priority 0;
28+
}
29+
}

doc/ntp.conf.sample

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
server 0.pool.ntp.org iburst
2+
server 1.pool.ntp.org iburst
3+
server 2.pool.ntp.org iburst
4+
server 3.pool.ntp.org iburst
5+
6+
# Allow only time queries, at a limited rate, sending KoD when in excess.
7+
# Allow all local queries (IPv4, IPv6)
8+
restrict default nomodify nopeer noquery limited kod
9+
restrict 127.0.0.1
10+
restrict [::1]

0 commit comments

Comments
 (0)