From owner-freebsd-questions@FreeBSD.ORG Tue Sep 19 21:40:45 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4661E16A40F for ; Tue, 19 Sep 2006 21:40:45 +0000 (UTC) (envelope-from norgaard@locolomo.org) Received: from strange.daemonsecurity.com (59.Red-81-33-11.staticIP.rima-tde.net [81.33.11.59]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E1F843D77 for ; Tue, 19 Sep 2006 21:40:40 +0000 (GMT) (envelope-from norgaard@locolomo.org) Received: from [10.35.4.65] (65.4-35-10-static.chueca.wifi [10.35.4.65]) by strange.daemonsecurity.com (Postfix) with ESMTP id B937D2E024; Tue, 19 Sep 2006 23:40:38 +0200 (CEST) Message-ID: <45106397.9080206@locolomo.org> Date: Tue, 19 Sep 2006 23:39:35 +0200 From: Erik Norgaard User-Agent: Thunderbird 1.5.0.7 (X11/20060916) MIME-Version: 1.0 To: "Dan Mahoney, System Admin" References: <20060919165400.A4380@prime.gushi.org> In-Reply-To: <20060919165400.A4380@prime.gushi.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: sshd brute force attempts? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2006 21:40:45 -0000 Dan Mahoney, System Admin wrote: > Hey all, > > I've looked around and found several linux-centric things designed to > block brute-force SSH attempts. Anyone out there know of something a bit > more BSD savvy? > > My best attempt will be to get this: > > http://www.csc.liv.ac.uk/~greg/sshdfilter/index_15.html > > running and adapt it. > > I've found a few things based on openBSD's pf, but that doesn't seem to be > the default in BSD either. Well, this is not really an answer, yet as you bring it up, SecurityFocus had an article last week on this: http://www.securityfocus.com/infocus/1876 Along with some good advice. First of all: ssh is not a public service like http or smtp where you need anyone to be able to connect. So don't let them in the first place. Disable direct root login, in the article more than a third attempted to login as root. Disable shell access for service accounts such as mysql, www or ldap. Use a scheme for choosing usernames that avoids common names like "james" and avoid publishing usernames on web-sites, e-mail may differ from the username. Disable password based authentication and require ssh-keys if possible, best if you can ensure both pasword and key based authentication. You may still find sshd login denied entries in your log - so what? it was denied! This is really only a problem if the traffics saturates your connection, or your log files grow so much that you run out of diskspace. The article also comments on moving ssh to a different port, but this causes confusion and annoyance if you have many users and is non-standard. Doing the other things works great, an ssh-key on a usb-keyring is great. Personally, I created a script for parsing the delegated files from the different regional registries such as only to allow connection from EU countries. Since then, I get at most one attempt a week, few enough to manually look up the ip with whois and decide if the host or network should be blocked. Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org X.509 Certificate: http://www.locolomo.org/crt/8D03551FFCE04F0C.crt Key ID: 69:79:B8:2C:E3:8F:E7:BE:5D:C3:C3:B1:74:62:B8:3F:9F:1F:69:B9