Debian Codegraph @

doc/contrib/mod_log_forensic.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_log_forensic</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_log_forensic</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 The <code>mod_log_forensic</code> module "captures" log messages generated
17 by <code>proftpd</code>, for all sorts of log destinations, <i>even if those
18 log messages would otherwise <b>not</b> be written out</i>, and buffers them
19 in memory. When certain criteria are met (<i>e.g.</i> failed logins,
20 segfaults, <i>etc</i>), the <code>mod_log_forensic</code> module will flush
21 the buffered log messages out to a file. Installation instructions are
22 discussed <a href="#Installation">here</a>.
23
24 <p>
25 The most current version of <code>mod_log_forensic</code> is distributed with
26 the ProFTPD source code.
27
28 <h2>Author</h2>
29 <p>
30 Please contact TJ Saunders &lt;tj <i>at</i> castaglia.org&gt; with any
31 questions, concerns, or suggestions regarding this module.
32
33 <h2>Directives</h2>
34 <ul>
35 <li><a href="#ForensicLogBufferSize">ForensicLogBufferSize</a>
36 <li><a href="#ForensicLogCapture">ForensicLogCapture</a>
37 <li><a href="#ForensicLogCriteria">ForensicLogCriteria</a>
38 <li><a href="#ForensicLogEngine">ForensicLogEngine</a>
39 <li><a href="#ForensicLogFile">ForensicLogFile</a>
40 </ul>
41
42 <p>
43 <hr>
44 <h3><a name="ForensicLogBufferSize">ForensicLogBufferSize</a></h3>
45 <strong>Syntax:</strong> ForensicLogBufferSize <em>count</em><br>
46 <strong>Default:</strong> 1024<br>
47 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
48 <strong>Module:</strong> mod_log_forensic<br>
49 <strong>Compatibility:</strong> 1.3.4rc3 and later
50
51 <p>
52 The <code>ForensicLogBufferSize</code> directives configures the <em>count</em>
53 of log messages that <code>mod_log_forensic</code> will buffer. It is
54 effectively the count of the last <em>count</em> log messages you wish to
55 see logged, when one of the
56 <a href="#ForensicLogCriteria"><code>ForensicLogCriteria</code></a> are met.
57
58 <p>
59 <hr>
60 <h3><a name="ForensicLogCapture">ForensicLogCapture</a></h3>
61 <strong>Syntax:</strong> ForensicLogCapture <em>log-type1 ...</em><br>
62 <strong>Default:</strong> Unspec TransferLog syslog SystemLog ExtendedLog TraceLog<br>
63 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
64 <strong>Module:</strong> mod_log_forensic<br>
65 <strong>Compatibility:</strong> 1.3.4rc3 and later
66
67 <p>
68 The <code>ForensicLogCapture</code> directive configures which log types
69 the <code>mod_log_forensic</code> module "captures" for later writing. By
70 default, <code>mod_log_forensic</code> captures messages for all log types.
71
72 <p>
73 The supported log types are:
74 <ul>
75 <li><code>Unspec</code>
76 <p>
77 This "type" covers any unspecified/unknown log, <i>e.g.</i> module-specific
78 log files such as <code>SFTPLog</code>, <code>SQLLogFile</code>,
79 <code>TLSLog</code>, <i>etc</i>.
80 </li>
81
82 <p>
83 <li><code>TransferLog</code>
84 <li><code>syslog</code>
85 <li><code>SystemLog</code>
86 <li><code>ExtendedLog</code>
87 <li><code>TraceLog</code>
88 </ul>
89
90 <p>
91 <hr>
92 <h3><a name="ForensicLogCriteria">ForensicLogCriteria</a></h3>
93 <strong>Syntax:</strong> ForensicLogCriteria <em>criterion1 ...</em><br>
94 <strong>Default:</strong> FailedLogin UntimelyDeath<br>
95 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
96 <strong>Module:</strong> mod_log_forensic<br>
97 <strong>Compatibility:</strong> 1.3.4rc3 and later
98
99 <p>
100 The <code>ForensicLogCriteria</code> directive configures the criteria
101 which determine when <code>mod_log_forensic</code> will flush its buffered
102 log messages out to the configured
103 <a href="#ForensicLogFile"><code>ForensicLogFile</code></a>. Multiple
104 criteria can be specified.
105
106 <p>
107 The currently supported criteria are:
108 <ul>
109 <li><code>FailedLogin</code>
110 <p>
111 The buffered log messages will be written to the
112 <code>ForensicLogFile</code> if the login fails for any reason.
113 </li>
114
115 <p>
116 <li><code>UntimelyDeath</code>
117 <p>
118 If a session dies prematurely, <i>e.g.</i> due to a segfault or other
119 internal error, the buffered log messages will be written to the
120 <code>ForensicLogFile</code>.
121 </li>
122
123 <p>
124 <li><code>ModuleConfig</code>
125 <p>
126 If a session dies due to a module-specific policy, the buffered log
127 messages will be written to the <code>ForensicLogFile</code>.
128 </li>
129 </ul>
130
131 <p>
132 <hr>
133 <h3><a name="ForensicLogEngine">ForensicLogEngine</a></h3>
134 <strong>Syntax:</strong> ForensicLogEngine <em>on|off</em><br>
135 <strong>Default:</strong> off<br>
136 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
137 <strong>Module:</strong> mod_log_forensic<br>
138 <strong>Compatibility:</strong> 1.3.4rc3 and later
139
140 <p>
141 The <code>ForensicLogEngine</code> directive enables or disables the
142 <code>mod_log_forensic</code> module.
143
144 <p>
145 <hr>
146 <h3><a name="ForensicLogFile">ForensicLogFile</a></h3>
147 <strong>Syntax:</strong> ForensicLogFile <em>file</em><br>
148 <strong>Default:</strong> None<br>
149 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
150 <strong>Module:</strong> mod_log_forensic<br>
151 <strong>Compatibility:</strong> 1.3.4rc3 and later
152
153 <p>
154 The <code>ForensicLogFile</code> directive configures a file used for logging
155 by <code>mod_log_forensic</code>. The configured <em>file</em> must be an
156 absolute path.
157
158 <p>
159 <b>Note</b> that this directive is <b>required</b> for
160 <code>mod_log_forensic</code> to function properly.
161
162 <p>
163 <hr>
164 <h2><a name="Installation">Installation</a></h2>
165 The <code>mod_log_forensic</code> module is distributed with ProFTPD. For
166 including <code>mod_log_forensic</code> as a statically linked module, use:
167 <pre>
168 $ ./configure --with-modules=mod_log_forensic ...
169 </pre>
170 Alternatively, <code>mod_log_forensic</code> can be built as a DSO module:
171 <pre>
172 $ ./configure --enable-dso --with-shared=mod_log_forensic ...
173 </pre>
174 Then follow the usual steps:
175 <pre>
176 $ make
177 $ make install
178 </pre>
179
180 <p>
181 Alternatively, if your <code>proftpd</code> was compiled with DSO support, you
182 can use the <code>prxs</code> tool to build <code>mod_log_forensic</code> as a
183 shared module:
184 <pre>
185 $ prxs -c -i -d mod_log_forensic.c
186 </pre>
187
188 <p>
189 <hr>
190 <h2><a name="Usage">Usage</a></h2>
191
192 <p>
193 Example <code>mod_log_forensic</code> configuration:
194 <pre>
195 &lt;IfModule mod_log_forensic.c&gt;
196 ForensicLogEngine on
197 ForensicLogFile /path/to/forensic.log
198 &lt;/IfModule&gt;
199 </pre>
200
201 <p>
202 For a failed login, the configured <code>ForensicLogFile</code> will
203 contain a block of log lines, <i>e.g.</i>:
204 <pre>
205 -----BEGIN FAILED LOGIN FORENSICS-----
206 Client-Address: 127.0.0.1
207 Server-Address: ::ffff:127.0.0.1:5376
208 Elapsed: 1245
209 Protocol: ftp
210 User: tj
211 UID: 501
212 GID: 501
213 Raw-Bytes-In: 46
214 Raw-Bytes-Out: 158
215 Total-Bytes-In: 0
216 Total-Bytes-Out: 0
217 Total-Files-In: 0
218 Total-Files-Out: 0
219
220 ...
221 [syslog:7, PID 16044] dispatching CMD command 'PASS (hidden)' to mod_auth
222 [syslog:7, PID 16044] retrieved UID 1000 for user 'tj'
223 [syslog:7, PID 16044] retrieved group IDs: 1000, 0, 4, 20, 24, 46, 108, 109, 110
224 [syslog:7, PID 16044] retrieved group names: tj, root, adm, dialout, cdrom, plugdev, lpadmin, sambashare, admin
225 [syslog:7, PID 16044] ROOT PRIVS at mod_auth_pam.c:312
226 [syslog:7, PID 16044] RELINQUISH PRIVS at mod_auth_pam.c:482
227 [syslog:7, PID 16044] ROOT PRIVS at mod_auth_unix.c:467
228 [syslog:7, PID 16044] RELINQUISH PRIVS at mod_auth_unix.c:548
229 [SystemLog:5] familiar proftpd[15509] localhost (localhost[127.0.0.1]): USER tj (Login failed): Incorrect password.
230 [syslog:7, PID 16044] dispatching POST_CMD_ERR command 'PASS (hidden)' to mod_delay
231 [syslog:7, PID 16044] dispatching LOG_CMD_ERR command 'PASS (hidden)' to mod_log
232 -----END FAILED LOGIN FORENSICS-----
233 </pre>
234
235 For sessions which suffer an "untimely death", the begin/end markers in the
236 <code>ForensicLogFile</code> are:
237 <pre>
238 -----BEGIN UNTIMELY DEATH FORENSICS-----
239 Client-Address: 127.0.0.1
240 Server-Address: ::ffff:127.0.0.1:5376
241 Elapsed: 1245
242 Protocol: ftp
243 User: tj
244 UID: 501
245 GID: 501
246 Raw-Bytes-In: 46
247 Raw-Bytes-Out: 158
248 Total-Bytes-In: 0
249 Total-Bytes-Out: 0
250 Total-Files-In: 0
251 Total-Files-Out: 0
252
253 ...
254 -----END UNTIMELY DEATH FORENSICS-----
255 </pre>
256
257 <p>
258 <b>Advantages</b><br>
259 What's the big deal with this module? What advantage does it provide
260 over the normal <code>proftpd</code> logging? The advantage is that with
261 <code>mod_log_forensic</code>, you do not have to configure ProFTPD to use
262 verbose logging (<i>i.e.</i> high <code>DebugLevel</code> and/or
263 <code>Trace</code> levels). If ProFTPD generated a log message internally
264 <b>but</b> that log message was filtered, then that log message would not
265 normally be written to disk -- <i>but <code>mod_log_forensic</code> buffers
266 that log message anyway</i>.
267
268 <p>
269 To see this, simply use the following in your <code>proftpd.conf</code>:
270 <pre>
271 TraceLog /path/to/ftpd/trace.log
272 Trace DEFAULT:0
273
274 &lt;IfModule mod_log_forensic.c&gt;
275 ForensicLogEngine on
276 ForensicLogFile /path/to/ftpd/forensic.log
277 &lt;/IfModule&gt;
278 </pre>
279 This configured <code>proftpd</code> for trace logging, but turns the
280 trace logging levels down to zero so that normally, nothing would be written
281 in the configured <code>TraceLog</code> file.
282
283 <p>
284 Now attempt to log into <code>proftpd</code>, deliberately using a wrong/bad
285 password (or unknown user). The <code>mod_log_forensic</code> module will
286 write out all of the trace logging messages
287 (and the other <code>SystemLog</code>/syslog messages) to the
288 <code>ForensicLogFile</code>, even though the debug level is at the default
289 level of zero, and the trace levels are all zero. Thus you get the verbose
290 logging needed to help diagnose failed logins and such, without having
291 the verbose logging enabled all of the time.
292
293 <p>
294 <hr>
295 <font size=2><b><i>
296 &copy; Copyright 2011-2013 TJ Saunders<br>
297 All Rights Reserved<br>
298 </i></b></font>
299 <hr>
300
301 </body>
302 </html>