plugin for fail2ban (log scan / IP ban) ?

Status
Not open for further replies.

djoole

Contributor
Joined
Oct 3, 2011
Messages
158

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
FreeNAS does not even ship a firewall in the kernel. FreeNAS is a NAS not a firewall, do it in your router... Why would you expose your NAS to the world at all?
 

djoole

Contributor
Joined
Oct 3, 2011
Messages
158
I think you misunderstood me.
So I'll explain myself.

I've opened a port on my router to be able to SSH on my NAS from outside.

The messages log of FreeNAS informs me that some funny guys try to SSH in with funny logins and funny passwords.

I would like FreeNAS (a lot of commercial NAS do that out of the box) to ban these IPs.

Fail2ban is the thing that can achieve it.

FreeNAS has a firewall, it is ipfw!

And fail2ban can change rules from ipfw to drop SSH request from any unwanted IP.

I hope i've made myself clearer :)
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I'm sure William understands what you are asking, he is one of the developers.

What you are asking for requires that IPFW is compiled in the kernel, which it is not in FreeNAS. The jail does not allow installing kernel modules.
 

djoole

Contributor
Joined
Oct 3, 2011
Messages
158
Thanks for caring to explain, protosd :)

As i saw the command ipfw was available on my freenas (although i don't have a clue how to use it!), the conclusion for me was easy : ipfw is in FreeNAS, so we can use it.

So if IPFW is only installed on FreeNAS but not compiled in the KERNEL, the jail don't have access to it, do i understand well?

Maybe fail2ban don't have to access to ipfw, but only to some config files to add some rules? I'll look into that once i'm finished with Logitech Media Server.

In the meantime, if someone found a way to ban bad IPs on FreeNAS, feel free to give me some hints!
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
So if IPFW is only installed on FreeNAS but not compiled in the KERNEL, the jail don't have access to it, do i understand well?

IPFW requires a kernel module to be complete. I don't understand why the IPFW command is installed if the module is not unless it was a dependency for another package. I don't have the time to look at the source to see.

I also have seen some people trying to hack my system using ssh. I have a hardware firewall, but they still try to login repeatedly.
 

djoole

Contributor
Joined
Oct 3, 2011
Messages
158
OK... well it's a pity anyway this feature (IP banning) is not implemented in FreeNAS
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Actually, I think I know how it is being used in FreeNAS. When you create a share for example, you can specify which hosts to ALLOW or DENY.... perhaps William is mistaken? ;) It is possible it is included, but I don't have time to look at the source to see if it has been compiled into the kernel.
 

djoole

Contributor
Joined
Oct 3, 2011
Messages
158
I don't know how to look at the source :(

Well i'll try to see if ipfw works later. If i find something i'll let you know, you do the same ;)
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
I also have seen some people trying to hack my system using ssh. I have a hardware firewall, but they still try to login repeatedly.
Have you tried changing the port ssh is listening on? You can never rely on changing it to a non-default port for security, but once it is secured having it listen on a different port is a nice bonus. It will avoid all the script-kiddies running their tools checking random port 22s.

I don't know how to look at the source :(
You can always web browse the SVN repo.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Have you tried changing the port ssh is listening on? You can never rely on changing it to a non-default port for security, but once it is secured having it listen on a different port is a nice bonus. It will avoid all the script-kiddies running their tools checking random port 22s..

Absolutely, I don't want to publish here, but I was surprised since its a high number. Someone from Spain really had an interest for awhile ;)
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
That is a bit surprising. You would be surprised, well maybe not you, how many knowledgeable people run ssh on port 22 because that's the port it's "supposed" to run on or it's just what they have always done. To my mind it makes sense to move it if for no better reason than to reduce the noise you get.

Absolutely, I don't want to publish here, but I was surprised since its a high number. Someone from Spain really had an interest for awhile ;)
NOBODY expects the Spanish Inquisition!
 
Status
Not open for further replies.
Top