Remove comments
This commit is contained in:
@@ -79,48 +79,6 @@ function chunkPorts({ ports }: { ports: string[] }) {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
// function acceptLines({
|
||||
// chain,
|
||||
// source,
|
||||
// destination,
|
||||
// protocol,
|
||||
// ports,
|
||||
// }: {
|
||||
// chain: string;
|
||||
// source: string;
|
||||
// destination?: string;
|
||||
// protocol?: string;
|
||||
// ports: string[];
|
||||
// }) {
|
||||
// const lines: string[] = [];
|
||||
// const protocols = protocolsForRule({
|
||||
// protocol,
|
||||
// has_ports: Boolean(ports[0]),
|
||||
// });
|
||||
// const port_chunks = ports[0] ? chunkPorts({ ports }) : [[]];
|
||||
|
||||
// for (let p = 0; p < protocols.length; p++) {
|
||||
// const proto = protocols[p];
|
||||
|
||||
// for (let c = 0; c < port_chunks.length; c++) {
|
||||
// const chunk = port_chunks[c] || [];
|
||||
|
||||
// lines.push(
|
||||
// joinArgs([
|
||||
// `iptables -A ${chain}`,
|
||||
// `-s ${source}`,
|
||||
// destination ? `-d ${destination}` : undefined,
|
||||
// proto ? `-p ${proto}` : undefined,
|
||||
// proto ? portMatch({ ports: chunk }) : undefined,
|
||||
// `-j ACCEPT`,
|
||||
// ]),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// return lines;
|
||||
// }
|
||||
|
||||
function acceptLines({
|
||||
forward_chain,
|
||||
input_chain,
|
||||
@@ -152,7 +110,6 @@ function acceptLines({
|
||||
? portMatch({ ports: chunk })
|
||||
: undefined;
|
||||
|
||||
// FORWARD: Forwarded ports / Docker containers / WAN
|
||||
lines.push(
|
||||
joinArgs([
|
||||
`iptables -A ${forward_chain}`,
|
||||
@@ -163,7 +120,6 @@ function acceptLines({
|
||||
]),
|
||||
);
|
||||
|
||||
// INPUT: Only allow matching requests bound for THIS interface's host IP
|
||||
lines.push(
|
||||
joinArgs([
|
||||
`iptables -A ${input_chain}`,
|
||||
@@ -174,28 +130,6 @@ function acceptLines({
|
||||
`-j ACCEPT`,
|
||||
]),
|
||||
);
|
||||
|
||||
// // 1. FORWARD chain: Allows routed traffic (including Docker bridges/DNAT)
|
||||
// lines.push(
|
||||
// joinArgs([
|
||||
// `iptables -A ${forward_chain}`,
|
||||
// `-s ${source}`,
|
||||
// proto ? `-p ${proto}` : undefined,
|
||||
// port_match_str,
|
||||
// `-j ACCEPT`,
|
||||
// ]),
|
||||
// );
|
||||
|
||||
// // 2. INPUT chain: Allows traffic bound directly for host OS services
|
||||
// lines.push(
|
||||
// joinArgs([
|
||||
// `iptables -A ${input_chain}`,
|
||||
// `-s ${source}`,
|
||||
// proto ? `-p ${proto}` : undefined,
|
||||
// port_match_str,
|
||||
// `-j ACCEPT`,
|
||||
// ]),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,27 +221,9 @@ export default function buildHostIptablesScripts({
|
||||
};
|
||||
}
|
||||
|
||||
// if (rule.rule_type == "all") {
|
||||
// if (scoped_subnet) {
|
||||
// accept_lines.push(
|
||||
// `iptables -A ${forward} -s ${source} -d ${scoped_subnet} -j ACCEPT`,
|
||||
// `iptables -A ${forward} -s ${source} -o ${target_interface} -j ACCEPT`,
|
||||
// `iptables -A ${input} -s ${source} -j ACCEPT`,
|
||||
// );
|
||||
// } else {
|
||||
// accept_lines.push(
|
||||
// `iptables -A ${forward} -s ${source} -j ACCEPT`,
|
||||
// `iptables -A ${input} -s ${source} -j ACCEPT`,
|
||||
// );
|
||||
// }
|
||||
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if (rule.rule_type == "all") {
|
||||
accept_lines.push(
|
||||
`iptables -A ${forward} -s ${source} -j ACCEPT`,
|
||||
// `iptables -A ${input} -s ${source} -j ACCEPT`,
|
||||
scoped_subnet
|
||||
? `iptables -A ${input} -s ${source} -d ${scoped_subnet} -j ACCEPT`
|
||||
: `iptables -A ${input} -s ${source} -j ACCEPT`,
|
||||
@@ -319,6 +235,7 @@ export default function buildHostIptablesScripts({
|
||||
const destination = normalizeIptablesDestination({
|
||||
destination: rule.destination,
|
||||
});
|
||||
|
||||
const parsed_ports = parsePortList({ ports: rule.ports });
|
||||
|
||||
if (!parsed_ports.success) {
|
||||
@@ -328,16 +245,6 @@ export default function buildHostIptablesScripts({
|
||||
};
|
||||
}
|
||||
|
||||
// accept_lines.push(
|
||||
// ...acceptLines({
|
||||
// chain: forward,
|
||||
// source,
|
||||
// destination,
|
||||
// protocol: rule.protocol || "any",
|
||||
// ports: parsed_ports.ports,
|
||||
// }),
|
||||
// );
|
||||
|
||||
accept_lines.push(
|
||||
...acceptLines({
|
||||
forward_chain: forward,
|
||||
|
||||
Reference in New Issue
Block a user