All of lore.kernel.org
 help / color / mirror / Atom feed
* Cannot add ip6 elements to a named set
@ 2019-10-04 14:55 Matt
  2019-10-04 14:58 ` Florian Westphal
  2019-11-14 19:40 ` One more application available for nftables Matt
  0 siblings, 2 replies; 8+ messages in thread
From: Matt @ 2019-10-04 14:55 UTC (permalink / raw)
  To: netfilter, netfilter-owner

Dear nft team,
with ip4 i can create my set and add elements no problem, sample:

table ip filter_v4 {
    set my_drop {
      type ipv4_addr;
      flags timeout
    }
  ...
  ...
}
Then adding a element to it, works all good:
# nft add set filter_v4 my_drop \{type ipv4_addr \; flags timeout \; 
elements=\{192.168.1.1 timeout 60s\} \;\}


But I would like to do the same with ip6:

table ip6 filter_v6 {
    set my_drop {
      type ipv6_addr;
      flags timeout
    }
  ...
  ...
}

However, doing the same with ipv6 doesn't work for me:
#nft add set filter_v6 my_drop \{type ipv6_addr \; flags timeout \; 
elements=\{fda5:2c8a:af4c:a95e::64 timeout 60s\} \;\}

Returns
Error: Could not process rule: No such file or directory
add set filter_v6 my_drop {type ipv6_addr ; flags timeout ; 
elements={fda5:2c8a:af4c:a95e::64 timeout 60s} ;}
         ^^^^^^^^^


Any idea whats wrong?
Thx
Matt



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cannot add ip6 elements to a named set
  2019-10-04 14:55 Cannot add ip6 elements to a named set Matt
@ 2019-10-04 14:58 ` Florian Westphal
  2019-10-04 15:14   ` minor change recommendation for https://wiki.nftables.org Matt
  2019-11-14 19:40 ` One more application available for nftables Matt
  1 sibling, 1 reply; 8+ messages in thread
From: Florian Westphal @ 2019-10-04 14:58 UTC (permalink / raw)
  To: Matt; +Cc: netfilter, netfilter-owner

Matt <matt-nft@mailtower.de> wrote:
> However, doing the same with ipv6 doesn't work for me:
> #nft add set filter_v6 my_drop \{type ipv6_addr \; flags timeout \;
> elements=\{fda5:2c8a:af4c:a95e::64 timeout 60s\} \;\}

Try:
nft add set ip6 filter_v6 ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* minor change recommendation for https://wiki.nftables.org
  2019-10-04 14:58 ` Florian Westphal
@ 2019-10-04 15:14   ` Matt
  0 siblings, 0 replies; 8+ messages in thread
From: Matt @ 2019-10-04 15:14 UTC (permalink / raw)
  To: netfilter, netfilter-owner

Dear nft team,
may i recommend a small change on the nft wiki on the page "Sets" ?
instead of
% nft add set filter saddrs {type ipv4_addr \; size 2 \;}

add the proto (valid ip or ip6)
% nft add set ip filter saddrs {type ipv4_addr \; size 2 \;}


because that had lead me into the below question

Cheers
Matt



On 2019-10-04 16:58, Florian Westphal wrote:
> Matt <matt-nft@mailtower.de> wrote:
>> However, doing the same with ipv6 doesn't work for me:
>> #nft add set filter_v6 my_drop \{type ipv6_addr \; flags timeout \;
>> elements=\{fda5:2c8a:af4c:a95e::64 timeout 60s\} \;\}
> 
> Try:
> nft add set ip6 filter_v6 ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* One more application available for nftables
  2019-10-04 14:55 Cannot add ip6 elements to a named set Matt
  2019-10-04 14:58 ` Florian Westphal
@ 2019-11-14 19:40 ` Matt
  2019-11-18  2:43   ` Trent W. Buck
  1 sibling, 1 reply; 8+ messages in thread
From: Matt @ 2019-11-14 19:40 UTC (permalink / raw)
  To: netfilter, netfilter-owner

Dear Forum,
I'd like to announce a new application which runs on nftables, I've 
named it "fail2nft".

The application takes care about unwanted ssh (and other)  logins.

If you are interested, then please see: 
https://coolscript.org/index.php/Fail2nft

Thanks for assistance.
Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: One more application available for nftables
  2019-11-14 19:40 ` One more application available for nftables Matt
@ 2019-11-18  2:43   ` Trent W. Buck
  2019-11-19  8:36     ` Alessandro Vesely
  2019-11-20 16:41     ` zrm
  0 siblings, 2 replies; 8+ messages in thread
From: Trent W. Buck @ 2019-11-18  2:43 UTC (permalink / raw)
  To: netfilter

Matt <matt-nft@mailtower.de> writes:

> I'd like to announce a new application which runs on nftables,
> I've named it "fail2nft".
> https://coolscript.org/index.php/Fail2nft

Here's my quick review as a non-expert bystander.
(This is a critique of the code, NOT the author!)

That page needs a section "why choose fail2nft over existing products?" :-)

 * sshguard is lex/yacc (C) that reads logs journal/syslog/NCSA
   and runs a helper script to add/remove block rules.
   Adding new match rules requires a recompile.
   It blocks everything by default (on Debian, via nftables).

   https://bitbucket.org/sshguard/sshguard/src/master/src/fw/sshg-fw-nft-sets.sh

   It's about 2KLOC (slightly bigger than fail2nft).

 * fail2ban is python and uses regular expressions to look for attacks.
   It's configured via a huge mess of .ini files.
   It blocks nothing (except SSH?) by default (on Debian, via xtables).

   https://github.com/fail2ban/fail2ban/blob/0.11/config/action.d/nftables.conf

   It's about 17KLOC (much bigger than fail2nft).

perlcritic (a.k.a. "use criticism;") was very unhappy about
https://coolscript.org/download/fail2nft-installer.pl and
https://coolscript.org/download/fail2nft.tar.gz:usr/local/fail2nft/fail2nft.pl

I recommend fixing pretty much everything perlcritic complains about.
(note that by default, it only emits "high severity" complaints.)

I recommend making fail2nft's git (or whatever VCS) repo publicly
visible, and having versioned release tarballs
(fail2nft-0.9.tar.gz, not fail2nft.tar.gz).


The persistence across reboots via sqlite is interesting.


I haven't nitpicked your
usr/local/fail2nft/install/usr/sbin/nftinit-*.nft in detail.
The overall style looks reasonable.

I suggest explicitly putting "fail2nft" in your table/chain names, and
running them at "priority filter - 5" or so (i.e. before the default
"priority filter").  At that point, your fail2nft table can do nothing
but drop attacker sets, and all the normal rules can live somewhere else.
(See the sshguard link above for an example.)

I know your index.php says it's not for routers yet, but I *strongly*
recommend you hook into INPUT *and* FORWARD, where currently you only
hook into INPUT.  This will handle the easy 80% of routers in only a
couple of extra lines.

I see you're matching vsftpd.  I very very strongly recommend
you... encourage your end users to switch from FTP to SFTP.  :-)
(Many (most?) Windows FTP clients can do SFTP these days.)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: One more application available for nftables
  2019-11-18  2:43   ` Trent W. Buck
@ 2019-11-19  8:36     ` Alessandro Vesely
  2019-11-20 16:41     ` zrm
  1 sibling, 0 replies; 8+ messages in thread
From: Alessandro Vesely @ 2019-11-19  8:36 UTC (permalink / raw)
  To: netfilter

On Mon 18/Nov/2019 03:43:32 +0100 Trent W. Buck wrote:
> That page needs a section "why choose fail2nft over existing products?" :-)
> 
>  * sshguard is lex/yacc (C) that reads logs journal/syslog/NCSA
>    and runs a helper script to add/remove block rules.
>    Adding new match rules requires a recompile.
>    It blocks everything by default (on Debian, via nftables).
> 
>    https://bitbucket.org/sshguard/sshguard/src/master/src/fw/sshg-fw-nft-sets.sh
> 
>    It's about 2KLOC (slightly bigger than fail2nft).
> 
>  * fail2ban is python and uses regular expressions to look for attacks.
>    It's configured via a huge mess of .ini files.
>    It blocks nothing (except SSH?) by default (on Debian, via xtables).
> 
>    https://github.com/fail2ban/fail2ban/blob/0.11/config/action.d/nftables.conf
> 
>    It's about 17KLOC (much bigger than fail2nft).

* ipqbdb is C with PCRE to read a piped log file,
  requires custom setup of regexes and iptables -j NFQUEUE --queue-num N,
  the queue filtering daemon(s) can mark or drop based on Berkeley DB.

  https://savannah.nongnu.org/projects/ipqbdb/

  Less than 10KLOC, including utilities to manage the database.


Best
Ale

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: One more application available for nftables
  2019-11-18  2:43   ` Trent W. Buck
  2019-11-19  8:36     ` Alessandro Vesely
@ 2019-11-20 16:41     ` zrm
  2019-11-21  3:04       ` Trent W. Buck
  1 sibling, 1 reply; 8+ messages in thread
From: zrm @ 2019-11-20 16:41 UTC (permalink / raw)
  To: Trent W. Buck, netfilter


On 11/17/19 21:43, Trent W. Buck wrote:

> I see you're matching vsftpd.  I very very strongly recommend
> you... encourage your end users to switch from FTP to SFTP.  :-)
> (Many (most?) Windows FTP clients can do SFTP these days.)
> 

It's always fun to see the systems people and the network people argue 
over this.

Everybody should obviously discontinue using plaintext FTP, but FTPS 
(i.e. FTP over TLS) is a thing that exists, and is generally a much 
smaller configuration change for an existing FTP service than switching 
to SFTP (i.e. the SFTP subsystem of the SSH protocol).

Using SFTP also admits a lot of protocol features that you Do Not Want 
if all you're after is file transfers. Configure it a bit wrong and your 
users get a shell, the ability to forward ports from the public address 
of your SFTP server to their client, the ability to forward ports from 
their client to whatever internal hosts they want on the same internal 
network as your SFTP server, a VPN, X11 forwarding etc.

By contrast, the disadvantage of FTPS is that it uses separate control 
and data connections, and because it's encrypted, the firewall can't 
snoop the control connection to see which ports it will use for the data 
connection. So the only way to really make it work is to allow clients 
to make outgoing connections to arbitrary unprivileged ports. Then you 
have to convince the client's network administrator to allow that.

But the alternative is to allow outgoing connections to the SSH port. 
Which, because it's opaque and supports port forwarding and VPN and so 
on, effectively allows the same thing anyway.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: One more application available for nftables
  2019-11-20 16:41     ` zrm
@ 2019-11-21  3:04       ` Trent W. Buck
  0 siblings, 0 replies; 8+ messages in thread
From: Trent W. Buck @ 2019-11-21  3:04 UTC (permalink / raw)
  To: netfilter

zrm <zrm@trustiosity.com> writes:

> On 11/17/19 21:43, Trent W. Buck wrote:
>
>> I see you're matching vsftpd.  I very very strongly recommend
>> you... encourage your end users to switch from FTP to SFTP.  :-)
>> (Many (most?) Windows FTP clients can do SFTP these days.)
>>
>
> It's always fun to see the systems people and the network people argue
> over this.
>
> Everybody should obviously discontinue using plaintext FTP, but FTPS
> (i.e. FTP over TLS) is a thing that exists, and is generally a much
> smaller configuration change for an existing FTP service than
> switching to SFTP (i.e. the SFTP subsystem of the SSH protocol).
>
> Using SFTP also admits a lot of protocol features that you Do Not Want
> if all you're after is file transfers. Configure it a bit wrong and
> your users get a shell, the ability to forward ports from the public
> address of your SFTP server to their client, the ability to forward
> ports from their client to whatever internal hosts they want on the
> same internal network as your SFTP server, a VPN, X11 forwarding etc.
>
> By contrast, the disadvantage of FTPS is that it uses separate control
> and data connections, and because it's encrypted, the firewall can't
> snoop the control connection to see which ports it will use for the
> data connection. So the only way to really make it work is to allow
> clients to make outgoing connections to arbitrary unprivileged
> ports. Then you have to convince the client's network administrator to
> allow that.
>
> But the alternative is to allow outgoing connections to the SSH
> port. Which, because it's opaque and supports port forwarding and VPN
> and so on, effectively allows the same thing anyway.

This is an excellent analysis, thank you.

Obviously I have personal Opinionsâ„¢ about FTPS vs SFTP, but
I think we can agree that plaintext FTP is worse than EITHER. :-)

Some tangential comments:

  * (for me) ssh is already there for system administration, and
    "grant more access to existing service" can be an easier sell than
    "deploy another service".

  * tinyssh and dropbear use OpenSSH's sftp driver,
    so there's a monoculture risk there.  (Not sure about GNU ssh.)

  * OpenSSH with "internal-sftp" can chroot without needing anything
    inside the chroot (but chroot(2) isn't a security feature).

  * OpenSSH authorized_keys now has "restrict" keyword (block all
    features).  This means you no longer need to go back and update the
    blocked feature list every time you upgrade SSH.  No equivalent in
    sshd_config (yet) AFAICT.

  * SFTP is _still_ only a draft RFC, whereas
    FTPS is a full standards-track RFC.

  * As a wild alternative, you could do plain rsync --daemon, and
    auth/encrypt at l2/l3 with a wireguard/openvpn/ipsec peer link :-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-21  3:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 14:55 Cannot add ip6 elements to a named set Matt
2019-10-04 14:58 ` Florian Westphal
2019-10-04 15:14   ` minor change recommendation for https://wiki.nftables.org Matt
2019-11-14 19:40 ` One more application available for nftables Matt
2019-11-18  2:43   ` Trent W. Buck
2019-11-19  8:36     ` Alessandro Vesely
2019-11-20 16:41     ` zrm
2019-11-21  3:04       ` Trent W. Buck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.