]> Cypherpunks.ru repositories - nncp.git/blob - doc/admin.texi
11c26ecd570b8c42dd0fdd5855eab68c3603bebc
[nncp.git] / doc / admin.texi
1 @node Administration
2 @unnumbered Administration
3
4 NNCP uses following files/directories you should be aware of:
5
6 @itemize
7
8 @item
9     @ref{Configuration} file, for example @file{/usr/local/etc/nncp.hjson}.
10     Should not be globally readable, because it contains private keys.
11
12 @item
13     @ref{Spool} directory with inbound/outbound encrypted packets, for
14     example @file{/var/spool/nncp}.
15
16     It also contains temporary files (in @file{tmp/} directory),
17     possibly left alone, if some of the commands failed and prematurely
18     exited and that should be cleaned from time to time.
19
20     Partly transferred files are stored with @file{.part} suffix. And
21     possibly they also require cleanup if they are completely lost.
22
23     It can contain @file{.nock} files: fully downloaded, but still not
24     checksummed. Can be checksummed (with @file{.nock} extension removing)
25     with @command{nncp-check -nock}.
26
27     Also it can contain @file{seen/} and @file{hdr/} subdirectories,
28     that should be cleaned too from time to time.
29
30     All of that cleaning tasks can be done with @ref{nncp-rm} utility.
31
32     @anchor{Shared spool}
33     If you want to share single spool directory with multiple grouped
34     Unix users, then you can @command{setgid} it and assure that umask
35     is group friendly. For convenience you can set @option{umask}
36     globally for invoked NNCP commands in the configuration file. For
37     example:
38
39 @example
40 $ chgrp nncp /usr/local/etc/nncp.hjson /var/spool/nncp
41 $ chmod g+r /usr/local/etc/nncp.hjson
42 $ chmod g+rwxs /var/spool/nncp
43 $ echo 'umask: "007"' >> /usr/local/etc/nncp.hjson
44 @end example
45
46 @item
47     @ref{Log} file, for example @file{/var/spool/nncp/log}. It should be
48     rotated. Choose you own preferable way to do it.
49
50     Example @url{https://www.newsyslog.org/manual.html, newsyslog}'s entry:
51 @example
52 /var/spool/nncp/log             644     7       100     *       BCYN
53 @end example
54
55 @item
56     Optional @ref{CfgIncoming, incoming} directories where uploaded
57     files are stored. Probably you want to run @ref{nncp-reass} from
58     time to time to reassemble all chunked uploads. Example crontab
59     entry:
60
61 @example
62 */1     *       *       *       *       nncp-reass -all -noprogress
63 @end example
64
65 @item
66     Possibly long running @ref{nncp-daemon}, @ref{nncp-caller},
67     @ref{nncp-toss}, @ref{nncp-check} daemons. As all software, they can
68     fail and you should place them under some supervisor control.
69
70     For example you can use @url{http://cr.yp.to/daemontools.html,
71     daemontools} for that task to run them under probably existing
72     @verb{|uucp|} user:
73
74 @example
75 # mkdir -p /var/service/.nncp-toss/log
76 # cd /var/service/.nncp-toss
77
78 # cat > run <<EOF
79 #!/bin/sh -e
80 exec 2>&1
81 exec setuidgid uucp /usr/local/bin/nncp-toss -cycle 10
82 EOF
83
84 # cat > log/run <<EOF
85 #!/bin/sh -e
86 exec setuidgid uucp multilog t ./main
87 EOF
88
89 # chmod -R 755 /var/service/.nncp-toss
90 # mv /var/service/.nncp-toss /var/service/nncp-toss
91 @end example
92
93 @item
94     @ref{nncp-daemon} can also be run as
95     @url{https://en.wikipedia.org/wiki/Inetd, inetd} service on UUCP's port:
96
97 @example
98 uucp    stream  tcp6    nowait  nncpuser        /usr/local/bin/nncp-daemon      nncp-daemon -quiet -ucspi
99 @end example
100
101 @item
102     Or it can be also run as a @command{daemontools} daemon under
103     @url{http://cr.yp.to/ucspi-tcp.html, UCSPI-TCP}. In the example
104     below it uses native daemontools's logging capability:
105
106 @example
107 # mkdir -p /var/service/.nncp-daemon/log
108 # cd /var/service/.nncp-daemon
109
110 # cat > run <<EOF
111 #!/bin/sh -e
112 NNCPLOG=FD:4 exec envuidgid nncpuser tcpserver -DHRU -l 0 ::0 uucp \
113         /usr/local/bin/nncp-daemon -quiet -ucspi 4>&1
114 EOF
115
116 # cat > log/run <<EOF
117 #!/bin/sh -e
118 exec setuidgid uucp multilog ./main
119 EOF
120
121 # chmod -R 755 /var/service/.nncp-daemon
122 # mv /var/service/.nncp-daemon /var/service/nncp-daemon
123 @end example
124
125 @end itemize