Two pf questions

Ralf Mardorf ralf.mardorf at rocketmail.com
Tue Mar 28 09:45:50 UTC 2017


On Tue, 28 Mar 2017 11:35:01 +0200, Ralf Mardorf wrote:
>On Tue, 28 Mar 2017 11:19:59 +0200, Ralf Mardorf via freebsd-questions
>wrote:
>>cp /etc/pf/bruteforce /tmp/foobar.txt
>>pfctl -t bruteforce -T show >> /tmp/foobar.txt
>>sort -u /tmp/foobar.txt > /etc/pf/bruteforce  
>>
>>^
>>^
>>  
>>>If so, the above example with "sort -u" still might be good.
>>>Perhaps    
>>            ^^^^^^^^^^^^^
>>            ^^^^^^^^^^^^^ the above with the cp to a backup file
>>  
>>>in addition within a loop until the exit status $? of the last
>>>command is 0, to ensure that /etc/pf/bruteforcen doesn't get lost, if
>>>something should went wrong.    
>
>More clear, something similar to this:
>
>cp /etc/pf/bruteforce /tmp/foobar.txt && \
>pfctl -t bruteforce -T show >> /tmp/foobar.txt && \
>some_loop
> sort -u /tmp/foobar.txt > /etc/pf/bruteforce
> check_exit_status
>some_loop

My apologies, it's not my day today ;).

I don't know if the exit status available after

  sort -u /tmp/foobar.txt > /etc/pf/bruteforce

is from "sort" and/or ">", at least

  sort -u /tmp/foobar.txt | tee /etc/pf/bruteforce

ensures that it's the status returned from "tee", but I suspect ">"
works, too.



More information about the freebsd-questions mailing list