guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#48975] New firewall service


From: Solene Rapenne
Subject: [bug#48975] New firewall service
Date: Sun, 13 Jun 2021 00:13:58 +0200

On Sat, 12 Jun 2021 21:59:53 +0200
Jonathan Brielmaier <jonathan.brielmaier@web.de>:

> On 12.06.21 19:19, Solene Rapenne via Guix-patches via wrote:
> > Hello,
> >
> > I wrote a new firewall service, I already wrote an email to guix-devel
> > about it and I've been suggested to submit it here.
> >
> > The idea is to propose an easy way to manage your firewall. On a
> > personal computer or a server with no fancy network, you certainly want
> > to block access from the outside to all the ports except a few ones.  
> 
> Hi Solene,
> 
> that is a really good idea. So I could get rid of my growing lines of
> plain iptables in my Guix config :)
> 
> > The configuration looks like this, currently it only supports TCP and
> > UDP ports. Maybe NAT could be added later or other feature, I'm opened
> > to suggestions.
> >
> > (service firewall-service-type
> >    (firewall-configuration
> >      (udp '(53))
> >      (tcp '(22 70 1965))))  
> 
> I think we could improve the syntax as to be honest I'm unsure if the
> listed ports are the open or the closed ones.
> 
> Maybe we could call this service simple-firewall-service-type or
> something along this.

hello, thanks a lot for your feedback.

I have no argument for a rename, as long as it's understandable.
As it's simple, I like simple-firewall.

Do you think this would be easier to understand by adding "open"
to the names?

(service simple-firewall-service-type
  (simple-firewall-configuration
    (open-udp '(53))
    (open-tcp '(22 ...))))

I think we must decided if ICMP is allowed by default or not and
the syntax to enable/disable it. Maybe this? I would disable it by
default.

    (allow-icmp? #t)

If you stop simple-firewall with the current code, it will block
every inbound ports, I'm not sure if it's the correct way to proceed, I suppose
it should flush absolutely everything.

To match most simple use case, a simple NAT and port redirection
could be done too.

    ;; do NAT on eth0 and set the according sysctl
    (nat-on "eth0")

    ;; redirect incoming connections on ports 22 and 8080 to another box
    (redirect '((22 "192.168.1.50:22")
                (8080 "192.168.1.50:80"))
 
> >
> > Here is the code, I took bits from iptables as a base and then used the
> > Tor service way to generate the configuration file.
> >
> > diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
> > index 87b3d754a3..d311f95448 100644
> > --- a/gnu/services/networking.scm
> > +++ b/gnu/services/networking.scm  
> 
> You should add a copyright line for yourself at the top of the file.
> 

I've been told it's not mandatory.  I have no issue adding it though.

I found a ^L character at many paces in networking.scm, I don't
know if its appearance is legit or not. I think it's a garbage
character that got copy/pasted over and over. I copied it just in
case.

> >
> > +
> > +;;;
> > +;;; Firewall
> > +;;;
> > +





reply via email to

[Prev in Thread] Current Thread [Next in Thread]