2 @unnumbered Configuration file
4 Example @url{https://hjson.org/, Hjson} configuration file:
9 log: /var/spool/nncp/log
15 to: user+file@example.com
19 to: user+freq@example.com
25 exchpub: CYVGQ...PSEWQ
26 exchprv: 65PUY...MPZ3Q
27 signpub: 2NMVC...CMH5Q
28 signprv: 555JD...RGD6Y
29 noiseprv: D62XU...NKYPA
30 noisepub: KIBKK...ESM7Q
36 exchpub: CYVGQ...PSEWQ
37 signpub: 2NMVC...CMH5Q
38 noisepub: KIBKK...ESM7Q
39 exec: {sendmail: ["/usr/sbin/sendmail"]}
43 exchpub: MJACJ...FAI6A
44 signpub: T4AFC...N2FRQ
45 noisepub: UBM5K...VI42A
46 exec: {flag: ["/usr/bin/touch", "-t"]}
47 incoming: "/home/alice/incoming"
51 lan: "[fe80::1234%igb0]:5400"
52 internet: alice.com:3389
53 proxied: "|ssh remote.host nncp-daemon -inetd"
63 exchpub: WFLMZ...B7NHA
64 signpub: GTGXG...IE3OA
66 sendmail: ["/usr/sbin/sendmail"]
67 warcer: ["/path/to/warcer.sh"]
68 wgeter: ["/path/to/wgeter.sh"]
83 @strong{spool} field contains an absolute path to @ref{Spool, spool}
84 directory. @strong{log} field contains an absolute path to @ref{Log,
87 Non-empty optional @strong{umask} will force all invoked commands to
88 override their umask to specified octal mask. Useful for using with
89 @ref{Shared spool, shared spool directories}.
92 @strong{notify} section contains notification settings for successfully
93 tossed file and freq packets. Corresponding @strong{from} and
94 @strong{to} fields will be substituted in notification email message.
95 @emph{neigh/self/exec/sendmail} will be used as a local mailer. You can
96 omit either of those two @emph{from}/@emph{to} sections to omit
97 corresponding notifications, or the whole section at once.
99 @strong{self} section contains our node's private keypairs.
100 @strong{exch*} and @strong{sign*} are used during @ref{Encrypted,
101 encrypted} packet creation. @strong{noise*} are used during @ref{Sync,
102 synchronization protocol} working in @ref{nncp-call}/@ref{nncp-daemon}.
104 @strong{neigh} section contains all known neighbours information. It
105 always has @strong{self} neighbour that is copy of our node's public
106 data (public keys). It is useful for copy-paste sharing with your
107 friends. Each section's key is a human-readable name of the neighbour.
109 Except for @emph{id}, @emph{exchpub} and @emph{signpub} each neighbour
110 node has the following fields:
115 If present, then node can be online called using @ref{Sync,
116 synchronization protocol}. Contains authentication public key.
120 Dictionary consisting of handles and corresponding command line
121 arguments. In example above there are @command{sendmail} handles,
122 @command{warcer}, @command{wgeter} and @command{flag} one. Remote node
123 can queue some handle execution with providing additional command line
124 arguments and the body fed to command's stdin.
126 @verb{|sendmail: ["/usr/sbin/sendmail", "-t"]|} handle, when called by
127 @verb{|echo hello world | nncp-exec OURNODE sendmail ARG0 ARG1 ARG2|}
128 command, will execute:
134 /usr/sbin/sendmail -t ARG0 ARG1 ARG2
137 feeding @verb{|hello world\n|} to that started @command{sendmail}
142 Full path to directory where all file uploads will be saved. May be
143 omitted to forbid file uploading on that node.
147 Full path to directory from where file requests will queue files for
148 transmission. May be omitted to forbid freqing from that node.
151 If set, then enable @ref{Chunked, chunked} file transmission during
152 freqing. This is the desired chunk size in KiBs.
155 If set, then apply @ref{OptMinSize, -minsize} option during file
160 An array of node identifiers that will be used as a relay to that node.
161 For example @verb{|[foo,bar]|} means that packet can reach current node
162 by transitioning through @emph{foo} and then @emph{bar} nodes. May be
163 omitted if direct connection exists and no relaying is required.
167 Dictionary containing known network addresses of the node. Each key is
168 human-readable name of the address. For direct TCP connections use
169 @verb{|host:port|} format, pointing to @ref{nncp-daemon}'s listening
170 instance. Also you can pipe connection through the external command
171 using @verb{#|some command#} format. @code{/bin/sh -c "some command"}
172 will start and its stdin/stdout used as a connection. May be omitted if
173 either no direct connection exists, or @ref{nncp-call} is used with
174 forced address specifying.
178 If greater than zero, then at most *rate packets per second will be
179 sent/received after the handshake. It could be used as crude bandwidth
180 traffic shaper: each packet has at most 64 KiB payload size. Could be
181 omitted at all -- no rate limits.
183 @anchor{CfgOnlineDeadline}
185 Online connection deadline of node inactivity in seconds. It is the time
186 connection considered dead after not receiving/sending any packets and
187 node must disconnect. By default it is set to 10 seconds -- that means
188 disconnecting after 10 seconds when no packets received and transmitted.
189 This can be set to rather high values to keep connection alive (to
190 reduce handshake overhead and delays), wait for appearing packets ready
191 to send and notifying remote side about their appearance.
193 @anchor{CfgMaxOnlineTime}
195 If greater than zero, then it is maximal amount of time connect could be
196 alive. Forcefully disconnect if it is exceeded.
200 List of @ref{Call, call configuration}s. Can be omitted if
201 @ref{nncp-caller} won't be used to call that node.
206 * Shared spool directory: Shared spool.
210 @section Shared spool directory
212 If you want to share single spool directory with multiple grouped Unix
213 users, then you can @command{setgid} it and assure that umask is group
214 friendly. For convenience you can set @option{umask} globally for
215 invoked NNCP commands in the configuration file. For example:
218 $ chgrp nncp /usr/local/etc/nncp.hjson /var/spool/nncp
219 $ chmod g+r /usr/local/etc/nncp.hjson
220 $ chmod g+rwxs /var/spool/nncp
221 $ echo 'umask: "007"' >> /usr/local/etc/nncp.hjson