You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.4 KiB

#!pydsl
state("node_exporter_private ipv4 chain").iptables.chain_present(
"node_exporter_private",
family="ipv4",
)
state("node_exporter_private ipv6 chain").iptables.chain_present(
"node_exporter_private",
family="ipv6",
)
addresses_v4 = __salt__.minion_net.public_addresses("app:metrics", target_type="grain", addr_type="ipv4")
for address in addresses_v4:
# Salt private
state("node_exporter ipv4 " + address).iptables.append(
table="filter",
family="ipv4",
chain="node_exporter_private",
source=address,
protocol="tcp",
match="tcp",
dport=9100,
)
addresses_v6 = __salt__.minion_net.public_addresses("app:metrics", target_type="grain", addr_type="ipv6")
for address in addresses_v6:
state("node_exporter ipv6 " + address).iptables.append(
table="filter",
family="ipv6",
chain="node_exporter_private",
source=address,
protocol="tcp",
match="tcp",
dport=9100,
)
state("node_exporter_private ipv4 input chain").iptables.append(
table="filter",
family="ipv4",
chain="INPUT",
match="comment",
comment="node_exporter_private",
jump="node_exporter_private",
)
state("node_exporter_private ipv6 input chain").iptables.append(
table="filter",
family="ipv6",
chain="INPUT",
match="comment",
comment="node_exporter_private",
jump="node_exporter_private",
)