Commit be84dcd
committed
Fix NFS export, security and consolidate firewall rules
Replace no_root_squash with root_squash in NFS export options. With
no_root_squash, any root user on K8s nodes (or root-running pods) had
full root access to all NFS shares. Now squashed root maps to
configurable anonuid/anongid (default 65534/nobody).
Add anonuid and anongid to the exports template so the mapping is
explicit in /etc/exports.
Consolidate UFW firewall configuration and validation into a single
block so all rules, enable, and verification run as one atomic unit
gated on UFW availability.
Change fsid: fsid is needed because we're exporting subdirectories of a FUSE filesystem (mergerfs).
The loop.index starts at 1 and increments. This is fine as long as storage_dirs never changes order.
If we reorder or insert a directory, existing mounts may break because the fsid changed.
So instead, using a hash of the directory name.
Exporting subdirectories instead of the root. We export /mnt/storage/Videos,
/mnt/storage/Music, etc. separately. This means every app that needs access
to a different subdirectory requires its own PV/PVC.
Instead, export /mnt/storage once and use subPath in K8s volume mounts.
This dramatically simplifies the NFS side and reduces the number of NFS connections.1 parent 88df047 commit be84dcd
File tree
5 files changed
+55
-65
lines changed- docs/guides
- metal/roles/storage
- defaults
- tasks
- templates
5 files changed
+55
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
82 | 103 | | |
83 | 104 | | |
84 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
7 | 13 | | |
8 | 14 | | |
9 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 5 | | |
10 | 6 | | |
11 | 7 | | |
| |||
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 29 | + | |
38 | 30 | | |
39 | 31 | | |
40 | 32 | | |
| |||
53 | 45 | | |
54 | 46 | | |
55 | 47 | | |
56 | | - | |
| 48 | + | |
57 | 49 | | |
58 | 50 | | |
59 | | - | |
60 | | - | |
| 51 | + | |
| 52 | + | |
61 | 53 | | |
62 | | - | |
63 | | - | |
| 54 | + | |
| 55 | + | |
64 | 56 | | |
65 | | - | |
| 57 | + | |
66 | 58 | | |
67 | | - | |
| 59 | + | |
68 | 60 | | |
69 | 61 | | |
70 | 62 | | |
| |||
75 | 67 | | |
76 | 68 | | |
77 | 69 | | |
78 | | - | |
| 70 | + | |
79 | 71 | | |
80 | 72 | | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
84 | 76 | | |
85 | | - | |
86 | 77 | | |
87 | 78 | | |
88 | 79 | | |
89 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
90 | 86 | | |
91 | 87 | | |
92 | 88 | | |
| |||
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 96 | + | |
114 | 97 | | |
115 | 98 | | |
116 | 99 | | |
117 | 100 | | |
118 | 101 | | |
119 | 102 | | |
120 | 103 | | |
121 | | - | |
| 104 | + | |
122 | 105 | | |
123 | 106 | | |
124 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 41 | + | |
52 | 42 | | |
53 | 43 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
59 | 47 | | |
60 | 48 | | |
61 | 49 | | |
| |||
161 | 149 | | |
162 | 150 | | |
163 | 151 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 152 | + | |
170 | 153 | | |
171 | 154 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
177 | 159 | | |
178 | 160 | | |
179 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 6 | + | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
0 commit comments