ramm 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ramm.js +11 -5
- package/dist/types/nft.d.ts +2 -1
- package/package.json +1 -1
package/dist/ramm.js
CHANGED
|
@@ -225,7 +225,10 @@ var addNftPodmanRule = async () => {
|
|
|
225
225
|
await execCommand("nft insert rule inet ramm prerouting iifname @podman_interfaces accept");
|
|
226
226
|
};
|
|
227
227
|
// src/nft.ts
|
|
228
|
-
var createNftTable = ({
|
|
228
|
+
var createNftTable = ({
|
|
229
|
+
allowedIpV4,
|
|
230
|
+
allowedPorts
|
|
231
|
+
}) => {
|
|
229
232
|
const nftTable = `table inet ramm {
|
|
230
233
|
set allowed_ipv4 {
|
|
231
234
|
type ipv4_addr
|
|
@@ -240,8 +243,10 @@ var createNftTable = ({ allowedIpV4 }) => {
|
|
|
240
243
|
ip saddr @allowed_ipv4 tcp dport 22 accept
|
|
241
244
|
tcp dport 22 ct state new limit rate over 700/minute burst 5 packets drop
|
|
242
245
|
tcp dport 22 accept
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
${allowedPorts.map((port) => {
|
|
247
|
+
return `tcp dport ${port} accept`;
|
|
248
|
+
}).join(`
|
|
249
|
+
`)}
|
|
245
250
|
}
|
|
246
251
|
|
|
247
252
|
chain local_chain {
|
|
@@ -258,10 +263,11 @@ var createNftTable = ({ allowedIpV4 }) => {
|
|
|
258
263
|
return nftTable;
|
|
259
264
|
};
|
|
260
265
|
var setupNftable = async ({
|
|
261
|
-
allowedIpV4
|
|
266
|
+
allowedIpV4,
|
|
267
|
+
allowedPorts
|
|
262
268
|
}) => {
|
|
263
269
|
await execCommand("nft flush ruleset");
|
|
264
|
-
const nftTable = createNftTable({ allowedIpV4 });
|
|
270
|
+
const nftTable = createNftTable({ allowedIpV4, allowedPorts });
|
|
265
271
|
await execCommand(`nft -f - <<EOF
|
|
266
272
|
${nftTable}
|
|
267
273
|
EOF`);
|
package/dist/types/nft.d.ts
CHANGED
package/package.json
CHANGED