nuno revisou este gist 1 month ago. Ir para a revisão
1 file changed, 14 insertions
gistfile1.txt(arquivo criado)
| @@ -0,0 +1,14 @@ | |||
| 1 | + | local block_file | |
| 2 | + | block_file="$(ctx::block::path "${name}.block")" | |
| 3 | + | local blocks="" | |
| 4 | + | if [[ -f "$block_file" ]] && [[ -s "$block_file" ]]; then | |
| 5 | + | while IFS=" " read -r client_ip target port proto; do | |
| 6 | + | if [[ -z "$target" ]]; then | |
| 7 | + | blocks+=" all traffic blocked\n" | |
| 8 | + | else | |
| 9 | + | local rule=" ${target}" | |
| 10 | + | [[ -n "$port" ]] && rule+=":${port}/${proto}" | |
| 11 | + | blocks+="${rule}\n" | |
| 12 | + | fi | |
| 13 | + | done < "$block_file" | |
| 14 | + | fi | |
Próximo
Anterior