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

Rate limit ssh attempts to WAN zone #120

Merged
merged 9 commits into from Jan 22, 2015
Merged

Rate limit ssh attempts to WAN zone #120

merged 9 commits into from Jan 22, 2015

Conversation

areynold
Copy link
Collaborator

Incorporates firewall changes suggested by @raniarho in #116 with some modifications.
Partially addresses #30.

To test:

  1. Flash the node and configure it as a gateway
  2. Log in and make note of the public-facing IP address.
  3. Connect another machine to the same network as the node, but not to the node itself. You should not receive an IP address from the node or be inside the commotion network.
  4. SSH to the node and enter an invalid password until you are disconnected (3 attempts), then immediately repeat. On the fourth attempt within 1 minute your connection should be denied.

ranianr and others added 6 commits March 18, 2014 17:53
block any IP address who has made more than 3 ssh connections or attempted connections within the past 3 minutes.
add include path for etc/firewall.user to limit  brute force
Limiting ssh connections from wan zone.
@@ -61,6 +60,17 @@ config forwarding
config rule
option src 'wan'
option dest_port '22'
option proto 'tcp'
option state 'NEW'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no 'state' option in the OpenWRT wiki's page about the UCI firewall, as far as I can see. Is this an undocumented option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. I could have sworn I read it on one of the openwrt wiki pages or forum posts but now I can't find it. State is supported by iptables. The closest I can find in the UCI documentation is "The iptables rules generated for this section rely on the state match." I must have guessed at it.

@dismantl
Copy link
Contributor

I think the whole reason we went with the firewall.user script was because UCI didn't offer the options to reproduce those iptables rules. We looked into adding UCI rules at first, but couldn't make it work.

Andrew Reynolds added 2 commits May 20, 2014 12:13
@areynold
Copy link
Collaborator Author

@jheretic I've reverted the uci commit and fixed the syntax in /etc/firewall.user.

On the 4th ssh connection within 60 seconds, the connection attempt will hang until the minute is up. Existing ssh connections are not affected.

I have a newly built node up with these rules in place if you want to test them.

Conflicts:
	default-files/etc/config/firewall
@dismantl
Copy link
Contributor

confirmed working.

dismantl pushed a commit that referenced this pull request Jan 22, 2015
Rate limit ssh attempts to WAN zone
@dismantl dismantl merged commit 1f82611 into master Jan 22, 2015
@dismantl dismantl deleted the ssh-rate-limit branch January 22, 2015 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants