mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
services: dicod: Add 'interfaces' configuration field.
This makes 'dicod' listen on 'localhost' by default, whereas it was previously listening on all the interfaces, which is not a good default security-wise. * gnu/services/dict.scm (<dicod-configuration>)[interfaces]: New field. (dicod-configuration-file)[database->text]: New procedure, with code formerly in 'dicod-configuration->text'. [dicod-configuration->text]: Rename to... [configuration->text]: ... this. Honor 'interfaces'. * doc/guix.texi (Various Services): Document 'interfaces'.
This commit is contained in:
parent
025597393c
commit
a1b484654a
2 changed files with 21 additions and 8 deletions
|
@ -9465,6 +9465,11 @@ Data type representing the configuration of dicod.
|
||||||
@item @code{dico} (default: @var{dico})
|
@item @code{dico} (default: @var{dico})
|
||||||
Package object of the GNU Dico dictionary server.
|
Package object of the GNU Dico dictionary server.
|
||||||
|
|
||||||
|
@item @code{interfaces} (default: @var{'("localhost")})
|
||||||
|
This is the list of IP addresses and ports and possibly socket file
|
||||||
|
names to listen to (@pxref{Server Settings, @code{listen} directive,,
|
||||||
|
dico, GNU Dico Manual}).
|
||||||
|
|
||||||
@item @code{databases} (default: @var{(list %dicod-database:gcide)})
|
@item @code{databases} (default: @var{(list %dicod-database:gcide)})
|
||||||
List of @code{<dicod-database>} objects denoting dictionaries to be served.
|
List of @code{<dicod-database>} objects denoting dictionaries to be served.
|
||||||
@end table
|
@end table
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
|
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
|
||||||
|
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -42,6 +43,8 @@ (define-record-type* <dicod-configuration>
|
||||||
dicod-configuration make-dicod-configuration
|
dicod-configuration make-dicod-configuration
|
||||||
dicod-configuration?
|
dicod-configuration?
|
||||||
(dico dicod-configuration-dico (default dico))
|
(dico dicod-configuration-dico (default dico))
|
||||||
|
(interfaces dicod-configuration-interfaces ;list of strings
|
||||||
|
(default '("localhost")))
|
||||||
(databases dicod-configuration-databases
|
(databases dicod-configuration-databases
|
||||||
;; list of <dicod-database>
|
;; list of <dicod-database>
|
||||||
(default (list %dicod-database:gcide))))
|
(default (list %dicod-database:gcide))))
|
||||||
|
@ -72,20 +75,25 @@ (define %dicod-accounts
|
||||||
(shell #~(string-append #$shadow "/sbin/nologin")))))
|
(shell #~(string-append #$shadow "/sbin/nologin")))))
|
||||||
|
|
||||||
(define (dicod-configuration-file config)
|
(define (dicod-configuration-file config)
|
||||||
(define dicod-configuration->text
|
(define database->text
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <dicod-configuration> dico databases)
|
(($ <dicod-database> name module options)
|
||||||
(append-map (match-lambda
|
`("
|
||||||
(($ <dicod-database> name module options)
|
|
||||||
`("
|
|
||||||
load-module " ,module ";
|
load-module " ,module ";
|
||||||
database {
|
database {
|
||||||
name \"" ,name "\";
|
name \"" ,name "\";
|
||||||
handler \"" ,module
|
handler \"" ,module
|
||||||
(string-join (list ,@options) " " 'prefix) "\";
|
(string-join (list ,@options) " " 'prefix) "\";
|
||||||
}\n")))
|
}\n"))))
|
||||||
databases))))
|
|
||||||
(apply mixed-text-file "dicod.conf" (dicod-configuration->text config)))
|
(define configuration->text
|
||||||
|
(match-lambda
|
||||||
|
(($ <dicod-configuration> dico (interfaces ...) databases)
|
||||||
|
(append `("listen ("
|
||||||
|
,(string-join interfaces ", ") ");\n")
|
||||||
|
(append-map database->text databases)))))
|
||||||
|
|
||||||
|
(apply mixed-text-file "dicod.conf" (configuration->text config)))
|
||||||
|
|
||||||
(define %dicod-activation
|
(define %dicod-activation
|
||||||
#~(begin
|
#~(begin
|
||||||
|
|
Loading…
Reference in a new issue