Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rate-limit for outgoing connections #6117

Open
bmwiedemann opened this issue Mar 21, 2019 · 4 comments
Open

Add rate-limit for outgoing connections #6117

bmwiedemann opened this issue Mar 21, 2019 · 4 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@bmwiedemann
Copy link
Contributor

Version information:

ipfs version 0.4.19

Type:

One of

  • "feature": If you'd like to suggest a feature.
  • "enhancement ": If you'd like to suggest an improvement on to existing feature.

Description:

This is distinct from #2489 and #3320

ipfs is opening outgoing connections at such a rate that it repeatedly triggered the network scan detector of my hoster.
The cheap workaround for now uses iptables -m limit --limit 12/min -p tcp --sport 4001 --syn ...
It would be much nicer if the ipfs daemon could be configured to limit itself.

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Mar 21, 2019
@magik6k
Copy link
Member

magik6k commented Mar 22, 2019

Related - libp2p/go-libp2p#1550

@momack2 momack2 added this to Inbox in ipfs/go-ipfs May 9, 2019
@Linutux
Copy link

Linutux commented Apr 12, 2020

The cheap workaround for now uses iptables -m limit --limit 12/min -p tcp --sport 4001 --syn ...

Could you write the whole command please?

Anything happened here since 2019?

@bmwiedemann
Copy link
Contributor Author

Here is the full workaround. I didnt initially paste it in full, because it is rather lengthy:

c=ipfs
iptables -N $c 2>/dev/null
iptables -F $c
# limit outgoing connection attempts to not be counted as port-scanning by server-hoster
#iptables -A $c -d 10.0.0.0/8 -j ACCEPT
#iptables -A $c -d 192.168.0.0/16 -j ACCEPT
iptables -A $c -d $OWNIP -j ACCEPT
iptables -A $c -d 127.0.0.1 -j ACCEPT
iptables -A $c --match limit --limit 12/min --limit-burst 1 -j ACCEPT
iptables -A $c -j DROP

c=OUTPUT
iptables -F $c
iptables -A $c -p tcp --syn --match owner --uid-owner $UID --sport 4001 -j ipfs

You need to adjust or drop the --uid-owner $UID part to match the user you run your ipfs daemon.

@ShadowJonathan
Copy link

I would rather like to have this feature, as my hosting provider is flagging my host as netscanning, because ipfs is establishing connections too quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
No open projects
Development

No branches or pull requests

5 participants