DICOD.CONF(5)
π DICOD.CONF(5) π
okay bestie, welcome to dicod.conf(5) from the GNU Dico Reference β this is the whole entire glow-up guide to the config file for the GNU dictionary server. grab a boba, we're going in π
β¨ NAME β¨
dicod.conf β the configuration file for the GNU dictionary server. that's it, that's the name, slay π
πΈ DESCRIPTION πΈ
So. The file /etc/dicod.conf holds all the configuration settings and the database definitions for the GNU dictionary server, dicod(8).
Here's the tea: the server reads this file once, right at startup, and then it just holds onto those settings until it's shut down β OR until someone delivers a HUP signal. And if that HUP shows up? Every previous configuration setting gets discarded, and the file is re-read from scratch. iconic behaviour honestly π¦
π NOTE π
Real talk: this manpage is just the short description of the dicod.conf config file. For the detailed discussion β examples, usage recommendations, the whole lore β you want the GNU Dico Manual, which is available in texinfo format.
If the info reader and the GNU Dico documentation are properly installed on your system, this command
info dico
should give you access to the complete manual. π«Ά
You can also view the manual using info mode in emacs(1), or find it in various formats online at
http://www.gnu.org.ua/software/dico/manual
If any discrepancies occur between this manpage and the GNU Dico Manual, the later shall be considered the authoritative source. no cap, the Manual wins every time.
π¦ LEXICAL STRUCTURE π¦
Three classes of lexical tokens, and that's the whole squad: words, quoted strings, and separators. Blanks, tabs, newlines and comments β collectively called white space β get straight up ignored, except when they're doing their little job of separating tokens. And yes, some white space is required to separate otherwise adjacent keywords and values. don't skip it π
π Words
A word is a sequence of letters, digits, and any of the following characters: _, -, ., /, @, *, :, [, ].
π§ Strings
A quoted string is any sequence of characters enclosed in double-quotes ("). A backslash appearing within a quoted string introduces an escape sequence, which gets replaced with a single character according to these rules:
\\β\β ASCII134\"β"β ASCII042\aβ audible bell β ASCII007\bβ backspace β ASCII010\fβ form-feed β ASCII014\nβ new line β ASCII012\rβ charriage return β ASCII015\tβ horizontal tabulation β ASCII011\vβ vertical tabulation β ASCII013
In addition, the sequence \newline is removed from the string. This is the moment, because it lets you split long strings over several physical lines, like:
"a long string may be\
split over several lines"
If the character following a backslash is not one of the ones specified above, the backslash is ignored and a warning is issued. π
Two or more adjacent quoted strings are concatenated, which gives you another way to split long strings over several lines to improve readability. The following fragment produces the same result as the example above:
"a long string may be"
" split over several lines"
A here-document is a special construct that lets you introduce strings of text containing embedded newlines. β¨
The <<word construct instructs the parser to read all the following lines up to the line containing only word, with possible trailing blanks. Any lines thus read are concatenated together into a single string. For example:
<<EOT
A multiline
string
EOT
The body of a here-document is interpreted the same way as a double-quoted string β unless word is preceded by a backslash (e.g. <<\EOT) or enclosed in double-quotes, in which case the text is read as is, without interpretation of escape sequences.
If word is prefixed with - (a dash), then all leading tab characters are stripped from input lines and the line containing word. Furthermore, if - is followed by a single space, all leading whitespace is stripped from them. This allows you to indent here-documents in a natural fashion, bestie. For example:
<<- TEXT
The leading whitespace will be
ignored when reading these lines.
TEXT
It is important that the terminating delimiter be the only token on its line. The only exception to this rule is allowed if a here-document appears as the last element of a statement. In this case a semicolon can be placed on the same line with its terminating delimiter, as in:
help-text <<-EOT
A sample help text.
EOT;
π Comments
The usual comment styles are all supported, queen behaviour:
- C style:
/* */ - C++ style:
//to end of line - Unix style:
#to end of line
Pragmatic comments are similar to the usual single-line comments, except that they cause some changes in the way the configuration is parsed. Pragmatic comments begin with a # sign and end with the next physical newline character.
#include <FILE>#include FILE
Include the contents of the file file. Both forms are equivalent. The FILE must be an absolute file name.
#include_once <FILE>#include_once FILE
Same as #include, except that, if the FILE has already been included, it will not be included again.
#line num#line num "FILE"
This line causes the parser to believe, for purposes of error diagnostics, that the line number of the next source line is given by num and the current input file is named by FILE. If the latter is absent, the remembered file name does not change.
# num "FILE"
This is a special form of the #line statement, understood for compatibility with the C preprocessor.
π STATEMENTS π
A simple statement consists of a keyword and value separated by any amount of whitespace. Some statements take more than one value. A simple statement is terminated with a semicolon (;).
The following is a simple statement:
pidfile /var/run/direvent.pid;
See below for a list of valid simple statements.
A value can be one of the following:
- number β a number is a sequence of decimal digits.
- boolean β one of the following:
yes,true,tor1, meaning true, andno,false,nil,0meaning false. - word
- quoted string
- list β a comma-separated list of values, enclosed in parentheses.
π Block Statement
A block statement introduces a logical group of statements. It consists of a keyword, followed by an optional value, called a tag, and a sequence of statements enclosed in curly braces, as shown in the example below:
acl global {
allow all from 198.51.100.0/24;
deny all;
}
The closing curly brace may be followed by a semicolon, although this is not required. yes bestie, optional π
π₯ SERVER SETTINGS π₯
user NAMEβ Run with the privileges of this user. The argument is either a user name, or UID prefixed with a plus sign.group LISTβ If theuserstatement is present,dicodwill drop all supplementary groups and switch to the principal group of that user. Sometimes, however, it may be necessary to retain one or more supplementary groups. For example, this might be necessary to access dictionary databases. Thegroupstatement retains the supplementary groups listed in LIST. Each group can be specified either by its name or by its GID number, prefixed with+, e.g.:
user nobody;
group (man, dict +88);
This statement is ignored if no user statement is present or if dicod is running in inetd mode.
mode daemon|inetdβ Sets server operation mode.listen LISTβ Specify the IP addresses and ports to listen on indaemonmode. By default,dicodwill listen on port2628on all existing interfaces.
Elements of LIST can have the following forms:
HOST:PORTβ Specifies an IP (version 4 or 6) socket to listen on. The HOST part is either an IPv4 in "dotted-quad" notation, or an IPv6 address in square brackets, or a host name. In the latter case,dicodwill listen on all IP addresses corresponding to itsAandAAAADNS records.
The PORT part is either a numeric port number or a symbolic service name from the /etc/services file.
Either of the two parts may be omitted. If HOST is omitted, the server will listen on all interfaces. If PORT is omitted, the default port 2628 will be used.
inet://HOST:PORT,inet4://HOST:PORTβ Listen on IPv4 socket. HOST is either an IP address or a host name. In the latter case,dicodwill start listening on all IP addresses from theArecords for this host.
Either HOST or PORT (but not both) can be omitted. Missing HOST defaults to IPv4 addresses on all available network interfaces, and missing PORT defaults to 2628.
inet6://HOST:PORTβ Listen on IPv6 socket. HOST is either an IPv6 address in square brackets, or a host name. In the latter case,dicodwill start listening on all IP addresses from theAAAArecords for this host.
Either HOST or PORT (but not both) can be omitted. Missing HOST defaults to IPv6 addresses on all available network interfaces, and missing PORT defaults to 2628.
FILENAME,unix://FILENAMEβ Specifies the name of a UNIX socket to listen on. FILENAME must be an absolute file name of the socket.
pidfile STRINGβ Store PID of the master process in this file. Default is/var/run/dicod.pid.max-children NUMBERβ Sets maximum number of subprocesses that can run simultaneously. This is equivalent to the number of clients that can simultaneously use the server. The default is64.inactivity-timeout NUMBERβ Sets inactivity timeout to the NUMBER of seconds. The server disconnects automatically if the remote client has not sent any command within this number of seconds. Setting timeout to0disables inactivity timeout (the default).
This statement along with max-children allows you to control the server load.
shutdown-timeout NUMBERβ When the master server is shutting down, wait this number of seconds for all children to terminate. Default is5seconds.identity-check BOOLEANβ Enable identification check using AUTH protocol (RFC 1413). The received user name or UID can be shown in access log using the%lconversion (see below).ident-keyfile STRINGβ Use encryption keys from the named file to decrypt AUTH replies encrypted using DES.ident-timeout NUMBERβ Set timeout for AUTH input/output operation to NUMBER of seconds. Default timeout is3seconds.
more server settings and database lore incoming in part 2, don't go anywhere bestie π«Ά
π AUTHENTICATION SETTINGS π
okay bestie, this is where you tell dicod who gets to be a real user and who's just vibing in the guest list π The authentication database gets defined like this:
user-db URL {
# Additional configuration options.
options STRING;
# Name of the password resource.
password-resource RESOURCE;
# Name of the resource returning user group information.
group-resource RESOURCE;
}
And the URL? It's built out of these pieces β square brackets mean "this part is optional, no pressure":
TYPE://[[USER[:PASSWORD]@]HOST]/PATH[PARAMS]
where, like, each piece is:
TYPEβ the database type. Only two types are supported:textandldap. That's the whole menu, periodt.USERβ the user name, if the database needs one to let you in.PASSWORDβ the user password, again if the database is asking for one.HOSTβ the domain name or IP address of the machine running the database.PATHβ a path to the database. What that actually means depends on the database protocol, so it's giving "iykyk". See the texinfo documentation πPARAMSβ a list of protocol-dependent parameters. Each one looks likeKEYWORD=NAME, and you separate multiple parameters with semicolons.
Now, these are the statements that can live inside the user-db block:
options STRINGβ passes extra options down to the underlying mechanism. The argument is treated as an opaque string and handed to the authentication open procedure verbatim. What it means depends on the database type, so it's a mystery box πpassword-resource ARGβ a database resource that returns the user's password.group-resource ARGβ a database resource that returns the list of groups this user is a member of.
The exact semantics of a database resource depend on which type of database you're using. For flat text databases, it means the name of a text file containing those data; for LDAP databases, the resource is the filter string, etc. Go read the GNU Dico Manual, subsection 4.3.3 Authentication for the full deep dive π
π SASL AUTHENTICATION
SASL authentication is available only if the server was compiled with GNU SASL, so check before you get attached. It's configured with this statement:
sasl {
# Disable SASL mechanisms listed in MECH.
disable-mechanism MECH;
# Enable SASL mechanisms listed in MECH.
enable-mechanism MECH;
# Set service name for GSSAPI and Kerberos.
service NAME;
# Set realm name for GSSAPI and Kerberos.
realm NAME;
# Define groups for anonymous users.
anon-group GROUPS;
}
The individual statements, one by one:
disable-mechanism MECHβ disables the SASL mechanisms listed inMECH, which is a list of names. Bye bestie πenable-mechanism MECHβ enables the SASL mechanisms listed inMECH, which is a list of names.service NAMEβ sets the service name for GSSAPI and Kerberos mechanisms.realm NAMEβ sets the realm name.anon-group LISTβ declares the list of user groups considered anonymous.
π§ ACCESS CONTROL LISTS π§
To define an ACL, you go:
acl NAME {
DEFINITION...
}
The parameter NAME gives that ACL a unique name π and that name is what other configuration statements use to refer to it (peep SECURITY SETTINGS, and also Database Visibility).
Every single DEFINITION looks like this:
allow|deny [all|authenticated|group GROUPLIST] [acl NAME] [from ADDRLIST]
A definition starting with allow lets people at the resource, and one starting with deny... denies it. Iconic, clear, no notes.
The next bit controls which users get access to the resource:
allβ all users (this is the default).authenticatedβ only authenticated users.group GROUPLISTβ authenticated users who are members of at least one of the groups listed inGROUPLIST.
The acl part refers to an ACL that's already been defined.
The from keyword declares that the client IP has to be within the ADDRLIST for the definition to even apply. And the elements of ADDRLIST are:
anyβ matches any client address. vibes only, everyone welcome π- IP address β matches if the request comes from the given IP (both IPv4 and IPv6 are allowed).
- ADDR/NETLEN β matches if the first
NETLENbits of the client IP address equalADDR. The network mask lengthNETLENmust be an integer between 0 and 32 for IPv4, and between 0 and 128 for IPv6. The address partADDRis described right above. - ADDR/NETMASK β matches if the result of a logical AND between the client IP address and
NETMASKequalsADDR. The network mask must be written in IP address notation (either IPv4 or IPv6).
π‘οΈ SECURITY SETTINGS π‘οΈ
connection-acl NAMEβ use ACLNAMEto control incoming connections. The ACL itself must be defined before this statement, no exceptions. And listen: using thegroupclause in this particular ACL makes no sense, because authentication is only performed after the connection has been established. Like, the connection check happens first, babe πshow-sys-info NAMEβ controls whether to show system information in reply to theSHOW SERVERcommand. The info will only be shown if ACLNAMEallows it.visibility-acl NAMEβ sets the name of the ACL that controls visibility of all databases.
π LOGGING AND DEBUGGING π
log-tag STRINGβ prefixes syslog messages with this string. By default, the program name is used.log-facility STRINGβ sets the syslog facility to use. Allowed values are:user,daemon,auth,authpriv,mail,cron,local0throughlocal7(case-insensitive), or a decimal facility number.log-print-severity BOOLEANβ prefixes diagnostics messages with a string identifying their severity.transcript BOOLEANβ controls the transcript of user sessions.
π¦ ACCESS LOG π¦
GNU Dico gives you something similar to Apache's CustomLog β a whole log of MATCH and DEFINE requests. Very main character of it.
access-log-file STRINGβ sets the access log file name.access-log-format STRINGβ defines the format string. Its argument can contain literal characters, which get copied into the log file verbatim, plus format specifiers β special sequences starting with%β which get replaced in the log file like this:%%β the percent sign.%aβ remote IP address.%Aβ local IP address.%Bβ size of response in bytes.%bβ size of response in bytes in CLF format, i.e. a dash rather than a0when no bytes are sent.%Cβ remote client (from theCLIENTcommand).%Dβ the time taken to serve the request, in microseconds.%dβ request command verb in abbreviated form, suitable for use in URLs, i.e.dforDEFINE, andmforMATCH.%hβ remote host.%Hβ request command verb (DEFINEorMATCH).%lβ remote logname (fromidentd(1), if supplied). This will return a dash unless theidentity-checkstatement is set totrue.%mβ the search strategy.%pβ the canonical port of the server serving the request.%Pβ the PID of the child that served the request.%qβ the database from the request.%rβ full request.%{N}Rβ the *N*th token from the request (Nis 0-based).%sβ reply status. For multiple replies, the form%sreturns the status of the first reply, while%>sreturns that of the last reply.%tβ time the request was received in the standard Apache format, e.g.:
[04/Jun/2008:11:05:22 +0300]
%{FORMAT}tβ the time, in the form given byFORMAT, which should be a validstrftime(3)format string. The standard%tformat is equivalent to:
[%d/%b/%Y:%H:%M:%S %z]
%Tβ the time taken to serve the request, in seconds.%uβ remote user fromAUTHcommand.%vβ the host name of the server serving the request.%Vβ actual host name of the server (in case it was overridden in configuration).%Wβ the word from the request.
If there's no access-log-format statement at all, that's equivalent to exactly this:
access-log-format "%h %l %u %t \"%r\" %>s %b";
β¨ GENERAL SETTINGS β¨
initial-banner-text TEXTβ displaysTEXTin the textual part of the initial server reply.hostname STRINGβ sets the hostname. By default it's determined automatically. The server hostname is used, among other things, in the initial reply after the220, and it may also show up in the access log file via the%vescape (see ACCESS LOG).server-info TEXTβ sets the server description shown in reply to theSHOW SERVERcommand. It's super common forTEXTto use the here-document syntax, like:
server-info <<EOT
Welcome to the FOO dictionary service.
Contact <dict@foo.example.org> if you have questions or
suggestions.
EOT;
help-text TEXTβ sets the text displayed in reply to theHELPcommand. The default reply shows a list of commands the server understands, each with a short description. IfTEXTbegins with a plus sign, it gets appended to that default reply instead. Cute, right? πdefault-strategy NAMEβ sets the name of the default matching strategy (*note MATCH::). By default, Levenshtein matching is used, which is equivalent todefault-strategy lev;
π CAPABILITIES π
capability LISTβ requests additional capabilities from theLIST.
Capabilities are certain server features that can be enabled or disabled whenever the system administrator feels like it. The following capabilities are defined:
authβ theAUTHcommand is supported. See the section AUTHENTICATION for its configuration.mimeβ theOPTION MIMEcommand is supported. Heads up: RFC 2229 requires all servers to support that command, so you should always specify this capability. No skipping, bestie π«Άxversionβ theXVERSIONcommand is supported. It's a GNU extension that displays the dicod implementation and version number.xlevβ theXLEVcommand is supported. This command lets the remote party set and query the maximal Levenshtein distance for thelevmatching strategy.
The capabilities set using this directive are displayed in the initial server reply, and their descriptions get added to the HELP command output (unless the help-text statement says otherwise).
π§© DATABASE MODULES π§©
Okay so bestie, a database module is an external piece of software designed to handle a particular format of dictionary databases. That piece of software is built as a shared library that dicod loads at run time. β¨
A handler is an instance of the database module loaded by dicod and configured for a specific database or a set of databases.
Database handlers are defined using this block statement:
load-module NAME {
command CMD;
}
The load-module statement creates an instance of a database module. The NAME argument specifies a unique name which will be used by subsequent parts of the configuration to refer to this handler. The command line for this handler is supplied with the command statement. It must begin with the name of the module (without the library suffix) and can contain any additional arguments. If the module name is not an absolute file name, the module will be searched in the module load path. π
For example:
load-module dict {
command "dictorg dbdir=/var/dicodb";
}
A simplified form of this statement:
load-module NAME;
is equivalent to:
load-module NAME {
command NAME;
}
A module load path is an internal list of directories which dicod scans in order to find a loadable file name specified in the command statement. By default the search order is as follows:
- Optional prefix search directories specified in the
prepend-load-pathstatement (see below); - GNU Dico module directory
/usr/lib/x86_64-linux-gnu/dico; - Additional search directories specified in the
module-load-pathstatement (see below); - The value of the environment variable
LTDL_LIBRARY_PATH; - The system dependent library search path (e.g. on GNU/Linux it is defined by the file
/etc/ld.so.confand the environment variableLD_LIBRARY_PATH).
The value of LTDL_LIBRARY_PATH and LD_LIBRARY_PATH must be a colon-separated list of absolute directory names. π¦
In each of these directories, dicod first attempts to find and load the given filename. If this fails, it tries to append the following suffixes to it:
- the libtool archive suffix
.la; - the suffix used for native dynamic libraries on the host platform, e.g.,
.so,.sl, etc.
module-load-path LISTβ Add directories from LIST to the end of the module load path. πprepend-load-path LISTβ Add directories from LIST to the beginning of the module load path.
ποΈ DATABASES
The whole vibe, in one block:
database {
name WORD;
description STRING;
info TEXT;
languages-from LANGLIST;
languages-to LANGLIST;
handler NAME;
visibility-acl NAME;
mime-headers TEXT;
}
name STRINGβ Sets the name of this database (a single word). This name will be used to identify this database in DICT commands. πhandler STRINGβ Specifies the handler name for this database and optional arguments for it. This handler must be previously defined using theload-modulestatement (see above).description STRINGβ Supplies a short description, to be shown in reply to theSHOW DBcommand. The STRING may not contain newlines.info STRINGβ Defines a full description of the database. This description is shown in reply to theSHOW INFOcommand. It is usually a multi-line text, so it is common to use here-document syntax here. πΈcontent-type STRINGβ Sets the content type of the reply (for use in MIME headers).content-transfer-encoding VALUEβ Sets transfer encoding to use when sending MIME replies for this database. VALUE is one of:base64,quoted-printable.visibility-acl NAMEβ Sets name of the ACL that controls that database visibility. π
π STRATEGIES AND SEARCHES π
A default search is a MATCH request with * or ! as the database argument. The former means search in all available databases, and the latter means search in all databases until a match is found.
Default searches can be quite expensive and can cause considerable strain on the server. For example, the command MATCH * priefix "" returns all entries from all available databases, which would consume a lot of resources both on the server and on the client side. π
To minimize harmful effects from such potentially dangerous requests, the following statement makes it possible to limit the use of certain strategies in default searches:
strategy NAME {
deny-all BOOL;
deny-word CONDLIST;
deny-length-lt NUMBER;
deny-length-le NUMBER;
deny-length-gt NUMBER;
deny-length-ge NUMBER;
deny-length-eq NUMBER;
deny-length-ne NUMBER;
}
deny-all BOOLβ Unconditionally deny the use of this strategy in default searches.deny-word LISTβ Deny this strategy if the search word matches one of the words from LIST.deny-length-lt NUMBERβ Deny if length of the search word is less than NUMBER.deny-length-le NUMBERβ Deny if length of the search word is less than or equal to NUMBER.deny-length-gt NUMBERβ Deny if length of the search word is greater than NUMBER.deny-length-ge NUMBERβ Deny if length of the search word is greater than or equal to NUMBER.deny-length-eq NUMBERβ Deny if length of the search word is equal to NUMBER.deny-length-ne NUMBERβ Deny if length of the search word is not equal to NUMBER.
For example, the following statement denies the use of prefix strategy in default searches if its argument is an empty string:
strategy prefix {
deny-length-eq 0;
}
β±οΈ TUNING β±οΈ
While tuning your server, it is often necessary to get timing information which shows how much time is spent serving certain requests. This can be achieved using the following configuration directive:
timing BOOLEANβ Provide timing information after successful completion of an operation.
This information is displayed after replies to the following requests: MATCH, DEFINE, and QUIT. The format is:
[d/m/c = ND/NM/NC RTr UTu STs]
where:
- ND β Number of processed define requests.
- NM β Number of processed match requests.
- NC β Number of comparisons made. This value may be inaccurate if the underlying database module does not provide such information. π
- RT β Real time spent serving the request.
- UT β Time in user space spent serving the request.
- ST β Time in kernel space spent serving the request.
You can also add timing information to your access log files. See the %T conversion in section ACCESS LOG. π₯
πͺ COMMAND ALIASES πͺ
Aliases allow a string to be substituted for a word when it is used as the first word of a command. The daemon maintains a list of aliases that are created using the alias configuration file statement:
alias WORD COMMANDβ Creates a new alias.
Aliases may be recursive, i.e. the first word of COMMAND may refer to another alias. To prevent endless loops, recursive expansion is stopped if the first word of the replacement text is identical to an alias expanded earlier. π
Aliases are useful to facilitate manual interaction with the server, as they allow the administrator to create abbreviations for some frequently typed commands. For example, the following alias creates new command d which is equivalent to DEFINE *:
alias d DEFINE "*";
π SEE ALSO π
dicod(1), RFC 2229.
Complete GNU Dico manual: run info dico or use emacs(1) info mode to read it. π«Ά
Online copies of GNU Dico documentation in various formats can be found at:
http://www.gnu.org.ua/software/dico/manual
π AUTHORS π
Sergey Poznyakoff
π BUG REPORTS π
Report bugs to bug-dico@gnu.org.ua. fr fr, they wanna hear it. π
βοΈ COPYRIGHT βοΈ
Copyright Β© 2008-2018 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
And that's a wrap bestie π this was DICOD.CONF(5), straight outta GNU DICO, dated August 20, 2018. go configure something iconic π
β¨
π¦ where this page comes from
- ubuntu resolute: dicod 2.12-4build1 Β· GPL-3.0-or-later
- ubuntu stonking: dicod 2.12-4build1 Β· GPL-3.0-or-later
- Copyright (C) 2014-2024 Sergey Poznyakoff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms