Closed mandelsoft closed 3 years ago
/assign
Hi @mandelsoft i was trying to test your iptable script locally before adding it and found sth, i wrote a shell with same content and run like this
➜ /tmp vim ip.sh
➜ /tmp chmod +x ip.sh
➜ /tmp ./ip.sh
./ip.sh: line 3: iptables-save: command not found
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
is there anything wrong from my side? i'm using Mac and my shell is zsh
/tmp echo $SHELL
/bin/zsh
/tmp cat ip.sh
#!/bin/bash
table=
iptables-save | while IFS= read -r line; do
if [ "${line#\**}" != "$line" ]; then
table="$line"
else
echo "$table: $line"
fi
done | grep "$@"
@neo-liang-sap I guess you have to try it from within the ops-toolbelt
Hi @petersutter ,thanks
i built them from the image
firstly i run .ci/build
and then i run
➜ ops-toolbelt git:(issue-46) ✗ docker build -f generated_dockerfiles/ops-toolbelt.dockerfile -t opsbelt_neo2 .
Sending build context to Docker daemon 1.476MB
Error response from daemon: dockerfile parse error line 27: unknown instruction: IPTABLES-SAVE
i got the exact same error
Maybe you also have to install ´iptables-save´. This would be useful, anyway. It must be run under root
maybe it makes sense to have this script lazy load/install the required components during runtime. This way we can keep the image small but can still extend it in a lightweight manner.
PR https://github.com/gardener/ops-toolbelt/pull/47 is opened
What would you like to be added:
Please add the wg (wireguard) command and a simple script command:
It can be used to simplify the analysis of iptables entries.
Thanks
Why is this needed: