Re: [CentOS] hosts.deny, fail2ban etc.

2021-08-04 Thread H
On 07/27/2021 05:17 PM, Pete Biggs wrote:
> On Tue, 2021-07-27 at 16:43 -0400, H wrote:
>>> Running CentOS 7. I was under the impression - seemingly mistaken -
>>> that by adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.*
>>> would ban all attempts from that network segment to connect to the
>>> server, ie before fail2ban would (eventually) ban connection
>>> attempts.
>> This, however, does not seem correct and I could use a pointer to
>> correct my misunderstanding. How is hosts.deny used and what have I
>> missed?
> hosts.deny is only used by specific programs that use TCP wrappers. It
> is not a general "deny this host access".
>
> Also note that fail2ban operates on individual hosts, not subnets.
>
>> Is it necessary to run:
>>
>>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
>>
>> to drop incoming connection attempts from that subnet?
>>
> If you use iptables yes, probably.  Firewalld has a specific drop zone
> that you can use:
>
>   firewall-cmd --zone=drop --add-source=aaa.bbb.ccc.0/24
>
> (with suitable --permanent flag if you want it permanent).
>
> P.
>
>
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos

Noted, I am using iptables.

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-08-04 Thread H
On 07/28/2021 10:01 AM, Leon Fauster via CentOS wrote:
> On 28.07.21 14:44, Jonathan Billings wrote:
>> On Jul 27, 2021, at 16:43, H  wrote:
>>>
>>> |Running CentOS 7. I was under the impression - seemingly mistaken - that 
>>> by adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban 
>>> all attempts from that network segment to connect to the server, ie before 
>>> fail2ban would (eventually) ban connection attempts.
>>>
>>> This, however, does not seem correct and I could use a pointer to correct 
>>> my misunderstanding. How is hosts.deny used and what have I missed?
>>>
>>> Is it necessary to run:
>>>
>>>   iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
>>>
>>> to drop incoming connection attempts from that subnet?
>>
>> Upstream openssh dropped support for tcp wrappers (hosts.deny) a while ago 
>> but RHEL had patched support back in for a while, but I believe it isn’t 
>> supported anymore.
>>
>> For what it’s worth, if you use the fail2ban-firewalld package, it uses 
>> ipset rather than iptables, which is more efficient.
>>
>>
>
> TCP wrappers (hosts.allow/deny) are deprecated now.
>
> Its still supported in EL7 (sshd example)
>
> ldd /usr/sbin/sshd |grep wrap
> libwrap.so.0 => /lib64/libwrap.so.0 (0x7fcc483ee000)
>
> but not in EL8 anymore. EL8 is based on F28/29 ->
>   https://fedoraproject.org/wiki/Changes/Deprecate_TCP_wrappers
>
> For the question above (for EL7):
> only services that are compiled against libwrap uses hosts.deny
> everything else will be reachable (if iptables does not drop it).
>
> For EL8, as depicted in the above URI:
> systemd provide a similar functionality ...
>
> -- 
> Leon
>
>
>
>
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos

Got it, will utilize iptables. I guess my previous experience was with C6.

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-08-04 Thread H
On 07/28/2021 08:44 AM, Jonathan Billings wrote:
> On Jul 27, 2021, at 16:43, H  wrote:
>> |Running CentOS 7. I was under the impression - seemingly mistaken - that 
>> by adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
>> attempts from that network segment to connect to the server, ie before 
>> fail2ban would (eventually) ban connection attempts.
>>
>> This, however, does not seem correct and I could use a pointer to correct my 
>> misunderstanding. How is hosts.deny used and what have I missed?
>>
>> Is it necessary to run:
>>
>>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
>>
>> to drop incoming connection attempts from that subnet?
> Upstream openssh dropped support for tcp wrappers (hosts.deny) a while ago 
> but RHEL had patched support back in for a while, but I believe it isn’t 
> supported anymore. 
>
> For what it’s worth, if you use the fail2ban-firewalld package, it uses ipset 
> rather than iptables, which is more efficient.  
>
> --
> Jonathan Billings
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos

Noted, thank you.

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-08-04 Thread H
On 07/28/2021 05:12 AM, Stephen John Smoogen wrote:
> On Tue, 27 Jul 2021 at 16:43, H  wrote:
>> |Running CentOS 7. I was under the impression - seemingly mistaken - that by 
>> adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
>> attempts from that network segment to connect to the server, ie before 
>> fail2ban would (eventually) ban connection attempts.
>>
>> This, however, does not seem correct and I could use a pointer to correct my 
>> misunderstanding. How is hosts.deny used and what have I missed?
>>
>> Is it necessary to run:
>>
>>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
>>
> yes. iptables is one of the first things which will see the packets
> coming to the server as it is implemented in kernel space. hosts.deny
> only comes in for specific services which are compiled to use it.
>
> [Internet] <-> [iptables] <-> [systemd if used] <-> [xinetd w/tcp-wrappers]
>
> In the above example, a packet coming from the internet gets
> interpreted and dealt with multiple tools and hosts.deny is only used
> in the last section where xinetd and similar programs compiled with
> tcp-wrappers look at hosts.deny file.
>
>
>> to drop incoming connection attempts from that subnet?
>>
>> Thank you!
>> |
>> ___
>> CentOS mailing list
>> CentOS@centos.org
>> https://lists.centos.org/mailman/listinfo/centos
>
>
Thank you, I will utilize iptables (I am running C7).

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Kenneth Porter

On 7/28/2021 1:57 PM, Scott Techlist wrote:

Is that an improvement?  I'm still running Centos7 so I'm not familiar with it.


https://ungleich.ch/en-us/cms/blog/2018/08/18/iptables-vs-nftables/


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Scott Techlist
>> For what it’s worth, if you use the fail2ban-firewalld package, it uses 
>> ipset rather than iptables, which is more efficient.
>
>That’s in CentOS 7 though. 

>CentOS 8 firewalld uses nft instead of the older netfilter (iptables/ipset) 
>code.

Is that an improvement?  I'm still running Centos7 so I'm not familiar with it.



___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Leon Fauster via CentOS

On 28.07.21 14:44, Jonathan Billings wrote:

On Jul 27, 2021, at 16:43, H  wrote:


|Running CentOS 7. I was under the impression - seemingly mistaken - that by 
adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
attempts from that network segment to connect to the server, ie before fail2ban 
would (eventually) ban connection attempts.

This, however, does not seem correct and I could use a pointer to correct my 
misunderstanding. How is hosts.deny used and what have I missed?

Is it necessary to run:

  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP

to drop incoming connection attempts from that subnet?


Upstream openssh dropped support for tcp wrappers (hosts.deny) a while ago but 
RHEL had patched support back in for a while, but I believe it isn’t supported 
anymore.

For what it’s worth, if you use the fail2ban-firewalld package, it uses ipset 
rather than iptables, which is more efficient.




TCP wrappers (hosts.allow/deny) are deprecated now.

Its still supported in EL7 (sshd example)

ldd /usr/sbin/sshd |grep wrap
libwrap.so.0 => /lib64/libwrap.so.0 (0x7fcc483ee000)

but not in EL8 anymore. EL8 is based on F28/29 ->
  https://fedoraproject.org/wiki/Changes/Deprecate_TCP_wrappers

For the question above (for EL7):
only services that are compiled against libwrap uses hosts.deny
everything else will be reachable (if iptables does not drop it).

For EL8, as depicted in the above URI:
systemd provide a similar functionality ...

--
Leon




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Jonathan Billings
On Jul 28, 2021, at 08:44, Jonathan Billings  wrote:
> 
> For what it’s worth, if you use the fail2ban-firewalld package, it uses ipset 
> rather than iptables, which is more efficient. 

That’s in CentOS 7 though. CentOS 8 firewalld uses nft instead of the older 
netfilter (iptables/ipset) code. 

--
Jonathan Billings
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Jonathan Billings
On Jul 27, 2021, at 16:43, H  wrote:
> 
> |Running CentOS 7. I was under the impression - seemingly mistaken - that by 
> adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
> attempts from that network segment to connect to the server, ie before 
> fail2ban would (eventually) ban connection attempts.
> 
> This, however, does not seem correct and I could use a pointer to correct my 
> misunderstanding. How is hosts.deny used and what have I missed?
> 
> Is it necessary to run:
> 
>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
> 
> to drop incoming connection attempts from that subnet?

Upstream openssh dropped support for tcp wrappers (hosts.deny) a while ago but 
RHEL had patched support back in for a while, but I believe it isn’t supported 
anymore. 

For what it’s worth, if you use the fail2ban-firewalld package, it uses ipset 
rather than iptables, which is more efficient.  

--
Jonathan Billings
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Stephen John Smoogen
On Tue, 27 Jul 2021 at 17:17, Pete Biggs  wrote:
>
> On Tue, 2021-07-27 at 16:43 -0400, H wrote:
> > > Running CentOS 7. I was under the impression - seemingly mistaken -
> > > that by adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.*
> > > would ban all attempts from that network segment to connect to the
> > > server, ie before fail2ban would (eventually) ban connection
> > > attempts.
> >
> > This, however, does not seem correct and I could use a pointer to
> > correct my misunderstanding. How is hosts.deny used and what have I
> > missed?
>
> hosts.deny is only used by specific programs that use TCP wrappers. It
> is not a general "deny this host access".
>
> Also note that fail2ban operates on individual hosts, not subnets.
>

[I should have waited and read all my email before responding. Peter
covered parts I did not.]


-- 
Stephen J Smoogen.
I've seen things you people wouldn't believe. Flame wars in
sci.astro.orion. I have seen SPAM filters overload because of Godwin's
Law. All those moments will be lost in time... like posts on  BBS...
time to reboot.
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-28 Thread Stephen John Smoogen
On Tue, 27 Jul 2021 at 16:43, H  wrote:
>
> |Running CentOS 7. I was under the impression - seemingly mistaken - that by 
> adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
> attempts from that network segment to connect to the server, ie before 
> fail2ban would (eventually) ban connection attempts.
>
> This, however, does not seem correct and I could use a pointer to correct my 
> misunderstanding. How is hosts.deny used and what have I missed?
>
> Is it necessary to run:
>
>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
>

yes. iptables is one of the first things which will see the packets
coming to the server as it is implemented in kernel space. hosts.deny
only comes in for specific services which are compiled to use it.

[Internet] <-> [iptables] <-> [systemd if used] <-> [xinetd w/tcp-wrappers]

In the above example, a packet coming from the internet gets
interpreted and dealt with multiple tools and hosts.deny is only used
in the last section where xinetd and similar programs compiled with
tcp-wrappers look at hosts.deny file.


> to drop incoming connection attempts from that subnet?
>
> Thank you!
> |
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos



-- 
Stephen J Smoogen.
I've seen things you people wouldn't believe. Flame wars in
sci.astro.orion. I have seen SPAM filters overload because of Godwin's
Law. All those moments will be lost in time... like posts on  BBS...
time to reboot.
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] hosts.deny, fail2ban etc.

2021-07-27 Thread Pete Biggs
On Tue, 2021-07-27 at 16:43 -0400, H wrote:
> > Running CentOS 7. I was under the impression - seemingly mistaken -
> > that by adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.*
> > would ban all attempts from that network segment to connect to the
> > server, ie before fail2ban would (eventually) ban connection
> > attempts.
> 
> This, however, does not seem correct and I could use a pointer to
> correct my misunderstanding. How is hosts.deny used and what have I
> missed?

hosts.deny is only used by specific programs that use TCP wrappers. It
is not a general "deny this host access".

Also note that fail2ban operates on individual hosts, not subnets.

> 
> Is it necessary to run:
> 
>  iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP
> 
> to drop incoming connection attempts from that subnet?
> 
If you use iptables yes, probably.  Firewalld has a specific drop zone
that you can use:

  firewall-cmd --zone=drop --add-source=aaa.bbb.ccc.0/24

(with suitable --permanent flag if you want it permanent).

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


[CentOS] hosts.deny, fail2ban etc.

2021-07-27 Thread H
|Running CentOS 7. I was under the impression - seemingly mistaken - that by 
adding a rule to /etc/hosts.deny such as ALL: aaa.bbb.ccc.* would ban all 
attempts from that network segment to connect to the server, ie before fail2ban 
would (eventually) ban connection attempts.

This, however, does not seem correct and I could use a pointer to correct my 
misunderstanding. How is hosts.deny used and what have I missed?

Is it necessary to run:

 iptables -I INPUT -s aaa.bbb.ccc.0/24 -j DROP

to drop incoming connection attempts from that subnet?

Thank you!
|
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos