Difference between revisions of "Qpsmtpd connection time"

From SME Server
Jump to navigationJump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Qpsmtpd connection_time plugin==
+
=Qpsmtpd connection_time plugin=
  
 
The qpsmtpd <tt>connection_time</tt> plugin copies an entry into the qpsmtpd log file for each connection showing the total time that the connection was open.
 
The qpsmtpd <tt>connection_time</tt> plugin copies an entry into the qpsmtpd log file for each connection showing the total time that the connection was open.
Line 7: Line 7:
 
HowTo Created By: [[User:Mmccarn|Mmccarn]] 15:56, 26 June 2008 (MDT)
 
HowTo Created By: [[User:Mmccarn|Mmccarn]] 15:56, 26 June 2008 (MDT)
  
===Issues/Problems===
+
==Issues/Problems==
 
* On SME 7.3 using smeserver-qpsmtpd-1.2.1-54.el4.sme, /var/service/qpsmtpd/config/plugins does not appear to be templated.  Installing this plug-in requires editing a configuration file directly (instead of a template); these changes may be lost during normal SME updates or upgrades.
 
* On SME 7.3 using smeserver-qpsmtpd-1.2.1-54.el4.sme, /var/service/qpsmtpd/config/plugins does not appear to be templated.  Installing this plug-in requires editing a configuration file directly (instead of a template); these changes may be lost during normal SME updates or upgrades.
 
* This plug-in creates no output unless it is included in BOTH
 
* This plug-in creates no output unless it is included in BOTH
Line 20: Line 20:
 
** You can set your qpsmtpd LogLevel using<br><tt>config setprop qpsmtpd LogLevel 6</tt>
 
** You can set your qpsmtpd LogLevel using<br><tt>config setprop qpsmtpd LogLevel 6</tt>
  
===Installation===
+
==Installation==
 
There is no plugin-specific configuration required; you need only place the plugin itself into SME's qpsmtpd plugins directory, then add the appropriate invocation to qpsmtpd's plugin configuration files.
 
There is no plugin-specific configuration required; you need only place the plugin itself into SME's qpsmtpd plugins directory, then add the appropriate invocation to qpsmtpd's plugin configuration files.
  
Line 51: Line 51:
 
</nowiki>
 
</nowiki>
  
===Uninstallation===
+
==Uninstallation==
 
If for some reason you want to un-do the changes made by the above script, you need to:
 
If for some reason you want to un-do the changes made by the above script, you need to:
 
  rm -f /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0/01connection_time
 
  rm -f /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0/01connection_time
Line 57: Line 57:
 
  cp /var/service/qpsmtpd/config/plugins.org.connection_time /var/service/qpsmtpd/config/plugins
 
  cp /var/service/qpsmtpd/config/plugins.org.connection_time /var/service/qpsmtpd/config/plugins
 
  rm -f /usr/share/qpsmtpd/plugins/connection_time
 
  rm -f /usr/share/qpsmtpd/plugins/connection_time
 +
signal-event email-update
 +
= PERLDOC =
 +
 +
 +
 +
<span id="_top">[[Qpsmtpd#Plugins]]</span>
 +
== [[#___top|NAME]] ==
 +
 +
connection_time - log the duration of a connection
 +
 +
== [[#___top|DESCRIPTION]] ==
 +
 +
The '''connection_time''' plugin records the time of a connection between the first and the last possible hook in qpsmtpd (''pre-connection'' and ''post-connection'') and writes a <tt>LOGINFO</tt> (default, see below) line to the log.
 +
 +
== [[#___top|CONFIG]] ==
 +
 +
=== [[#___top|loglevel]] ===
 +
 +
Adjust the quantity of logging for this plugin. See [https://github.com/smtpd/qpsmtpd/blob/master/docs/logging.md docs/logging.pod]
 +
<pre> connection_time loglevel +1  (less logging)
 +
 +
connection_time loglevel -1  (more logging)</pre>
 +
<!-- Generated Tue Jul 18 05:51:22 EDT 2017 using
 +
perldoc -T -ohtml /usr/share/qpsmtpd/plugins/connection_time |pandoc -f html -t mediawiki |sed 1 i\\n\n\n<span id="_top">[[Qpsmtpd#Plugins]]</span> |sed -e s#</d.>##
 +
-->
  
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]
 
[[Category:Needs_review]]
 
[[Category:Needs_review]]
 +
[[Category:Qpsmtpd|connection_time]]

Latest revision as of 11:07, 18 July 2017

Qpsmtpd connection_time plugin

The qpsmtpd connection_time plugin copies an entry into the qpsmtpd log file for each connection showing the total time that the connection was open.

Home Page: http://ankh-morp.org/~vetinari/projects/qpsmtpd/

HowTo Created By: Mmccarn 15:56, 26 June 2008 (MDT)

Issues/Problems

  • On SME 7.3 using smeserver-qpsmtpd-1.2.1-54.el4.sme, /var/service/qpsmtpd/config/plugins does not appear to be templated. Installing this plug-in requires editing a configuration file directly (instead of a template); these changes may be lost during normal SME updates or upgrades.
  • This plug-in creates no output unless it is included in BOTH
    • /var/service/qpsmtpd/config/plugins AND
    • /var/service/qpsmtpd/config/peers/<peer_config_file>
  • For SME, this amounts to inclusion in all three of the following plugin files:
    • /var/service/qpsmtpd/config/plugins
    • /var/service/qpsmtpd/config/peers/0
    • /var/service/qpsmtpd/config/peers/local
  • Uses the qpsmtpd LOGINFO log level, which requires SME's qpsmtpd LogLevel to be set to 6 or higher
    • You can verify your qpsmtpd LogLevel using
      config show qpsmtpd LogLevel
    • You can set your qpsmtpd LogLevel using
      config setprop qpsmtpd LogLevel 6

Installation

There is no plugin-specific configuration required; you need only place the plugin itself into SME's qpsmtpd plugins directory, then add the appropriate invocation to qpsmtpd's plugin configuration files.

The script shown here perform all of the required actions automatically. It will also create a backup of /var/service/qpsmtpd/config/plugins in case you encounter any problems.

You can run this script by copying and pasting it from this wiki page into a putty/ssh window logged in to your SME server as root.

# get the plugin itself
cd /usr/share/qpsmtpd/plugins
wget http://ankh-morp.org/~vetinari/qpsmtpd/connection_time
# add invocation to root 'plugins' file
cd /var/service/qpsmtpd/config
if [ -f /var/service/qpsmtpd/config/plugins.org.connection_time ];
 then 
  echo "Using existing backup file"
 else
  mv plugins plugins.org.connection_time
fi
sed s~hosts_allow~connection_time\\nhosts_allow~ plugins.org.connection_time > plugins
# add invocation to peers/0 and peers/local
mkdir -p /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers
cd /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers
mkdir 0
echo connection_time > 0/01connection_time
mkdir local
echo connection_time > local/01connection_time
# activate changes
signal-event email-update


Uninstallation

If for some reason you want to un-do the changes made by the above script, you need to:

rm -f /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0/01connection_time
rm -f /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/local/01connection_time
cp /var/service/qpsmtpd/config/plugins.org.connection_time /var/service/qpsmtpd/config/plugins
rm -f /usr/share/qpsmtpd/plugins/connection_time
signal-event email-update

PERLDOC

Qpsmtpd#Plugins

NAME

connection_time - log the duration of a connection

DESCRIPTION

The connection_time plugin records the time of a connection between the first and the last possible hook in qpsmtpd (pre-connection and post-connection) and writes a LOGINFO (default, see below) line to the log.

CONFIG

loglevel

Adjust the quantity of logging for this plugin. See docs/logging.pod

 connection_time loglevel +1   (less logging)

 connection_time loglevel -1   (more logging)