PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/3rdparty/webmail_logger_config.php

https://github.com/cormander/ravencore
PHP | 413 lines | 90 code | 58 blank | 265 comment | 0 complexity | 8b78a0e13c55588edb267919f137f702 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. global $sl_logs, $sl_log_events, $data_dir, $sl_logfile, $sl_namelookups,
  3. $sl_dateformat, $sl_send_alerts, $sl_mass_mail_limit,
  4. $sl_alert_to, $sl_alert_cc, $sl_alert_bcc,
  5. $sl_alert_subject_template, $sl_log_mass_mailing_show_recipients,
  6. $sl_log_mass_mailing_show_message_body, $sl_dsn, $sl_insert_event_query,
  7. $sl_use_GMT, $sl_fail_silently, $skip_domains, $only_log_domains,
  8. $sl_log_outgoing_messages_show_recipients,
  9. $sl_log_outgoing_messages_show_message_body, $sl_useSendmail,
  10. $sl_smtpServerAddress, $sl_smtpPort, $sl_sendmail_path,
  11. $sl_sendmail_args, $sl_pop_before_smtp,
  12. $sl_log_mass_mailing_show_reply_to,
  13. $sl_log_mass_mailing_show_from, $sl_alert_from,
  14. $sl_log_mass_mailing_show_subject,
  15. $sl_log_outgoing_messages_show_reply_to,
  16. $sl_log_outgoing_messages_show_from,
  17. $sl_log_outgoing_messages_show_subject,
  18. $sl_encode_header_key, $sl_smtp_auth_mech,
  19. $sl_smtp_sitewide_user, $sl_smtp_sitewide_pass;
  20. // This is a list of the types of events you would like
  21. // to log. The supported log events are:
  22. //
  23. // LOGIN Successful user login event
  24. // LOGOUT Successful user logout event
  25. // TIMEOUT User session timeout
  26. // OUTGOING_MAIL Message sent
  27. // MASS_MAILING Message sent with more than $sl_mass_mail_limit recipients
  28. // LOGIN_ERROR Failed login attempt
  29. // ERROR Other system errors
  30. //
  31. // Note that other plugins or custom code might add their
  32. // own event types as well. For example, the CAPTCHA plugin
  33. // has an optional "CAPTCHA" event type (an example of how to
  34. // log that kind of event can be found below under $sl_logs).
  35. // Other known plugin event types: "RESTRICT_SENDERS", "LOCKOUT"
  36. //
  37. $sl_log_events = array(
  38. 'LOGIN',
  39. 'LOGOUT',
  40. 'TIMEOUT',
  41. // 'OUTGOING_MAIL',
  42. // 'MASS_MAILING',
  43. 'LOGIN_ERROR',
  44. // 'ERROR',
  45. // 'CAPTCHA',
  46. // 'RESTRICT_SENDERS',
  47. );
  48. // This is a list of the log types you want to use and the types
  49. // of events that are to be logged to each log destination.
  50. // It is also where you define the exact text of log messages
  51. // for each log type/event type. Note that SQL log type formatting
  52. // is set in the $sl_insert_event_query setting and should not be
  53. // contained here; instead, you may only change the text of the
  54. // event name.
  55. //
  56. // You may use any (more than one is OK) of the following log
  57. // types:
  58. //
  59. // SYSTEM:<priority>:<facility>:<ident>:<options>
  60. // FILE
  61. // SQL
  62. //
  63. // You can have multiple SYSTEM log types listed - for as many
  64. // different combinations of priority, log facility, ident, and
  65. // options you want to use. Note that you may omit any or all
  66. // of these elements. When you do, the default PHP log facility
  67. // (LOG_SYSLOG) will be used with LOG_INFO priority. Some examples:
  68. //
  69. // SYSTEM
  70. // SYSTEM:LOG_INFO
  71. // SYSTEM:LOG_INFO::squirrelmail
  72. // SYSTEM:LOG_INFO:LOG_MAIL
  73. // SYSTEM:LOG_INFO:LOG_MAIL:squirrelmail
  74. // SYSTEM:LOG_WARNING:LOG_MAIL:squirrelmail:LOG_CONS | LOG_NDELAY | LOG_PID
  75. //
  76. // Again, you may use more than one such SYSTEM log, which allows
  77. // you to log different events with different priority or to a
  78. // different log facility. For more details about the possible
  79. // priority types (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
  80. // LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG), see:
  81. //
  82. // http://php.net/manual/function.syslog.php
  83. //
  84. // For more details and a list of the available facilities and options,
  85. // consult:
  86. //
  87. // http://php.net/manual/function.openlog.php
  88. //
  89. // The event types that should be listed for each log type should
  90. // be selected from the choices you have for $sl_log_events (note
  91. // that if you have an event type turned off in the $sl_log_events
  92. // setting, you will not have that event type logged no matter
  93. // what you put here).
  94. //
  95. // %1 in the log format strings will be replaced with the event name
  96. // %2 in the log format strings will be replaced with the user name
  97. // %3 in the log format strings will be replaced with the domain name
  98. // %4 in the log format strings will be replaced with the remote address value
  99. // %5 in the log format strings will be replaced with the timestamp
  100. // %6 in the log format strings will be replaced with the formatted date
  101. // %7 in the log format strings will be replaced with any (event-specific) comments
  102. //
  103. $sl_logs = array(
  104. 'SYSTEM:LOG_INFO:LOG_MAIL' => array(
  105. 'LOGIN' => "Successful webmail login: by %2 (%3) at %4 on %6: %7",
  106. 'LOGOUT' => "Webmail logout: by %2 (%3) at %4 on %6: %7",
  107. 'TIMEOUT' => "Webmail session timed out: by %2 (%3) at %4 on %6: %7",
  108. 'OUTGOING_MAIL' => "Message sent via webmail: by %2 (%3) at %4 on %6: %7",
  109. 'MASS_MAILING' => "Possible outgoing spam: by %2 (%3) at %4 on %6: %7",
  110. 'LOGIN_ERROR' => "Failed webmail login: by %2 (%3) at %4 on %6: %7",
  111. 'ERROR' => "Webmail error: by %2 (%3) at %4 on %6: %7",
  112. // 'CAPTCHA' => "Webmail CAPTCHA litmus: by %2 (%3) at %4 on %6: %7",
  113. // 'RESTRICT_SENDERS' => "Failed recipient limit: by %2 (%3) at %4 on %6: %7",
  114. ),
  115. 'SYSTEM:LOG_ALERT:LOG_AUTH' => array(
  116. // 'MASS_MAILING' => "Possible outgoing spam: by %2 (%3) at %4 on %6: %7",
  117. ),
  118. 'FILE' => array(
  119. // 'LOGIN' => "%6 [%1] %2 (%3) from %4: %7\n",
  120. // 'LOGOUT' => "%6 [%1] %2 (%3) from %4: %7\n",
  121. // 'TIMEOUT' => "%6 [%1] %2 (%3) from %4: %7\n",
  122. // 'MASS_MAILING' => "%6 [%1] %2 (%3) from %4: %7\n",
  123. // 'LOGIN_ERROR' => "%6 [%1] %2 (%3) from %4: %7\n",
  124. // 'LOGIN_ERROR' => "%6 [INVALID] %2 (%3) from %4: %7\n",
  125. // 'ERROR' => "%6 [%1] %2 (%3) from %4: %7\n",
  126. ),
  127. 'SQL' => array(
  128. // 'LOGIN' => 'LOGIN',
  129. // 'LOGOUT' => 'LOGOUT',
  130. // 'TIMEOUT' => 'TIMEOUT',
  131. // 'MASS_MAILING' => 'MASS_MAILING',
  132. // 'LOGIN_ERROR' => 'INVALID',
  133. // 'ERROR' => 'ERROR',
  134. ),
  135. );
  136. // This is a list of the types of events you would like
  137. // to have trigger an administrative alert message for.
  138. // It is also where you define the exact text of the
  139. // email messages for each event type.
  140. //
  141. // The supported event types are:
  142. //
  143. // MASS_MAILING
  144. // LOGIN_ERROR
  145. // ERROR
  146. //
  147. // %1 in the message format strings will be replaced with the event name
  148. // %2 in the message format strings will be replaced with the user name
  149. // %3 in the message format strings will be replaced with the domain name
  150. // %4 in the message format strings will be replaced with the remote address value
  151. // %5 in the message format strings will be replaced with the timestamp
  152. // %6 in the message format strings will be replaced with the formatted date
  153. // %7 in the message format strings will be replaced with any comments
  154. //
  155. $sl_send_alerts = array(
  156. // 'MASS_MAILING' => "Possible outgoing spam: by %2 (%3) at %4 on %6: %7",
  157. // 'LOGIN_ERROR' => "Failed webmail login: by %2 (%3) at %4 on %6: %7",
  158. // 'ERROR' => "Webmail error: by %2 (%3) at %4 on %6: %7",
  159. );
  160. // When monitoring outgoing mails for too many recipients,
  161. // this number of recipients must be defined before an
  162. // alert will be triggered (see $sl_send_alerts).
  163. //
  164. $sl_mass_mail_limit = 20;
  165. // Configure the email addresses that alerts are sent to
  166. // for each kind of alert (see $sl_send_alerts).
  167. //
  168. // Each array key is the name of an alert event, and
  169. // the corresponding value is a comma-separated list of
  170. // destination email addresses for the alert.
  171. //
  172. $sl_alert_to = array(
  173. 'MASS_MAILING' => 'postmaster',
  174. 'LOGIN_ERROR' => 'postmaster',
  175. 'ERROR' => 'postmaster',
  176. );
  177. $sl_alert_cc = array(
  178. );
  179. $sl_alert_bcc = array(
  180. );
  181. // This is the address that is placed in the From
  182. // header of alert messages sent ala $sl_send_alerts
  183. //
  184. // You may include the special string "%1" (without
  185. // quotes) if you want the user's current domain to
  186. // be placed in the address.
  187. //
  188. $sl_alert_from = 'noreply@%1';
  189. // This is the subject line of the alert emails, where
  190. // "%1" will be replaced with the name of the event
  191. // and "%2" will be replaced with the username.
  192. //
  193. $sl_alert_subject_template = '[WEBMAIL ALERT] %1 - %2';
  194. // When sending administrative alert messages, you may
  195. // want to send them using different SMTP authentication
  196. // credentials or change any of the other Sendmail or
  197. // SMTP settings used normally in SquirrelMail's normal
  198. // use for sending mail. If so, change the appropriate
  199. // setting here. These values MUST be set to "NULL" to
  200. // indicate that the normal SquirrelMail configuration
  201. // values are to be used.
  202. //
  203. $sl_useSendmail = NULL;
  204. $sl_smtpServerAddress = NULL;
  205. $sl_smtpPort = NULL;
  206. $sl_sendmail_path = NULL;
  207. $sl_sendmail_args = NULL;
  208. $sl_pop_before_smtp = NULL;
  209. $sl_encode_header_key = NULL;
  210. $sl_smtp_auth_mech = NULL;
  211. $sl_smtp_sitewide_user = NULL;
  212. $sl_smtp_sitewide_pass = NULL;
  213. // When MASS_MAILING events occur, should the log message
  214. // include recipient addresses? The Reply-To header? The
  215. // From header? The message subject? The message body?
  216. //
  217. // 1 = yes
  218. // 0 = no
  219. //
  220. // PLEASE NOTE that some of these may be considered
  221. // invasive to your users' privacy and if you turn them on,
  222. // BE SURE your users understand that their messages may be
  223. // subject to review. You are encouraged to have an
  224. // appropriate privacy policy and terms of service agreement
  225. // before you use these.
  226. //
  227. $sl_log_mass_mailing_show_recipients = 0;
  228. $sl_log_mass_mailing_show_from = 0;
  229. $sl_log_mass_mailing_show_reply_to = 0;
  230. $sl_log_mass_mailing_show_subject = 0;
  231. $sl_log_mass_mailing_show_message_body = 0;
  232. // When OUTGOING_MAIL events occur, should the log message
  233. // include recipient addresses? The Reply-To header? The
  234. // From header? The message subject? The message body?
  235. //
  236. // 1 = yes
  237. // 0 = no
  238. //
  239. // PLEASE NOTE that some of these may be considered
  240. // invasive to your users' privacy and if you turn them on,
  241. // BE SURE your users understand that their messages may be
  242. // subject to review. You are encouraged to have an
  243. // appropriate privacy policy and terms of service agreement
  244. // before you use these.
  245. //
  246. $sl_log_outgoing_messages_show_recipients = 0;
  247. $sl_log_outgoing_messages_show_from = 0;
  248. $sl_log_outgoing_messages_show_reply_to = 0;
  249. $sl_log_outgoing_messages_show_subject = 0;
  250. $sl_log_outgoing_messages_show_message_body = 0;
  251. // The location of your log file when logging to file.
  252. // Make sure the user your webserver runs as can write
  253. // to this file. Use the $data_dir variable if you
  254. // want to place the log file in the SquirrelMail data
  255. // directory.
  256. //
  257. // Only applicable when $sl_logs includes "file".
  258. //
  259. $sl_logfile = $data_dir . 'squirrelmail_access_log';
  260. // Specify what date format you want
  261. //
  262. // See the PHP manual for the date function for help
  263. // at http://www.php.net/manual/function.date.php
  264. //
  265. // examples:
  266. //
  267. // 'm/d/y H:i:s' == 03/10/2001 05:16:08
  268. // 'F j, Y, g:i a' == March 10, 2001, 5:16 am
  269. // 'D M j Y H:i:s T' == Sat Mar 10 2001 15:16:08 CDT
  270. //
  271. $sl_dateformat = 'm/d/Y H:i:s';
  272. // Log dates in GMT? If you do not do this, dates will
  273. // be logged in whatever timezone each user is in (or
  274. // has set in their personal preferences)
  275. //
  276. // 1 = yes
  277. // 0 = no
  278. //
  279. $sl_use_GMT = 1;
  280. // Turn hostname lookups on or off
  281. //
  282. // 1 = on
  283. // 0 = off
  284. //
  285. $sl_namelookups = 0;
  286. // If using SQL logging and the database becomes
  287. // unavailable, or your chosen system log facility
  288. // cannot be opened, should the plugin put up an error
  289. // message or should it ignore the error and continue?
  290. //
  291. // 1 = ignore errors
  292. // 0 = show error message and stop
  293. //
  294. $sl_fail_silently = 1;
  295. // Theoretically, any SQL database supported by Pear should be supported
  296. // here. The DSN (data source name) must contain the information needed
  297. // to connect to your database backend. A MySQL example is included below.
  298. // For more details about DSN syntax and list of supported database types,
  299. // please see:
  300. // http://pear.php.net/manual/en/package.database.db.intro-dsn.php
  301. //
  302. $sl_dsn = 'mysql://user:password@localhost/squirrelmail_logging';
  303. // This is the query used to insert a log entry into the database (only
  304. // used if you are using SQL type logging). Adjust to fit your data
  305. // schema as needed
  306. //
  307. // %1 in this query will be replaced with the event name
  308. // %2 in this query will be replaced with the user name
  309. // %3 in this query will be replaced with the domain name
  310. // %4 in this query will be replaced with the remote address value
  311. // %5 in this query will be replaced with the date
  312. // %6 in this query will be replaced with any comments
  313. //
  314. $sl_insert_event_query = 'INSERT INTO user_activity (event, username, domain, remote_address, date, comments) VALUES ("%1", "%2", "%3", "%4", "%5", "%6")';
  315. // You can log to (and alert) only some of the domains
  316. // you may host by using one of the following settings.
  317. //
  318. // $skip_domains provides a list of domains that should
  319. // not be logged to for each event type; all other domains
  320. // will be logged.
  321. //
  322. // $only_log_domains specifies a list of domains that
  323. // should be logged for a given event type; all other
  324. // domains will NOT be logged.
  325. //
  326. // You can use these two settings in tandem, but they may
  327. // NOT have entries for the same event type (doesn't make
  328. // much sense, does it?).
  329. //
  330. // Both of these settings is a list keyed by the event
  331. // types defined in $sl_log_events, where values are lists
  332. // of the domains you want to/don't want to log.
  333. //
  334. // Note that for any of these settings to take effect,
  335. // you must already have turned on logging for the same
  336. // event types in $sl_log_events and $sl_logs.
  337. //
  338. $only_log_domains = array(
  339. // 'LOGIN' => array(),
  340. // 'LOGOUT' => array(),
  341. // 'TIMEOUT' => array(),
  342. // 'OUTGOING_MAIL' => array(),
  343. // 'MASS_MAILING' => array(),
  344. // 'LOGIN_ERROR' => array(),
  345. 'ERROR' => array('example.com'),
  346. );
  347. $skip_domains = array(
  348. 'LOGIN' => array('example.com', 'example2.org'),
  349. 'LOGOUT' => array('example.com', 'example2.org'),
  350. // 'TIMEOUT' => array(),
  351. // 'OUTGOING_MAIL' => array(),
  352. // 'MASS_MAILING' => array(),
  353. // 'LOGIN_ERROR' => array(),
  354. // 'ERROR' => array(),
  355. );