2

I've been manually banning peers that are (a) clogging up my logs and (b) taking away space that would otherwise be used for legitimate in_peer connections (which I have limited for data usage reasons). It is a little time consuming, but it's fine. It does the job.

I didn't realize that closing monerod would discard that ban list. My logs had been clearing up, and then I had to briefly shut down monerod. Now I've got a sea of bad peers to manually ban again.

  1. Is there a way to make the ban list persist?
  2. If not within monerod, what might another (simple) strategy be to "preserve" that state?
  3. Am I stuck having to write some script to detect IPs for auto-banning according to my rules? Perhaps by parsing the daemon log and sending a ban RPC command to the daemon?

I like the idea of learning new things, so if #3 is required, then so be it. I just don't want to overcomplicate things if I don't have to.

scoobybejesus
  • 5,515
  • 21
  • 42

1 Answers1

2

1) Not that I know of.

2) & 3) One way would be to make use of the built-in monerod commands and a little scripting. E.g.

monerod bans | awk  'NR>2 {print $1}' > bans.txt

Gets a list of any currently banned IPs. After you have restarted monerod, you could then:

cat bans.txt | while read ip; do monerod ban "$ip"; done

Which will re-ban them all.

If you want to permanently ban them though, I would add them to your firewall instead. I.e. block via iptables rules.

jtgrassie
  • 19,601
  • 4
  • 17
  • 54