gnu: Add libpcap and jnettop.
[jackhill/guix/guix.git] / gnu / packages / admin.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages admin)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system cmake)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system trivial)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages ncurses)
30 #:use-module (gnu packages readline)
31 #:use-module (gnu packages linux)
32 #:use-module (gnu packages guile)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages perl)
35 #:use-module ((gnu packages base)
36 #:select (tar))
37 #:use-module ((gnu packages compression)
38 #:select (gzip))
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages pkg-config))
43
44 (define-public dmd
45 (package
46 (name "dmd")
47 (version "0.1")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "ftp://alpha.gnu.org/gnu/dmd/dmd-"
51 version ".tar.gz"))
52 (sha256
53 (base32
54 "07mddw0p62fcphwjzgb6rfa0pjz5sy6jzbha0sm2vc3rqf459jxg"))
55 (patches (list (search-patch "dmd-getpw.patch")
56 (search-patch "dmd-tests-longer-sleeps.patch")))))
57 (build-system gnu-build-system)
58 (arguments
59 '(#:configure-flags '("--localstatedir=/var")))
60 (native-inputs `(("pkg-config" ,pkg-config)))
61 (inputs `(("guile" ,guile-2.0)))
62 (synopsis "Daemon managing daemons")
63 (description
64 "GNU DMD is a daemon-managing daemon, meaning that it manages the
65 execution of system services, replacing similar functionality found in
66 typical init systems. It provides dependency-handling through a convenient
67 interface and is based on GNU Guile.")
68 (license gpl3+)
69 (home-page "http://www.gnu.org/software/dmd/")))
70
71 (define-public dfc
72 (package
73 (name "dfc")
74 (version "3.0.3")
75 (source
76 (origin
77 (method url-fetch)
78 (uri (string-append
79 "http://projects.gw-computing.net/attachments/download/78/dfc-"
80 version ".tar.gz"))
81 (sha256
82 (base32
83 "1b4hfqv23l87cb37fxwzfk2sgspkyxpr3ig2hsd23hr6mm982j7z"))))
84 (build-system cmake-build-system)
85 (arguments '(#:tests? #f)) ; There are no tests.
86 (native-inputs `(("gettext" ,gnu-gettext)))
87 (home-page "http://projects.gw-computing.net/projects/dfc")
88 (synopsis "Display file system space usage using graphs and colors")
89 (description
90 "dfc (df color) is a modern version of df. It uses colors, draws pretty
91 graphs and can export its output to different formats.")
92 (license bsd-3)))
93
94 (define-public htop
95 (package
96 (name "htop")
97 (version "1.0.2")
98 (source (origin
99 (method url-fetch)
100 (uri (string-append "mirror://sourceforge/htop/"
101 version "/htop-" version ".tar.gz"))
102 (sha256
103 (base32
104 "18fqrhvnm7h4c3939av8lpiwrwxbyw6hcly0jvq0vkjf0ixnaq7f"))))
105 (build-system gnu-build-system)
106 (inputs
107 `(("ncurses" ,ncurses)))
108 (home-page "http://htop.sourceforge.net/")
109 (synopsis "Interactive process viewer")
110 (description
111 "This is htop, an interactive process viewer. It is a text-mode
112 application (for console or X terminals) and requires ncurses.")
113 (license gpl2)))
114
115 (define-public pies
116 (package
117 (name "pies")
118 (version "1.2")
119 (source
120 (origin
121 (method url-fetch)
122 (uri (string-append "mirror://gnu/pies/pies-"
123 version ".tar.bz2"))
124 (sha256
125 (base32
126 "18w0dbg77i56cx1bwa789w0qi3l4xkkbascxcv2b6gbm0zmjg1g6"))))
127 (build-system gnu-build-system)
128 (home-page "http://www.gnu.org/software/pies/")
129 (synopsis "Program invocation and execution supervisor")
130 (description
131 "GNU pies is a program that supervises the invocation and execution of
132 other programs. It reads the list of programs to be started from its
133 configuration file, executes them, and then monitors their status,
134 re-executing them as necessary.")
135 (license gpl3+)))
136
137 (define-public inetutils
138 (package
139 (name "inetutils")
140 (version "1.9.2")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append "mirror://gnu/inetutils/inetutils-"
144 version ".tar.gz"))
145 (sha256
146 (base32
147 "04wrm0v7l4890mmbaawd6wjwdv08bkglgqhpz0q4dkb0l50fl8q4"))))
148 (build-system gnu-build-system)
149 (arguments `(;; FIXME: `tftp.sh' relies on `netstat' from utils-linux,
150 ;; which is currently missing.
151 #:tests? #f))
152 (inputs `(("ncurses" ,ncurses)
153 ("readline" ,readline))) ; for 'ftp'
154 (home-page "http://www.gnu.org/software/inetutils/")
155 (synopsis "Basic networking utilities")
156 (description
157 "Inetutils is a collection of common network programs, such as an ftp
158 client and server, a telnet client and server, and an rsh client and server.")
159 (license gpl3+)))
160
161 (define-public shadow
162 (package
163 (name "shadow")
164 (version "4.1.5.1")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append
168 "http://pkg-shadow.alioth.debian.org/releases/shadow-"
169 version ".tar.bz2"))
170 (sha256
171 (base32
172 "1yvqx57vzih0jdy3grir8vfbkxp0cl0myql37bnmi2yn90vk6cma"))))
173 (build-system gnu-build-system)
174 (arguments
175 '(;; Assume System V `setpgrp (void)', which is the default on GNU
176 ;; variants (`AC_FUNC_SETPGRP' is not cross-compilation capable.)
177 #:configure-flags '("--with-libpam" "ac_cv_func_setpgrp_void=yes")
178
179 #:phases (alist-cons-before
180 'build 'set-nscd-file-name
181 (lambda* (#:key inputs #:allow-other-keys)
182 ;; Use the right file name for nscd.
183 (let ((libc (assoc-ref inputs "libc")))
184 (substitute* "lib/nscd.c"
185 (("/usr/sbin/nscd")
186 (string-append libc "/sbin/nscd")))))
187 (alist-cons-after
188 'install 'remove-groups
189 (lambda* (#:key outputs #:allow-other-keys)
190 ;; Remove `groups', which is already provided by Coreutils.
191 (let* ((out (assoc-ref outputs "out"))
192 (bin (string-append out "/bin"))
193 (man (string-append out "/share/man/man1")))
194 (delete-file (string-append bin "/groups"))
195 (for-each delete-file (find-files man "^groups\\."))
196 #t))
197 %standard-phases))))
198
199 (inputs (if (string-suffix? "-linux"
200 (or (%current-target-system)
201 (%current-system)))
202 `(("linux-pam" ,linux-pam))
203 '()))
204 (home-page "http://pkg-shadow.alioth.debian.org/")
205 (synopsis "Authentication-related tools such as passwd, su, and login")
206 (description
207 "Shadow provides a number of authentication-related tools, including:
208 login, passwd, su, groupadd, and useradd.")
209
210 ;; The `vipw' program is GPLv2+.
211 ;; libmisc/salt.c is public domain.
212 (license bsd-3)))
213
214 (define-public mingetty
215 (package
216 (name "mingetty")
217 (version "1.08")
218 (source (origin
219 (method url-fetch)
220 (uri (string-append "mirror://sourceforge/mingetty/mingetty-"
221 version ".tar.gz"))
222 (sha256
223 (base32
224 "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g"))))
225 (build-system gnu-build-system)
226 (arguments
227 `(#:phases (alist-replace 'configure
228 (lambda* (#:key inputs outputs
229 #:allow-other-keys)
230 (let* ((out (assoc-ref outputs "out"))
231 (man8 (string-append
232 out "/share/man/man8"))
233 (sbin (string-append out "/sbin"))
234 (shadow (assoc-ref inputs "shadow"))
235 (login (string-append shadow
236 "/bin/login")))
237 (substitute* "Makefile"
238 (("^SBINDIR.*")
239 (string-append "SBINDIR = " out
240 "/sbin\n"))
241 (("^MANDIR.*")
242 (string-append "MANDIR = " out
243 "/share/man/man8\n")))
244
245 ;; Pick the right 'login' by default.
246 (substitute* "mingetty.c"
247 (("\"/bin/login\"")
248 (string-append "\"" login "\"")))
249
250 (mkdir-p sbin)
251 (mkdir-p man8)))
252 %standard-phases)
253 #:tests? #f)) ; no tests
254 (inputs `(("shadow" ,shadow)))
255
256 (home-page "http://sourceforge.net/projects/mingetty")
257 (synopsis "Getty for the text console")
258 (description
259 "Small console getty that is started on the Linux text console,
260 asks for a login name and then transfers over to 'login'. It is extended to
261 allow automatic login and starting any app.")
262 (license gpl2+)))
263
264 (define-public net-base
265 (package
266 (name "net-base")
267 (version "5.1")
268 (source (origin
269 (method url-fetch)
270 (uri (string-append
271 "http://ftp.de.debian.org/debian/pool/main/n/netbase/netbase_"
272 version ".tar.gz"))
273 (sha256
274 (base32
275 "17l8xk2x632id5f9x9v5fs9wqc650hldd2lf3dh90r1zisj1ya8d"))))
276 (build-system trivial-build-system)
277 (arguments
278 `(#:modules ((guix build utils))
279 #:builder (begin
280 (use-modules (guix build utils)
281 (srfi srfi-26))
282
283 (let* ((source (assoc-ref %build-inputs "source"))
284 (tar (assoc-ref %build-inputs "tar"))
285 (gzip (assoc-ref %build-inputs "gzip"))
286 (output (assoc-ref %outputs "out"))
287 (etc (string-append output "/etc")))
288 (setenv "PATH" (string-append gzip "/bin"))
289 (system* (string-append tar "/bin/tar") "xvf"
290 source)
291 (chdir ,(string-append "netbase-" version))
292 (mkdir-p etc)
293 (for-each copy-file
294 '("etc-services" "etc-protocols" "etc-rpc")
295 (map (cut string-append etc "/" <>)
296 '("services" "protocols" "rpc")))
297 #t))))
298 (native-inputs `(("tar" ,tar)
299 ("gzip" ,gzip)))
300 (synopsis "IANA protocol, port, and RPC number assignments")
301 (description
302 "This package provides the /etc/services, /etc/protocols, and /etc/rpc
303 files, which contain information about the IANA-assigned port, protocol, and
304 ONC RPC numbers")
305 (home-page "http://packages.debian.org/sid/netbase")
306 (license gpl2)))
307
308 (define-public netcat
309 (package
310 (name "netcat")
311 (version "0.7.1")
312 (source (origin
313 (method url-fetch)
314 (uri (string-append "mirror://sourceforge/netcat/netcat-"
315 version ".tar.bz2"))
316 (sha256
317 (base32
318 "1frjcdkhkpzk0f84hx6hmw5l0ynpmji8vcbaxg8h5k2svyxz0nmm"))))
319 (build-system gnu-build-system)
320 (home-page "http://netcat.sourceforge.net")
321 (synopsis "Read and write data over TCP/IP")
322 (description
323 "Netcat is a featured networking utility which reads and writes data
324 across network connections, using the TCP/IP protocol. It is designed to be a
325 reliable \"back-end\" tool that can be used directly or easily driven by other
326 programs and scripts. At the same time, it is a feature-rich network debugging
327 and exploration tool, since it can create almost any kind of connection you
328 would need and has several interesting built-in capabilities.")
329 (license gpl2+)))
330
331 (define-public alive
332 (package
333 (name "alive")
334 (version "2.0.2")
335 (source (origin
336 (method url-fetch)
337 (uri (string-append "mirror://gnu/alive/alive-"
338 version ".tar.xz"))
339 (sha256
340 (base32
341 "1vrzg51ai68x9yld7vbgl58sxaw5qpx8rbakwcxn4cqq6vpxj38j"))))
342 (build-system gnu-build-system)
343 (arguments '(#:configure-flags '("alive_cv_nice_ping=yes")))
344 (inputs `(("guile" ,guile-2.0)
345 ("inetutils" ,inetutils)))
346 (home-page "http://www.gnu.org/software/alive/")
347 (synopsis "Autologin and keep-alive daemon")
348 (description
349 "GNU Alive sends periodic pings to a server, generally to keep a
350 connection alive.")
351 (license gpl3+)))
352
353 (define-public isc-dhcp
354 (package
355 (name "isc-dhcp")
356 (version "4.3.0")
357 (source (origin
358 (method url-fetch)
359 (uri (string-append "http://ftp.isc.org/isc/dhcp/"
360 version "/dhcp-" version ".tar.gz"))
361 (sha256
362 (base32
363 "12mydvj6x3zcl3gla06bywfkkrgg03g66fijs94mwb7kbiym3dm7"))))
364 (build-system gnu-build-system)
365 (arguments
366 '(#:phases (alist-cons-after
367 'configure 'post-configure
368 (lambda* (#:key outputs #:allow-other-keys)
369 ;; Point to the right client script, which will be
370 ;; installed in a later phase.
371 (substitute* "includes/dhcpd.h"
372 (("#define[[:blank:]]+_PATH_DHCLIENT_SCRIPT.*")
373 (let ((out (assoc-ref outputs "out")))
374 (string-append "#define _PATH_DHCLIENT_SCRIPT \""
375 out "/libexec/dhclient-script"
376 "\"\n"))))
377
378 ;; During the 'build' phase, 'bind.tar.gz' is extracted, so
379 ;; we must patch shebangs in there and make sure the right
380 ;; shell is used.
381 (with-directory-excursion "bind"
382 (substitute* "Makefile"
383 (("\\./configure")
384 (let ((sh (which "sh")))
385 (string-append "./configure CONFIG_SHELL="
386 sh " SHELL=" sh))))
387
388 (system* "tar" "xf" "bind.tar.gz")
389 (for-each patch-shebang
390 (find-files "bind-9.9.5" ".*"))
391 (zero? (system* "tar" "cf" "bind.tar.gz"
392 "bind-9.9.5"))))
393 (alist-cons-after
394 'install 'post-install
395 (lambda* (#:key inputs outputs #:allow-other-keys)
396 ;; Install the dhclient script for GNU/Linux and make sure
397 ;; if finds all the programs it needs.
398 (let* ((out (assoc-ref outputs "out"))
399 (libexec (string-append out "/libexec"))
400 (coreutils (assoc-ref inputs "coreutils"))
401 (net-tools (assoc-ref inputs "net-tools"))
402 (sed (assoc-ref inputs "sed")))
403 (substitute* "client/scripts/linux"
404 (("/sbin/ip")
405 (string-append (assoc-ref inputs "iproute")
406 "/sbin/ip")))
407
408 (mkdir-p libexec)
409 (copy-file "client/scripts/linux"
410 (string-append libexec "/dhclient-script"))
411
412 (wrap-program (string-append libexec "/dhclient-script")
413 `("PATH" ":" prefix
414 ,(map (lambda (dir)
415 (string-append dir "/bin:"
416 dir "/sbin"))
417 (list net-tools coreutils sed))))))
418 %standard-phases))))
419
420 (native-inputs `(("perl" ,perl)))
421
422 ;; Even Coreutils and sed are needed here in case we're cross-compiling.
423 (inputs `(("coreutils" ,coreutils)
424 ("sed" ,sed)
425 ("net-tools" ,net-tools)
426 ("iproute" ,iproute)))
427
428 (home-page "http://www.isc.org/products/DHCP/")
429 (synopsis "Dynamic Host Configuration Protocol (DHCP) tools")
430 (description
431 "ISC's Dynamic Host Configuration Protocol (DHCP) distribution provides a
432 reference implementation of all aspects of DHCP, through a suite of DHCP
433 tools: server, client, and relay agent.")
434 (license isc)))
435
436 (define-public libpcap
437 (package
438 (name "libpcap")
439 (version "1.5.3")
440 (source (origin
441 (method url-fetch)
442 (uri (string-append "http://www.tcpdump.org/release/libpcap-"
443 version ".tar.gz"))
444 (sha256
445 (base32
446 "14wyjywrdi1ikaj6yc9c72m6m2r64z94lb0gm7k1a3q6q5cj3scs"))))
447 (build-system gnu-build-system)
448 (native-inputs `(("bison" ,bison) ("flex" ,flex)))
449 (arguments '(#:tests? #f)) ; no 'check' target
450 (home-page "http://www.tcpdump.org")
451 (synopsis "Network packet capture library")
452 (description
453 "libpcap is an interface for user-level packet capture. It provides a
454 portable framework for low-level network monitoring. Applications include
455 network statistics collection, security monitoring, network debugging, etc.")
456
457 ;; fad-*.c and a couple other files are BSD-4, but the rest is BSD-3.
458 (license bsd-3)))
459
460 (define-public jnettop
461 (package
462 (name "jnettop")
463 (version "0.13.0")
464 (source (origin
465 (method url-fetch)
466 (uri (string-append "http://jnettop.kubs.info/dist/jnettop-"
467 version ".tar.gz"))
468 (sha256
469 (base32
470 "1855np7c4b0bqzhf1l1dyzxb90fpnvrirdisajhci5am6als31z9"))))
471 (build-system gnu-build-system)
472 (native-inputs
473 `(("pkg-config" ,pkg-config)))
474 (inputs
475 `(("glib" ,glib)
476 ("ncurses" ,ncurses)
477 ("libpcap" ,libpcap)))
478 (home-page "http://jnettop.kubs.info/")
479 (synopsis "Visualize network traffic by bandwidth use")
480 (description
481 "Jnettop is a traffic visualiser, which captures traffic going
482 through the host it is running from and displays streams sorted
483 by bandwidth they use.")
484 (license gpl2+)))