unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Solene Rapenne via Guix-patches via <guix-patches@gnu.org>
To: Jonathan Brielmaier <jonathan.brielmaier@web.de>
Cc: 48975@debbugs.gnu.org
Subject: [bug#48975] New firewall service
Date: Sun, 13 Jun 2021 00:13:58 +0200	[thread overview]
Message-ID: <20210613001358.3cc67453@daru.lan> (raw)
In-Reply-To: <73ab1edf-5917-a01f-66b9-816c43899020@web.de>

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.

> >
> > +\f
> > +;;;
> > +;;; Firewall
> > +;;;
> > +




  reply	other threads:[~2021-06-12 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 17:19 [bug#48975] New firewall service Solene Rapenne via Guix-patches via
2021-06-12 19:59 ` Jonathan Brielmaier
2021-06-12 22:13   ` Solene Rapenne via Guix-patches via [this message]
2021-06-13  9:29 ` Arun Isaac
2022-11-04  7:25 ` [bug#48975] [PATCH] gnu: simple-firewall-service: Add a simple service wrapping iptables antlers
2022-11-06 20:39   ` antlers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210613001358.3cc67453@daru.lan \
    --to=guix-patches@gnu.org \
    --cc=48975@debbugs.gnu.org \
    --cc=jonathan.brielmaier@web.de \
    --cc=solene@perso.pw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).