Patchwork gnu: Add tcp-wrappers.

login
register
mail settings
Submitter John Darrington
Date Sept. 4, 2016, 1:20 p.m.
Message ID <1472995202-20512-1-git-send-email-jmd@gnu.org>
Download mbox | patch
Permalink /patch/15281/
State New
Headers show

Comments

John Darrington - Sept. 4, 2016, 1:20 p.m.
* gnu/packages/networking.scm (tcp-wrappers): New variable.
* gnu/packages/messaging.scm (ngircd) [inputs]: Add tcp-wrappers.
---
 gnu/packages/messaging.scm  |  6 ++--
 gnu/packages/networking.scm | 79 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 2 deletions(-)
Ludovic Courtès - Sept. 7, 2016, 9:15 a.m.
John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/networking.scm (tcp-wrappers): New variable.
> * gnu/packages/messaging.scm (ngircd) [inputs]: Add tcp-wrappers.

Could you commit the second part separately?

> +               (map (lambda (x)
> +                      (install-file x (string-append
> +                                    (assoc-ref %outputs "out")
> +                                   "/include"))) headers)
> +               (map (lambda (x)
> +                      (install-file x (string-append
> +                                    (assoc-ref %outputs "out")
> +                                   "/share/man/man"
> +                                   (string-take-right x 1)))) man-pages)
> +               (map (lambda (x)
> +                      (install-file x (string-append
> +                                    (assoc-ref %outputs "out")
> +                                   "/lib/"))) libs)
> +               (map (lambda (x)
> +                      (install-file x (string-append
> +                                    (assoc-ref %outputs "out")
> +                                    "/bin/"))) bins)))))))

Please use the ‘out’ variable defined above, use ‘for-each’, and fix the
indentation:

  (for-each (lambda (file)
              (install-file file (string-append out "/bin")))
            bins)

> +    (home-page "http://www.porcupine.org")
> +    (synopsis  "Monitor and filter incoming requests for network services")
> +    (description "With this package you can monitor and filter incoming requests for
> +network services.  It includes a library which may be used by daemons to
> +transparently check connection attempts against an access control list.")
> +   (license (license:non-copyleft "file://DISCLAIMER"
      ^
Alignment.  :-)

OK with these changes, thank you!

Ludo’.

Patch

diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index fa4515c..b557b2f 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -44,6 +44,7 @@ 
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages libcanberra)
+  #:use-module (gnu packages networking)
   #:use-module (gnu packages libidn)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages xml)
@@ -208,8 +209,9 @@  dictionaries.  HexChat can be extended with multiple addons.")
     (native-inputs `(("procps" ,procps)
                      ("expect" ,expect)
                      ("inetutils" ,inetutils)))
-    ;; XXX Add libident, libwrap.
+    ;; XXX Add libident.
     (inputs `(("zlib" ,zlib)
+              ("libwrap" ,tcp-wrappers)
               ("gnutls" ,gnutls)
               ,@(if (string-suffix? "-linux"
                                     (or (%current-target-system)
@@ -218,7 +220,7 @@  dictionaries.  HexChat can be extended with multiple addons.")
                     '())))
     (arguments
      `(#:configure-flags
-       '("--with-gnutls" "--with-iconv" "--enable-ipv6"
+       '("--with-gnutls" "--with-iconv" "--enable-ipv6" "--with-tcp-wrappers"
          ,@(if (string-suffix? "-linux"
                                (or (%current-target-system)
                                    (%current-system)))
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 07f0b9d..9a562ba 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -135,6 +135,85 @@  establish a relatively secure environment (su and chroot) for running client
 or server shell scripts with network connections.")
     (license license:gpl2)))
 
+
+(define-public tcp-wrappers
+  (package
+    (name "tcp-wrappers")
+    (version "7.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "ftp://ftp.porcupine.org/pub/security/tcp_wrappers_"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0p9ilj4v96q32klavx0phw9va21fjp8vpk11nbh6v2ppxnnxfhwm"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)  ; there is no configure script
+         (delete 'check)      ; there are no tests
+         (replace 'build
+           (lambda _
+             (chmod "." #o755)
+             ;; Upstream doesn't generate a shared library.  So we have to do it.
+             (setenv "CC" "gcc -fno-builtin -fPIC")
+             (substitute* "Makefile"
+               (("^(all[^\n]*)" line) (string-append line " libwrap.so\n
+libwrap.so: $(LIB_OBJ)\n
+\tgcc -shared $^ -o $@\n")))
+             ;; Deal with some gcc breakage.
+             (substitute* "percent_m.c"
+               (("extern char .sys_errlist.*;") ""))
+             (substitute* "scaffold.c"
+               (("extern char .malloc.*;") ""))
+             ;; This, believe it or not, is the recommended way to build!
+             (zero? (system* "make" "REAL_DAEMON_DIR=/etc" "linux"))))
+         ;; There is no make install stage, so we have to do it ourselves.
+         (replace 'install
+           (lambda _
+             (let ((out (assoc-ref %outputs "out"))
+                   (man-pages `("hosts_access.3"
+                               "hosts_access.5"
+                               "hosts_options.5"
+                               "tcpd.8"
+                               "tcpdchk.8"
+                               "tcpdmatch.8"))
+                   (libs  `("libwrap.a"
+                            "libwrap.so"))
+                   (headers `("tcpd.h"))
+                   (bins `("safe_finger"
+                          "tcpd"
+                          "tcpdchk"
+                          "tcpdmatch"
+                          "try-from")))
+               (map (lambda (x)
+                      (install-file x (string-append
+                                    (assoc-ref %outputs "out")
+                                   "/include"))) headers)
+               (map (lambda (x)
+                      (install-file x (string-append
+                                    (assoc-ref %outputs "out")
+                                   "/share/man/man"
+                                   (string-take-right x 1)))) man-pages)
+               (map (lambda (x)
+                      (install-file x (string-append
+                                    (assoc-ref %outputs "out")
+                                   "/lib/"))) libs)
+               (map (lambda (x)
+                      (install-file x (string-append
+                                    (assoc-ref %outputs "out")
+                                    "/bin/"))) bins)))))))
+    (home-page "http://www.porcupine.org")
+    (synopsis  "Monitor and filter incoming requests for network services")
+    (description "With this package you can monitor and filter incoming requests for
+network services.  It includes a library which may be used by daemons to
+transparently check connection attempts against an access control list.")
+   (license (license:non-copyleft "file://DISCLAIMER"
+                                  "See the file DISCLAIMER in the distribution."))))
+
+
 (define-public zeromq
   (package
     (name "zeromq")