postfix-logwatch and mail.log in admin.php
This commit is contained in:
parent
5fa794174c
commit
0a91651994
|
@ -11,6 +11,13 @@ RUN docker-php-ext-install intl pdo pdo_mysql xmlrpc
|
|||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
RUN usermod -a -G adm www-data
|
||||
|
||||
COPY postfix-logwatch /postfix-logwatch
|
||||
COPY postfix-logwatch.conf /postfix-logwatch.conf
|
||||
RUN chmod 777 /postfix-logwatch
|
||||
RUN chmod 666 /postfix-logwatch.conf
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,331 @@
|
|||
#
|
||||
# postfix.conf / postfix-logwatch.conf
|
||||
#
|
||||
# This is the postfix-logwatch configuration file.
|
||||
|
||||
# Lines in this file are of the format:
|
||||
#
|
||||
# VAR = VALUE
|
||||
# *VAR = VALUE
|
||||
# $VAR = VALUE
|
||||
#
|
||||
# Whitespace surrounding the = assignment character is removed. Variable names
|
||||
# and values are case insensitive. Double quotes can be used to preserve case and
|
||||
# whitespace.
|
||||
#
|
||||
# Variables beginning with a * are used only by logwatch.
|
||||
# Variables beginning with a $ are used only by the postfix-logwatch filter.
|
||||
# Variables beginning with neither * nor $ are used only by logwatch, with the
|
||||
# exception of the Detail variable which is passed via environment to the
|
||||
# postfix-logwatch filter.
|
||||
#
|
||||
# Any of the equivalent boolean values below may be used where appropriate:
|
||||
#
|
||||
# 1, Yes, True, On
|
||||
# 0, No, False, Off
|
||||
#
|
||||
# Lines that begin with a # are comment lines. Blank and whitespace lines
|
||||
# are ignored. Whitespace at the beginning and end of a line is ignored.
|
||||
#
|
||||
|
||||
# Specifies the title used in the logwatch report
|
||||
#
|
||||
Title = "Postfix"
|
||||
|
||||
# Specifies the logwatch logfile group
|
||||
#
|
||||
LogFile = maillog
|
||||
|
||||
# Specifies the global, maximum detail level
|
||||
#
|
||||
#Detail = 10
|
||||
|
||||
# The *OnlyService selector is used solely by logwatch to select log lines
|
||||
# to pass to the postfix-logwatch filter. And postfix-logwatch uses the
|
||||
# $postfix_Syslog_Name variable for log line selection.
|
||||
#
|
||||
# When used in logwatch, both the *OnlyService and $postfix_Syslog_Name
|
||||
# variables below should contain essentially the same REs so that lines passed
|
||||
# by logwatch are also selected by postfix-logwatch. Note that *OnlyService
|
||||
# also includes the /<postfix service name> (eg. postfix/smtpd).
|
||||
#
|
||||
# If you change postfix's syslog_name for any postfix service, you will need to
|
||||
# replace "postfix" below with an appropriate RE to capture the desired log entries.
|
||||
# Do likewise for *OnlyService above when used under logwatch. For example, the
|
||||
# settings:
|
||||
#
|
||||
# *OnlyService = "postfix\d?/[-a-zA-Z\d]*"
|
||||
# $postfix_Syslog_Name = "postfix\d?"
|
||||
#
|
||||
# will capture postfix/smtpd, postfix2/virtual, ..., postfix9/cleanup
|
||||
#
|
||||
# Note: If you use parenthesis in your regular expression, be sure they
|
||||
# are cloistering and not capturing: use (?:pattern) instead of (pattern).
|
||||
#
|
||||
# Performance Note:
|
||||
# If you do not wish to analyze any or all of postgrey, postfwd, or policyd-spf
|
||||
# consider simplifying $postfix_Syslog_Name to increase log scanning performance. The
|
||||
# more complex the RE, the longer the scan time to select/reject a log line. The
|
||||
# difference in scan times between the simple string 'postfix' and the more complex
|
||||
# alternation RE that includes postfix, postgrey, postfwd and policyd-spf is about 40%.
|
||||
#
|
||||
# Includes: postfix/smtpd, etc, postfix/policy-spf
|
||||
#*OnlyService = "postfix/[-\w]*"
|
||||
#$postfix_Syslog_Name = "postfix"
|
||||
# Includes: postfix/smtpd, etc, postfix/policy-spf, postgrey, postfwd, policyd-spf
|
||||
*OnlyService = "(?:post(?:fix|grey|fwd)|policyd-spf)(?:/[-\w]*)?"
|
||||
$postfix_Syslog_Name = "(?:post(?:fix|grey|fwd)|policyd-spf)"
|
||||
|
||||
# Ignored postfix services
|
||||
#
|
||||
# Ignores postfix services postfix/SERVICE, where SERVICE is an RE
|
||||
# pattern. The example below will ignore log lines whose syslog
|
||||
# name is "postfix/myservice".
|
||||
#$postfix_Ignore_Service = "myservice"
|
||||
|
||||
# Specifies the maximum report width for Detail <= 10,
|
||||
# or when postfix_Line_Style is not set to Truncate
|
||||
#
|
||||
$postfix_Max_Report_Width = 100
|
||||
|
||||
# Specifies how to handle line lengths greater than Max_Report_Width.
|
||||
# Options are Truncate (default), Wrap, or Full.
|
||||
# for Detail <= 10
|
||||
#
|
||||
$postfix_Line_Style = Truncate
|
||||
|
||||
# Set the variable below to the value set for "recipient_delimiter"
|
||||
# in your postfix configuration, if you want your recipient email
|
||||
# addresses split into their user + extension.
|
||||
#
|
||||
#$postfix_Recipient_Delimiter = "+"
|
||||
|
||||
# Width of IP addresses for columnar output. Change to 40 for IPv6 addresses
|
||||
#$postfix_ipaddr_width = 40
|
||||
$postfix_ipaddr_width = 15
|
||||
|
||||
# Switch to use Postfix 2.8 long queue IDs:
|
||||
# Postfix option: enable_long_queue_ids
|
||||
$postfix_Enable_Long_Queue_Ids = No
|
||||
|
||||
# Show delays percentiles report. For command line, use --[no]delays,
|
||||
# without an argument.
|
||||
#
|
||||
$postfix_Show_Delays = Yes
|
||||
|
||||
# Show names of detail section variables/command line options in
|
||||
# detail report titles. For command line, use --[no]sect_vars,
|
||||
# without an argument.
|
||||
#
|
||||
$postfix_Show_Sect_Vars = No
|
||||
|
||||
# Show the postfix-reported hostname of 'unknown' in formatted
|
||||
# ip/hostname pairs. For command line, use --[no]unknown,
|
||||
# without an argument.
|
||||
#
|
||||
$postfix_Show_Unknown = Yes
|
||||
|
||||
# Show the summary section. For command line, use --[no]summary,
|
||||
# without an argument.
|
||||
$postfix_Show_Summary = Yes
|
||||
|
||||
# Specifies the percentiles shown in the delivery delays report
|
||||
# Valid values are from 0 to 100, inclusive.
|
||||
$postfix_Delays_Percentiles = "0 25 50 75 90 95 98 100"
|
||||
|
||||
# Specifies the list of reject sections that will be output in
|
||||
# reports (eg. 5xx permanent or 4xx temporary failures).
|
||||
# Each entry in the comma or whitespace separated list consists of 3
|
||||
# characters, where the first is either 4 or 5, and second and third
|
||||
# are a digit or a dot "." match-anything character. Also allowed is
|
||||
# the keyword "Warn" (which is used for postfix "warn_if_reject" rejects).
|
||||
# In PCRE (perl regular expression) terms, any pattern that matches:
|
||||
#
|
||||
# ^([45][0-9.][0-9.]|Warn)$
|
||||
#
|
||||
# is acceptable.
|
||||
#
|
||||
# Typical reject codes:
|
||||
#
|
||||
# 421 Service not available, closing transmission channel
|
||||
# 450 Requested mail action not taken: mailbox unavailable
|
||||
# 451 Requested action aborted: local error in processing
|
||||
# 452 Requested action not taken: insufficient system storage
|
||||
#
|
||||
# 500 Syntax error, command unrecognized
|
||||
# 501 Syntax error in parameters or arguments
|
||||
# 502 Command not implemented
|
||||
# 503 Bad sequence of commands
|
||||
# 504 Command parameter not implemented
|
||||
# 550 Requested action not taken: mailbox unavailable
|
||||
# 551 User not local; please try <forward-path>
|
||||
# 552 Requested mail action aborted: exceeded storage allocation
|
||||
# 553 Requested action not taken: mailbox name not allowed
|
||||
# 554 Transaction failed
|
||||
#
|
||||
# Specific codes take priority over wildcard patterns. The default list
|
||||
# is: "5.. 4.. Warn".
|
||||
#
|
||||
# See also the various Reject... level limiters below
|
||||
#
|
||||
$postfix_Reject_Reply_Patterns = "5.. 4.. Warn"
|
||||
|
||||
# Level Limiters
|
||||
#
|
||||
# The variables below control the maximum output level for a given
|
||||
# category. A level of 1 indicates only one level of detailed output in
|
||||
# the Detailed report section. The Summary section is only available
|
||||
# at logwatch --Detail level >= 5. Increasing the Detail level
|
||||
# by one adds one level of additional detail in the Summary section.
|
||||
#
|
||||
# For example, Detail 5 would output one additional level of detail,
|
||||
# Detail 6 two levels, etc. all the way up to 10. Finally, Detail
|
||||
# 11 yields uncropped lines of output.
|
||||
#
|
||||
# You can control the maximum number of level 1 lines by appending
|
||||
# a period and a number. The value 2.10 would indicate 2 levels
|
||||
# of detail, but only 10 level-1 lines. For example, setting
|
||||
# $postfix_Sent = 1.20 yields a top 20 list of Messages Sent.
|
||||
#
|
||||
# A more useful form of limiting uses triplets in the form l:n:t.
|
||||
# This triplet specifies level l, top n, and minimum threshold t.
|
||||
# Each of the values are integers, with l being the level limiter
|
||||
# as described above, n being a top n limiter for the level l, and
|
||||
# t being the threshold limiter for level l. When both n and t
|
||||
# are specified, n has priority, allowing top n lists (regardless
|
||||
# of threshold value). If the value of l is omitted, the speci-
|
||||
# fied values for n and/or t are used for all levels available in
|
||||
# the sub-section. This permits a simple form of wildcarding (eg.
|
||||
# place minimum threshold limits on all levels). However, spe-
|
||||
# cific limiters always override wildcard limiters. The first
|
||||
# form of level limiter may be included in levelspec to restrict
|
||||
# output, regardless of how many triplets are present.
|
||||
|
||||
$postfix_Sent = 10
|
||||
$postfix_SentLmtp = 10
|
||||
$postfix_Delivered = 10
|
||||
$postfix_Forwarded = 10
|
||||
$postfix_ConnectionLostInbound = 1
|
||||
$postfix_TimeoutInbound = 1
|
||||
$postfix_ConnectToFailure = 2
|
||||
|
||||
# Disabled by default to reduce noise and consume less memory.
|
||||
# Enable at will
|
||||
$postfix_EnvelopeSenders = 1
|
||||
$postfix_EnvelopeSenderDomains = 1
|
||||
$postfix_ConnectionInbound = 0
|
||||
# Reject by IP report
|
||||
$postfix_ByIpRejects = 1
|
||||
|
||||
$postfix_PanicError = 10
|
||||
$postfix_FatalError = 10
|
||||
$postfix_Error = 10
|
||||
# warnings
|
||||
$postfix_Anvil = 3
|
||||
$postfix_AttrError = 10
|
||||
$postfix_CommunicationError = 10
|
||||
$postfix_DatabaseGeneration = 10
|
||||
$postfix_DNSError = 10
|
||||
$postfix_HeloError = 10
|
||||
$postfix_HostnameValidationError = 10
|
||||
$postfix_HostnameVerification = 10
|
||||
$postfix_IllegalAddrSyntax = 10
|
||||
$postfix_LdapError = 10
|
||||
$postfix_MailerLoop = 10
|
||||
$postfix_MapProblem = 10
|
||||
$postfix_MessageWriteError = 10
|
||||
$postfix_NumericHostname = 10
|
||||
$postfix_ProcessExit = 10
|
||||
$postfix_ProcessLimit = 10
|
||||
$postfix_QueueWriteError = 10
|
||||
$postfix_RBLError = 10
|
||||
$postfix_SaslAuthFail = 10
|
||||
$postfix_SmtpConversationError = 10
|
||||
$postfix_StartupError = 10
|
||||
$postfix_WarningsOther = 10
|
||||
|
||||
# Common access control actions
|
||||
$postfix_Bcced = 10
|
||||
$postfix_Discarded = 10
|
||||
$postfix_Filtered = 10
|
||||
$postfix_Hold = 10
|
||||
$postfix_Prepended = 10
|
||||
$postfix_Redirected = 10
|
||||
$postfix_Replaced = 3
|
||||
$postfix_Warned = 10
|
||||
# DUNNO action not logged
|
||||
# IGNORE action not logged
|
||||
# REJECT actions are below
|
||||
|
||||
# Rejects
|
||||
# The following are generic reject types, which are automatically
|
||||
# expanded into each reject variant, based on the reply patterns
|
||||
# listed in Reject_Reply_Patterns. By default, each item in the
|
||||
# list below becomes 4xxReject..., 5xxReject..., and WarnReject...
|
||||
$postfix_RejectBody = 10
|
||||
$postfix_RejectClient = 10
|
||||
$postfix_RejectConfigError = 10
|
||||
$postfix_RejectContent = 10
|
||||
$postfix_RejectData = 10
|
||||
$postfix_RejectEtrn = 10
|
||||
$postfix_RejectHeader = 10
|
||||
$postfix_RejectHelo = 10
|
||||
$postfix_RejectInsufficientSpace = 10
|
||||
$postfix_RejectLookupFailure = 10
|
||||
$postfix_RejectMilter = 10
|
||||
$postfix_RejectProxy = 10
|
||||
$postfix_RejectRBL = 10
|
||||
$postfix_RejectRecip = 10
|
||||
$postfix_RejectRelay = 10
|
||||
$postfix_RejectSender = 10
|
||||
$postfix_RejectSize = 10
|
||||
$postfix_RejectUnknownClient = 10
|
||||
$postfix_RejectUnknownReverseClient = 10
|
||||
$postfix_RejectUnknownUser = 10
|
||||
$postfix_RejectUnverifiedClient = 3
|
||||
$postfix_RejectVerify = 10
|
||||
|
||||
# For more precise control, you can comment out any of the reject
|
||||
# types above and specify each variant manually, but the list must
|
||||
# be consistent with the values specified in Reject_Reply_Patterns.
|
||||
#
|
||||
# For example, you could comment out $postfix_RejectHelo above, and
|
||||
# instead uncomment the three RejectHelo variants, allowing you to
|
||||
# specify different level limiters to each variant:
|
||||
#
|
||||
# Permanent 5xx variant
|
||||
# $postfix_5xxRejectHelo = 1
|
||||
# Temporary 4xx variant
|
||||
# $postfix_4xxRejectHelo = 2
|
||||
# Warn_if_reject variant
|
||||
# $postfix_WarnRejectHelo = 2
|
||||
#
|
||||
|
||||
$postfix_Deferred = 10
|
||||
$postfix_Deferrals = 10
|
||||
$postfix_BounceLocal = 10
|
||||
$postfix_BounceRemote = 10
|
||||
|
||||
$postfix_Discarded = 10
|
||||
$postfix_ReturnedToSender = 10
|
||||
$postfix_NotificationSent = 10
|
||||
$postfix_ConnectionLostOutbound = 10
|
||||
|
||||
$postfix_Deliverable = 10
|
||||
$postfix_Undeliverable = 10
|
||||
$postfix_PixWorkaround = 10
|
||||
$postfix_SaslAuth = 10
|
||||
$postfix_TlsServerConnect = 10
|
||||
$postfix_TlsClientConnect = 10
|
||||
$postfix_TlsUnverified = 10
|
||||
$postfix_TlsOffered = 10
|
||||
$postfix_SMTPProtocolViolation = 10
|
||||
|
||||
$postfix_Postscreen = 1
|
||||
$postfix_DNSBLog = 1
|
||||
|
||||
$postfix_PolicySPF = 10
|
||||
$postfix_PolicydWeight = 10
|
||||
$postfix_Postgrey = 10
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
|
@ -247,6 +247,29 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h4><span class="glyphicon glyphicon-dashboard" aria-hidden="true"></span> <?=$lang['admin']['maintenance'];?></h4>
|
||||
<div class="panel-group" id="accordion_maint">
|
||||
<div class="panel panel-default">
|
||||
<div style="cursor:pointer;" class="panel-heading" data-toggle="collapse" data-parent="#accordion_maint" data-target="#collapseSysinfo">
|
||||
<span class="accordion-toggle"><?=$lang['admin']['sys_info'];?></span>
|
||||
<a type="submit" class="btn btn-default" href="/"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Refresh</a>
|
||||
</div>
|
||||
<div id="collapseSysinfo" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<legend><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Postfix Details</legend>
|
||||
<!-- <legend>Postqueue</legend>-->
|
||||
<!-- <pre>--><?php //echo sys_info("mailq");?><!--</pre>-->
|
||||
|
||||
<legend>Postfix-Logwatch</legend>
|
||||
<textarea rows="20" style="font-family:monospace;font-size:9pt;width:100%;"><?php echo sys_info("pflog");?></textarea>
|
||||
|
||||
<legend>Mail Log</legend>
|
||||
<textarea rows="20" style="font-family:monospace;font-size:9pt;width:100%;"><?php echo sys_info("maillog");?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" integrity="sha384-YWP9O4NjmcGo4oEJFXvvYSEzuHIvey+LbXkBNJ1Kd0yfugEZN9NCQNpRYBVC1RvA" crossorigin="anonymous"></script>
|
||||
|
|
|
@ -2751,4 +2751,20 @@ function is_valid_domain_name($domain_name) {
|
|||
&& preg_match("/^.{1,253}$/", $domain_name)
|
||||
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name));
|
||||
}
|
||||
function sys_info($what) {
|
||||
switch ($what) {
|
||||
|
||||
case "pflog":
|
||||
return shell_exec("/postfix-logwatch -f /postfix-logwatch.conf /var/postfix-log/mail.log");
|
||||
break;
|
||||
|
||||
case "mailq":
|
||||
// return shell_exec("mailq");
|
||||
break;
|
||||
|
||||
case "maillog":
|
||||
return shell_exec("tail -1000 /var/postfix-log/mail.log");
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -77,6 +77,7 @@ services:
|
|||
- ./data/web:/web:ro
|
||||
- ./data/conf/rspamd/dynmaps:/dynmaps:ro
|
||||
- dkim-vol-1:/data/dkim
|
||||
- var-vol-1:/var/postfix-log/
|
||||
dns:
|
||||
- 172.22.1.254
|
||||
dns_search: mailcow-network
|
||||
|
@ -165,6 +166,7 @@ services:
|
|||
volumes:
|
||||
- ./data/conf/postfix:/opt/postfix/conf
|
||||
- ./data/assets/ssl:/etc/ssl/mail/:ro
|
||||
- var-vol-1:/var/log/
|
||||
environment:
|
||||
- DBNAME=${DBNAME}
|
||||
- DBUSER=${DBUSER}
|
||||
|
@ -236,3 +238,4 @@ volumes:
|
|||
dkim-vol-1:
|
||||
redis-vol-1:
|
||||
rspamd-vol-1:
|
||||
var-vol-1:
|
||||
|
|
Loading…
Reference in New Issue