.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::SpamAssassin::Plugin::TxRep 3pm" .TH Mail::SpamAssassin::Plugin::TxRep 3pm "2022-09-10" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::SpamAssassin::Plugin::TxRep \- Normalize scores with sender reputation records .SH "SYNOPSIS" .IX Header "SYNOPSIS" The TxRep (Reputation) plugin is designed as an improved replacement of the \s-1AWL\s0 (Auto-Welcomelist) plugin. It adjusts the final message spam score by looking up and taking in consideration the reputation of the sender. .PP To try TxRep out, you \fBhave to\fR first disable the \s-1AWL\s0 plugin (if enabled), and back up its database. \s-1AWL\s0 is loaded in v310.pre and can be disabled by commenting out the loadplugin line: .PP .Vb 1 \& # loadplugin Mail::SpamAssassin::Plugin::AWL .Ve .PP When \s-1AWL\s0 is not disabled, TxRep will refuse to run. .PP TxRep should be enabled by uncommenting the following line in v341.pre: .PP .Vb 1 \& loadplugin Mail::SpamAssassin::Plugin::TxRep .Ve .PP Use the supplied 60_txreputation.cf file or add these lines to a .cf file: .PP .Vb 4 \& header TXREP eval:check_senders_reputation() \& describe TXREP Score normalizing based on sender\*(Aqs reputation \& tflags TXREP userconf noautolearn \& priority TXREP 1000 .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This plugin is intended to replace the former \s-1AWL\s0 \- AutoWelcomeList. Although the concept and the scope differ, the purpose remains the same \- the normalizing of spam score results based on previous sender's history. The name was intentionally changed from \*(L"whitelist\*(R" to \*(L"reputation\*(R" to avoid any confusion, since the result score can be adjusted in both directions. .PP The TxRep plugin keeps track of the average SpamAssassin score for senders. Senders are tracked using multiple identificators, or their combinations: the From: email address, the originating \s-1IP\s0 and/or an originating block of IPs, sender's domain name, the \s-1DKIM\s0 signature, and the \s-1HELO\s0 name. TxRep then uses the average score to reduce the variability in scoring from message to message, and modifies the final score by pushing the result towards the historical average. This improves the accuracy of filtering for most email. .PP In comparison with the original \s-1AWL\s0 plugin, several conceptual changes were implemented in TxRep: .PP 1. \fBScoring\fR \- at \s-1AWL,\s0 although it tracks the number of messages received from each respective sender, when calculating the corrective score at a new message, it does not take it in count in any way. So for example a sender who previously sent a single ham message with the score of \-5, and then sends a second one with the score of +10, \&\s-1AWL\s0 will issue a corrective score bringing the score towards the \-5. With the default \&\f(CW\*(C`auto_welcomelist_factor\*(C'\fR of 0.5, the resulting score would be only 2.5. And it would be exactly the same even if the sender previously sent 1,000 messages with the average of \&\-5. TxRep tries to take the maximal advantage of the collected data, and adjusts the final score not only with the mean reputation score stored in the database, but also respecting the number of messages already seen from the sender. You can see the exact formula in the section "\f(CW\*(C`txrep_factor\*(C'\fR". .PP 2. \fBLearning\fR \- \s-1AWL\s0 ignores any spam/ham learning. In fact it acts against it, which often leads to a frustrating situation, where a user repeatedly tags all messages of a given sender as spam (resp. ham), but at any new message from the sender, \s-1AWL\s0 will adjust the score of the message back to the historical average which does \fBnot\fR include the learned scores. This is now changed at TxRep, and every spam/ham learning will be recorded in the reputation database, and hence taken in consideration at future email from the respective sender. See the section \*(L"\s-1LEARNING SPAM / HAM\*(R"\s0 for more details. .PP 3. \fBAuto-Learning\fR \- in certain situations SpamAssassin may declare a message an obvious spam resp. ham, and launch the auto-learning process, so that the message can be re-evaluated. \s-1AWL,\s0 by design, did not perform any auto-learning adjustments. This plugin will readjust the stored reputation by the value defined by "\f(CW\*(C`txrep_learn_penalty\*(C'\fR" resp. "\f(CW\*(C`txrep_learn_bonus\*(C'\fR". Auto-learning score thresholds may be tuned, or the auto-learning completely disabled, through the setting "\f(CW\*(C`txrep_autolearn\*(C'\fR". .PP 4. \fBRelearning\fR \- messages that were wrongly learned or auto-learned, can be relearned. Old reputations are removed from the database, and new ones added instead of them. The relearning works better when message tracking is enabled through the "\f(CW\*(C`txrep_track_messages\*(C'\fR" option. Without it, the relearned score is simply added to the reputation, without removing the old ones. .PP 5. \fBAging\fR \- with \s-1AWL,\s0 any historical record of given sender has the same weight. It means that changes in senders behavior, or modified \s-1SA\s0 rules may take long time, or be virtually negated by the \s-1AWL\s0 normalization, especially at senders with high count of past messages, and low recent frequency. It also turns to be particularly counterproductive when the administrator detects new patterns in certain messages, and applies new rules to better tag such messages as spam or ham. \s-1AWL\s0 will practically eliminate the effect of the new rules, by adjusting the score back towards the (wrong) historical average. Only setting the \f(CW\*(C`auto_welcomelist_factor\*(C'\fR lower would help, but in the same time it would also reduce the overall impact of \s-1AWL,\s0 and put doubts on its purpose. TxRep, besides the "\f(CW\*(C`txrep_factor\*(C'\fR" (replacement of the \f(CW\*(C`auto_welcomelist_factor\*(C'\fR), introduces also the "\f(CW\*(C`txrep_dilution_factor\*(C'\fR" to help coping with this issue by progressively reducing the impact of past records. More details can be found in the description of the factor below. .PP 6. \fBBlocklisting and Welcomelisting\fR \- when a welcomelisting or blocklisting was requested through SpamAssassin's \s-1API, AWL\s0 adjusts the historical total score of the plain email address without \s-1IP\s0 (and deleted records bound to an \s-1IP\s0), but since during the reception new records with \s-1IP\s0 will be added, the blocklisted entry would cease acting during scanning. TxRep always uses the record of the plain email address without \s-1IP\s0 together with the one bound to an \s-1IP\s0 address, \s-1DKIM\s0 signature, or \s-1SPF\s0 pass (unless the weight factor for the \s-1EMAIL\s0 reputation is set to zero). \s-1AWL\s0 uses the score of 100 (resp. \-100) for the blocklisting (resp. welcomelisting) purposes. TxRep increases the value proportionally to the weight factor of the \s-1EMAIL\s0 reputation. It is explained in details in the section \*(L" \s-1WELCOMELISTING\*(R"\s0 in \s-1BLOCKLISTING\s0 . TxRep can blocklist or welcomelist also \&\s-1IP\s0 addresses, domain names, and dotless \s-1HELO\s0 names. .PP 7. \fBSender Identification\fR \- \s-1AWL\s0 identifies a sender on the basis of the email address used, and the originating \s-1IP\s0 address (better told its part defined by the mask setting). The main purpose of this measure is to avoid assigning false good scores to spammers who spoof known email addresses. The disadvantage appears at senders who send from frequently changing locations or even when connecting through dynamical \s-1IP\s0 addresses that are not within the block defined by the mask setting. Their score is difficult or sometimes impossible to track. Another disadvantage is, for example, at a spammer persistently sending spam from the same \s-1IP\s0 address, just under different email addresses. \s-1AWL\s0 will not find his previous scores, unless he reuses the same email address again. TxRep uses several identificators, and creates separate database entries for each of them. It tracks not only the email/IP address combination like \s-1AWL,\s0 but also the standalone email address (regardless of the originating \s-1IP\s0), the standalone \s-1IP\s0 (regardless of email address used), the domain name of the email address, the \s-1DKIM\s0 signature, and the \s-1HELO\s0 name of the connecting \s-1PC.\s0 The influence of each individual identificator may be tuned up with the help of weight factors described in the section \*(L"\s-1REPUTATION WEIGHTS\*(R"\s0. .PP 8. \fBMessage Tracking\fR \- TxRep (optionally) keeps track of already scanned and/or learned message \s-1ID\s0's. This is useful for avoiding to strengthen the reputation score by simply rescanning or relearning the same message multiple times. In the same time it also allows the proper relearning of once wrongly learned messages, or relearning them after the learn penalty or bonus were changed. See the option "\f(CW\*(C`txrep_track_messages\*(C'\fR". .PP 9. \fBUser and Global Storages\fR \- usually it is recommended to use the per-user setup of SpamAssassin, because each user may have quite different requirements, and may receive quite different sort of email. Especially when using the Bayesian and \s-1AWL\s0 plugins, the efficiency is much better when SpamAssassin is learned spam and ham separately for each user. However, the disadvantage is that senders and emails already learned many times by different users, will need to be relearned without any recognized history, anytime they arrive to another user. TxRep uses the advantages of both systems. It can use dual storages: the global common storage, where all email processed by SpamAssassin is recorded, and a local storage separate for each user, with reputation data from his email only. See more details at the setting "\f(CW\*(C`txrep_user2global_ratio\*(C'\fR". .PP 10. \fBOutbound Welcomelisting\fR \- when a local user sends messages to an email address, we assume that he needs to see the eventual answer too, hence the recipient's address should be welcomelisted. When SpamAssassin is used for scanning outgoing email too, when local users use the \s-1SMTP\s0 server where \s-1SA\s0 is installed, for sending email, and when internal networks are defined, TxREP will improve the reputation of all 'To:' and '\s-1CC\s0' addresses from messages originating in the internal networks. Details can be found at the setting "\f(CW\*(C`txrep_welcomelist_out\*(C'\fR". .PP Both plugins (\s-1AWL\s0 and TxREP) cannot coexist. It is necessary to disable the \s-1AWL\s0 to allow TxRep running. TxRep reuses the database handling of the original \s-1AWL\s0 module, and some its parameters bound to the database handler modules. By default, TxRep creates its own database, but the original auto-welcomelist can be reused as a starting point. The \s-1AWL\s0 database can be renamed to the name defined in TxRep settings, and TxRep will start using it. The original auto-welcomelist database has to be backed up, to allow switching back to the original state. .PP The spamassassin/Plugin/TxRep.pm file replaces both spamassassin/Plugin/AWL.pm and spamassassin/AutoWelcomelist.pm. Another two \s-1AWL\s0 files, spamassassin/DBBasedAddrList.pm and spamassassin/SQLBasedAddrList.pm are still needed. .SH "TEMPLATE TAGS" .IX Header "TEMPLATE TAGS" This plugin module adds the following \f(CW\*(C`tags\*(C'\fR that can be used as placeholders in certain options. See Mail::SpamAssassin::Conf for more information on \s-1TEMPLATE TAGS.\s0 .PP .Vb 5 \& _TXREPXXXY_ TXREP modifier \& _TXREPXXXYMEAN_ Mean score on which TXREP modification is based \& _TXREPXXXYCOUNT_ Number of messages on which TXREP modification is based \& _TXREPXXXYPRESCORE_ Score before TXREP \& _TXREPXXXYUNKNOWN_ New sender (not found in the TXREP list) .Ve .PP The \s-1XXX\s0 part of the tag takes the form of one of the following IDs, depending on the reputation checked: \s-1EMAIL, EMAILIP, IP, DOMAIN,\s0 or \s-1HELO.\s0 The Y appendix \&\s-1ID\s0 is used only in the case of dual storage, and takes the form of either U (for user storage reputations), or G (for global storage reputations). .SH "USER PREFERENCES" .IX Header "USER PREFERENCES" The following options can be used in both site-wide (\f(CW\*(C`local.cf\*(C'\fR) and user-specific (\f(CW\*(C`user_prefs\*(C'\fR) configuration files to customize how SpamAssassin handles incoming email messages. .IP "\fBuse_txrep\fR" 4 .IX Item "use_txrep" .Vb 1 \& 0 | 1 (default: 0) .Ve .Sp Whether to use TxRep reputation system. TxRep tracks the long-term average score for each sender and then shifts the score of new messages toward that long-term average. This can increase or decrease the score for messages, depending on the long-term behavior of the particular correspondent. .Sp Note that certain tests are ignored when determining the final message score: .Sp .Vb 1 \& \- rules with tflags set to \*(Aqnoautolearn\*(Aq .Ve .IP "\fBtxrep_factor\fR" 4 .IX Item "txrep_factor" .Vb 1 \& range [0..1] (default: 0.5) .Ve .Sp How much towards the long-term mean for the sender to regress a message. Basically, the algorithm is to track the long-term total score and the count of messages for the sender (\f(CW\*(C`total\*(C'\fR and \f(CW\*(C`count\*(C'\fR), and then once we have otherwise fully calculated the score for this message (\f(CW\*(C`score\*(C'\fR), we calculate the final score for the message as: .Sp .Vb 1 \& finalscore = score + factor * (total + score)/(count + 1) .Ve .Sp So if \f(CW\*(C`factor\*(C'\fR = 0.5, then we'll move to half way between the calculated score and the new mean value. If \f(CW\*(C`factor\*(C'\fR = 0.3, then we'll move about 1/3 of the way from the score toward the mean. \f(CW\*(C`factor\*(C'\fR = 1 means use the long-term mean including also the new unadjusted score; \f(CW\*(C`factor\*(C'\fR = 0 mean just use the calculated score, disabling so the score averaging, though still recording the reputation to the database. .IP "\fBtxrep_dilution_factor\fR" 4 .IX Item "txrep_dilution_factor" .Vb 1 \& range [0.7..1.0] (default: 0.98) .Ve .Sp At any new email from given sender, the historical reputation records are \*(L"diluted\*(R", or \*(L"watered down\*(R" by certain fraction given by this factor. It means that the influence of old records will progressively diminish with every new message from given sender. This is important to allow a more flexible handling of changes in sender's behavior, or new improvements or changes of local \s-1SA\s0 rules. .Sp Without any dilution expiry (dilution factor set to 1), the new message score is simply add to the total score of given sender in the reputation database. When dilution is used (factor < 1), the impact of the historical reputation average is reduced by the factor before calculating the new average, which in turn is then used to adjust the new total score to be stored in the database. .Sp .Vb 1 \& newtotal = (oldcount + 1) * (newscore + dilution * oldtotal) / (dilution * oldcount + 1) .Ve .Sp In other words, it means that the older a message is, the less and less impact on the new average its original spam score has. For example if we set the factor to 0.9 (meaning dilution by 10%), the score of the new message will be recorded to its 100%, the last score of the same sender to 90%, the second last to 81% (0.9 * 0.9 = 0.81), and for example the 10th last message just to 35%. .Sp At stable systems, we recommend keeping the factor close to 1 (but still lower than 1). At systems where \s-1SA\s0 rules tuning and spam learning is still in progress, lower factors will help the reputation to quicker adapt any modifications. In the same time, it will also reduce the impact of the historical reputation though. .IP "\fBtxrep_learn_penalty\fR" 4 .IX Item "txrep_learn_penalty" .Vb 1 \& range [0..200] (default: 20) .Ve .Sp When SpamAssassin is trained a \s-1SPAM\s0 message, the given penalty score will be added to the total reputation score of the sender, regardless of the real spam score. The impact of the penalty will be the smaller the higher is the number of messages that the sender already has in the TxRep database. .IP "\fBtxrep_learn_bonus\fR" 4 .IX Item "txrep_learn_bonus" .Vb 1 \& range [0..200] (default: 20) .Ve .Sp When SpamAssassin is trained a \s-1HAM\s0 message, the given penalty score will be deduced from the total reputation score of the sender, regardless of the real spam score. The impact of the penalty will be the smaller the higher is the number of messages that the sender already has in the TxRep database. .IP "\fBtxrep_autolearn\fR" 4 .IX Item "txrep_autolearn" .Vb 1 \& range [0..5] (default: 0) .Ve .Sp When SpamAssassin declares a message a clear spam resp. ham during the message scan, and launches the auto-learn process, sender reputation scores of given message will be adjusted by the value of the option "\f(CW\*(C`txrep_learn_penalty\*(C'\fR", resp. the "\f(CW\*(C`txrep_learn_bonus\*(C'\fR" in the same way as during the manual learning. Value 0 at this option disables the auto-learn reputation adjustment \- only the score calculated before the auto-learn will be stored to the reputation database. .IP "\fBtxrep_track_messages\fR" 4 .IX Item "txrep_track_messages" .Vb 1 \& 0 | 1 (default: 1) .Ve .Sp Whether TxRep should keep track of already scanned and/or learned messages. When enabled, an additional record in the reputation database will be created to avoid false score adjustments due to repeated scanning of the same message, and to allow proper relearning of messages that were either previously wrongly learned, or need to be relearned after modifying the learn penalty or bonus. .IP "\fBtxrep_welcomelist_out\fR" 4 .IX Item "txrep_welcomelist_out" .Vb 1 \& range [0..200] (default: 10) .Ve .Sp Previously txrep_whitelist_out which will work interchangeably until 4.1. .Sp When the value of this setting is greater than zero, recipients of messages sent from within the internal networks will be welcomelisted through improving their total reputation score with the number of points defined by this setting. Since the \s-1IP\s0 address and other sender identificators are not known when sending the email, only the reputation of the standalone email is being welcomelisted. The domain name is intentionally also left unaffected. The outbound welcomelisting can only work when SpamAssassin is set up to scan also outgoing email, when local users use the \s-1SMTP\s0 server for sending email, and when \&\f(CW\*(C`internal_networks\*(C'\fR are defined in SpamAssassin configuration. The improving of the reputation happens at every message sent from internal networks, so the more messages is being sent to the recipient, the better reputation his email address will have. .IP "\fBtxrep_ipv4_mask_len\fR" 4 .IX Item "txrep_ipv4_mask_len" .Vb 1 \& range [0..32] (default: 16) .Ve .Sp The \s-1AWL\s0 database keeps only the specified number of most-significant bits of an IPv4 address in its fields, so that different individual \s-1IP\s0 addresses within a subnet belonging to the same owner are managed under a single database record. As we have no information available on the allocated address ranges of senders, this \s-1CIDR\s0 mask length is only an approximation. The default is 16 bits, corresponding to a former class B. Increase the number if a finer granularity is desired, e.g. to 24 (class C) or 32. A value 0 is allowed but is not particularly useful, as it would treat the whole internet as a single organization. The number need not be a multiple of 8, any split is allowed. .IP "\fBtxrep_ipv6_mask_len\fR" 4 .IX Item "txrep_ipv6_mask_len" .Vb 1 \& range [0..128] (default: 48) .Ve .Sp The \s-1AWL\s0 database keeps only the specified number of most-significant bits of an IPv6 address in its fields, so that different individual \s-1IP\s0 addresses within a subnet belonging to the same owner are managed under a single database record. As we have no information available on the allocated address ranges of senders, this \s-1CIDR\s0 mask length is only an approximation. The default is 48 bits, corresponding to an address range commonly allocated to individual (smaller) organizations. Increase the number for a finer granularity, e.g. to 64 or 96 or 128, or decrease for wider ranges, e.g. 32. A value 0 is allowed but is not particularly useful, as it would treat the whole internet as a single organization. The number need not be a multiple of 4, any split is allowed. .IP "\fBuser_awl_sql_override_username\fR" 4 .IX Item "user_awl_sql_override_username" .Vb 1 \& string (default: undefined) .Ve .Sp Used by the SQLBasedAddrList storage implementation. .Sp If this option is set the SQLBasedAddrList module will override the set username with the value given. This can be useful for implementing global or group based TxRep databases. .IP "\fBtxrep_user2global_ratio\fR" 4 .IX Item "txrep_user2global_ratio" .Vb 1 \& range [0..10] (default: 0) .Ve .Sp When the option txrep_user2global_ratio is set to a value greater than zero, and if the server configuration allows it, two data storages will be used \- user and global (server-wide) storages. .Sp User storage keeps only senders who send messages to the respective recipient, and will reflect also the corrected/learned scores, when some messages are marked by the user as spam or ham, or when the sender is welcomelisted or blocklisted through the \s-1API\s0 of SpamAssassin. .Sp Global storage keeps the reputation data of all messages processed by SpamAssassin with their spam scores and spam/ham learning data from all users on the server. Hence, the module will return a reputation value even at senders not known to the current recipient, as long as he already sent email to anyone else on the server. .Sp The value of the txrep_user2global_ratio parameter controls the impact of each of the two reputations. When equal to 1, both the global and the user score will have the same impact on the result. When set to 2, the reputation taken from the user storage will have twice the impact of the global value. The final value of the \s-1TXREP\s0 tag will be calculated as follows: .Sp .Vb 1 \& total = ( ratio * user + global ) / ( ratio + 1 ) .Ve .Sp When no reputation is found in the user storage, and a global reputation is available, the global storage is used fully, without applying the ratio. .Sp When the ratio is set to zero, only the default storage will be used. And it then depends whether you use the global, or the local user storage by default, which in turn is controlled either by the parameter user_awl_sql_override_username (in case of \s-1SQL\s0 storage), or the \f(CW\*(C`/auto_welcomelist_path\*(C'\fR parameter (in case of Berkeley database). .Sp When this dual storage is enabled, and no global storage is defined by the above mentioned parameters for the Berkeley or \s-1SQL\s0 databases, TxRep will attempt to use a generic storage \- user '\s-1GLOBAL\s0' in case of \s-1SQL,\s0 and in the case of Berkeley database it uses the path defined by '_\|_local_state_dir_\|_/tx\-reputation', which typically renders into /var/db/spamassassin/tx\-reputation. When the default storages are not available, or are not writable, you would have to set the global storage with the help of the \f(CW\*(C`user_awl_sql_override_username\*(C'\fR resp. \&\f(CW\*(C`auto_welcomelist_path settings\*(C'\fR. .Sp Please note that some SpamAssassin installations run always under the same user \&\s-1ID.\s0 In such case it is pointless enabling the dual storage, because it would maximally lead to two identical global storages in different locations. .Sp This feature is disabled by default. .IP "\fBauto_welcomelist_distinguish_signed\fR (default: 1 \- enabled)" 4 .IX Item "auto_welcomelist_distinguish_signed (default: 1 - enabled)" Previously auto_welcomelist_distinguish_signed which will work interchangeably until 4.1. .Sp Used by the SQLBasedAddrList storage implementation. .Sp If this option is set the SQLBasedAddrList module will keep separate database entries for DKIM-validated e\-mail addresses and for non-validated ones. Without this option, or for domains that do not use a \s-1DKIM\s0 signature, the reputation of legitimate email can get mixed with the reputation of forgeries. A pre-requisite when setting this option is that a field txrep.signedby exists in a \s-1SQL\s0 table, otherwise \s-1SQL\s0 operations will fail. A \s-1DKIM\s0 plugin must also be enabled in order for this option to take effect. This option is highly recommended. Unless you are using a pre\-3.3.0 database schema and cannot upgrade, there is no reason to disable this option. If you are upgrading from \s-1AWL\s0 and using a pre\-3.3.0 schema, the txrep.signedby column will not exist. It is recommended that you add this column, but if that is not possible you must set this option to 0 to avoid \s-1SQL\s0 errors. .IP "\fBtxrep_spf\fR" 4 .IX Item "txrep_spf" .Vb 1 \& 0 | 1 (default: 1) .Ve .Sp When enabled, TxRep will treat any \s-1IP\s0 address using a given email address as the same authorized identity, and will not associate any \s-1IP\s0 address with it. (The same happens with valid \s-1DKIM\s0 signatures. No option available for \s-1DKIM\s0). .Sp Note: at domains that define the useless \s-1SPF\s0 +all (pass all), no \s-1IP\s0 would be ever associated with the email address, and all addresses (incl. the forged ones) would be treated as coming from the authorized source. However, such domains are hopefully rare, and ask for this kind of treatment anyway. .SS "\s-1REPUTATION WEIGHTS\s0" .IX Subsection "REPUTATION WEIGHTS" The overall reputation of the sender comprises several elements: .IP "1) The reputation of the 'From' email address bound to the originating \s-1IP\s0 address fraction (see the mask parameters for details)" 4 .IX Item "1) The reputation of the 'From' email address bound to the originating IP address fraction (see the mask parameters for details)" .PD 0 .IP "2) The reputation of the 'From' email address alone (regardless the \s-1IP\s0 address being currently used)" 4 .IX Item "2) The reputation of the 'From' email address alone (regardless the IP address being currently used)" .IP "3) The reputation of the domain name of the 'From' email address" 4 .IX Item "3) The reputation of the domain name of the 'From' email address" .IP "4) The reputation of the originating \s-1IP\s0 address, regardless of sender's email address" 4 .IX Item "4) The reputation of the originating IP address, regardless of sender's email address" .IP "5) The reputation of the \s-1HELO\s0 name of the originating computer (if available)" 4 .IX Item "5) The reputation of the HELO name of the originating computer (if available)" .PD .PP Each of these partial reputations is weighted with the help of these parameters, and the overall reputation is calculation as the sum of the individual reputations divided by the sum of all their weights: .PP .Vb 5 \& sender_reputation = weight_email * rep_email + \& weight_email_ip * rep_email_ip + \& weight_domain * rep_domain + \& weight_ip * rep_ip + \& weight_helo * rep_helo .Ve .PP You can disable the individual partial reputations by setting their respective weight to zero. This will also reduce the size of the database, since each partial reputation requires a separate entry in the database table. Disabling some of the partial reputations in this way may also help with the performance on busy servers, because the respective database lookups and processing will be skipped too. .IP "\fBtxrep_weight_email\fR" 4 .IX Item "txrep_weight_email" .Vb 1 \& range [0..10] (default: 3) .Ve .Sp This weight factor controls the influence of the reputation of the standalone email address, regardless of the originating \s-1IP\s0 address. When adjusting the weight, you need to keep on mind that an email address can be easily spoofed, and hence spammers can use 'from' email addresses belonging to senders with good reputation. From this point of view, the email address bound to the originating \s-1IP\s0 address is a more reliable indicator for the overall reputation. .Sp On the other hand, some reputable senders may be sending from a bigger number of \s-1IP\s0 addresses, so looking for the reputation of the standalone email address without regarding the originating \s-1IP\s0 has some sense too. .Sp We recommend using a relatively low value for this partial reputation. .IP "\fBtxrep_weight_email_ip\fR" 4 .IX Item "txrep_weight_email_ip" .Vb 1 \& range [0..10] (default: 10) .Ve .Sp This is the standard reputation used in the same way as it was by the original \&\s-1AWL\s0 plugin. Each sender's email address is bound to the originating \s-1IP,\s0 or its part as defined by the txrep_ipv4_mask_len or txrep_ipv6_mask_len parameters. .Sp At a user sending from multiple locations, diverse mail servers, or from a dynamic \&\s-1IP\s0 range out of the masked block, his email address will have a separate reputation value for each of the different (partial) \s-1IP\s0 addresses. .Sp When the option auto_welcomelist_distinguish_signed is enabled, in contrary to the original \s-1AWL\s0 module, TxRep does not record the \s-1IP\s0 address when \s-1DKIM\s0 signature is detected. The email address is then not bound to any \s-1IP\s0 address, but rather just to the \s-1DKIM\s0 signature, since it is considered that it authenticates the sender more reliably than the \s-1IP\s0 address (which can also vary). .Sp This is by design the most relevant reputation, and its weight should be kept high. .IP "\fBtxrep_weight_domain\fR" 4 .IX Item "txrep_weight_domain" .Vb 1 \& range [0..10] (default: 2) .Ve .Sp Some spammers may use always their real domain name in the email address, just with multiple or changing local parts. This reputation will record the spam scores of all messages send from the respective domain, regardless of the local part (user name) used. .Sp Similarly as with the email_ip reputation, the domain reputation is also bound to the originating address (or a masked block, if mask parameters used). It avoids giving false reputation based on spoofed email addresses. .Sp In case of a \s-1DKIM\s0 signature detected, the signature signer is used instead of the domain name extracted from the email address. It is considered that the signing authority is responsible for sending email of any domain name, hence the same reputation applies here. .Sp The domain reputation will give relevant picture about the owner of the domain in case of small servers, or corporation with strict policies, but will be less relevant for freemailers like Gmail, Hotmail, and similar, because both ham and spam may be sent by their users. .Sp The default value is set relatively low. Higher weight values may be useful, but we recommend caution and observing the scores before increasing it. .IP "\fBtxrep_weight_ip\fR" 4 .IX Item "txrep_weight_ip" .Vb 1 \& range [0..10] (default: 4) .Ve .Sp Spammers can send through the same relay (incl. compromised hosts) under a multitude of email addresses. This is the exact case when the \s-1IP\s0 reputation can help. This reputation is a kind of a local \s-1RBL.\s0 .Sp The weight is set by default lower than for the email_IP reputation, because there may be cases when the same \s-1IP\s0 address hosts both spammers and acceptable senders (for example the marketing department of a company sends you spam, but you still need to get messages from their billing address). .IP "\fBtxrep_weight_helo\fR" 4 .IX Item "txrep_weight_helo" .Vb 1 \& range [0..10] (default: 0.5) .Ve .Sp Big number of spam messages come from compromised hosts, often personal computers, or top-boxes. Their NetBIOS names are usually used as the \s-1HELO\s0 name when connecting to your mail server. Some of the names are pretty generic and hence may be shared by a big number of hosts, but often the names are quite unique and may be a good indicator for detecting a spammer, despite that he uses different email and \s-1IP\s0 addresses (spam can come also from portable devices). .Sp No \s-1IP\s0 address is bound to the \s-1HELO\s0 name when stored to the reputation database. This is intentional, and despite the possibility that numerous devices may share some of the \s-1HELO\s0 names. .Sp This option is still considered experimental, hence the low weight value, but after some testing it could be likely at least slightly increased. .SH "ADMINISTRATOR SETTINGS" .IX Header "ADMINISTRATOR SETTINGS" These settings differ from the ones above, in that they are considered 'more privileged' \*(-- even more than the ones in the \fB\s-1PRIVILEGED SETTINGS\s0\fR section. No matter what \f(CW\*(C`allow_user_rules\*(C'\fR is set to, these can never be set from a user's \f(CW\*(C`user_prefs\*(C'\fR file. .IP "\fBtxrep_factory module\fR" 4 .IX Item "txrep_factory module" .Vb 1 \& (default: Mail::SpamAssassin::DBBasedAddrList) .Ve .Sp Select alternative database factory module for the TxRep database. .IP "\fBauto_welcomelist_path /path/filename\fR" 4 .IX Item "auto_welcomelist_path /path/filename" .Vb 1 \& (default: ~/.spamassassin/tx\-reputation) .Ve .Sp Previously auto_whitelist_path which will work interchangeably until 4.1. .Sp This is the TxRep directory and filename. By default, each user has their own reputation database in their \f(CW\*(C`~/.spamassassin\*(C'\fR directory with mode 0700. For system-wide SpamAssassin use, you may want to share this across all users. .IP "\fBauto_welcomelist_db_modules Module ...\fR" 4 .IX Item "auto_welcomelist_db_modules Module ..." .Vb 1 \& (default: see below) .Ve .Sp Previously auto_whitelist_db_modules which will work interchangeably until 4.1. .Sp What database modules should be used for the TxRep storage database file. The first named module that can be loaded from the Perl include path will be used. The format is: .Sp .Vb 1 \& PreferredModuleName SecondBest ThirdBest ... .Ve .Sp ie. a space-separated list of Perl module names. The default is: .Sp .Vb 1 \& DB_File GDBM_File SDBM_File .Ve .Sp NDBM_File is not supported (see SpamAssassin bug 4353). .IP "\fBauto_welcomelist_file_mode\fR" 4 .IX Item "auto_welcomelist_file_mode" .Vb 1 \& (default: 0700) .Ve .Sp Previously auto_whitelist_file_mode which will work interchangeably until 4.1. .Sp The file mode bits used for the TxRep directory or file. .Sp Make sure you specify this using the 'x' mode bits set, as it may also be used to create directories. However, if a file is created, the resulting file will not have any execute bits set (the umask is set to 0111). .IP "\fBuser_awl_dsn DBI:databasetype:databasename:hostname:port\fR" 4 .IX Item "user_awl_dsn DBI:databasetype:databasename:hostname:port" Used by the SQLBasedAddrList storage implementation. .Sp This will set the \s-1DSN\s0 used to connect. Example: \&\f(CW\*(C`DBI:mysql:spamassassin:localhost\*(C'\fR .IP "\fBuser_awl_sql_username username\fR" 4 .IX Item "user_awl_sql_username username" Used by the SQLBasedAddrList storage implementation. .Sp The authorized username to connect to the above \s-1DSN.\s0 .IP "\fBuser_awl_sql_password password\fR" 4 .IX Item "user_awl_sql_password password" Used by the SQLBasedAddrList storage implementation. .Sp The password for the database username, for the above \s-1DSN.\s0 .IP "\fBuser_awl_sql_table tablename\fR" 4 .IX Item "user_awl_sql_table tablename" .Vb 1 \& (default: txrep) .Ve .Sp Used by the SQLBasedAddrList storage implementation. .Sp The table name where reputation is to be stored in, for the above \s-1DSN.\s0 .SH "BLOCKLISTING / WELCOMELISTING" .IX Header "BLOCKLISTING / WELCOMELISTING" When asked by SpamAssassin to blocklist or welcomelist a user, the TxRep plugin adds a score of 100 (for blocklisting) or \-100 (for welcomelisting) to the given sender's email address. At a plain address without any \s-1IP\s0 address, the value is multiplied by the ratio of total reputation weight to the \s-1EMAIL\s0 reputation weight to account for the reduced impact of the standalone \s-1EMAIL\s0 reputation when calculating the overall reputation. .PP .Vb 2 \& total_weight = weight_email + weight_email_ip + weight_domain + weight_ip + weight_helo \& blocklisted_reputation = 100 * total_weight / weight_email .Ve .PP When a standalone email address is blocklisted/welcomelisted, all records of the email address bound to an \s-1IP\s0 address, \s-1DKIM\s0 signature, or a \s-1SPF\s0 pass will be removed from the database, and only the standalone record is kept. .PP Besides blocklisting/welcomelisting of standalone email addresses, the same method may be used also for blocklisting/welcomelisting of \s-1IP\s0 addresses, domain names, and \s-1HELO\s0 names (only dotless Netbios \s-1HELO\s0 names can be used). .PP When welcomelisting/blocklisting an email address or domain name, you can bind them to a specified \s-1DKIM\s0 signature or \s-1SPF\s0 record by appending the \&\s-1DKIM\s0 signing domain or the tag 'spf' after the \s-1ID\s0 in the following way: .PP .Vb 2 \& spamassassin \-\-add\-addr\-to\-blocklist=spamming.biz,spf \& spamassassin \-\-add\-addr\-to\-welcomelist=friend@good.org,good.org .Ve .PP When a message contains both a \s-1DKIM\s0 signature and an \s-1SPF\s0 pass, the \s-1DKIM\s0 signature takes the priority, so the record bound to the 'spf' tag won't be checked. Only email addresses and domains can be bound to \s-1DKIM\s0 or \s-1SPF.\s0 Records of \s-1IP\s0 addresses and \s-1HELO\s0 names are always without \s-1DKIM/SPF.\s0 .PP In case of dual storage, the block/welcomelisting is performed only in the default storage. .SH "REPUTATION LOGICS" .IX Header "REPUTATION LOGICS" 1. The most significant sender identificator is equally as at \s-1AWL,\s0 the combination of the email address and the originating \s-1IP\s0 address, resp. its part defined by the IPv4 resp. IPv6 mask setting. .PP 2. No \s-1IP\s0 checking for standalone \s-1EMAIL\s0 address reputation .PP 3. No signature checking for \s-1IP\s0 reputation, and for \s-1HELO\s0 name reputation .PP 4. The \s-1EMAIL_IP\s0 weight, and not the standalone \s-1EMAIL\s0 weight is used when no \s-1IP\s0 address is available (\s-1EMAIL_IP\s0 is the main indicator, and has the highest weight) .PP 5. No \s-1IP\s0 checking at signed emails (signature authenticates the email instead of the \s-1IP\s0 address) .PP 6. No \s-1IP\s0 checking at \s-1SPF\s0 pass (we assume the domain owner is responsible for all \s-1IP\s0's he authorizes to send from, hence we use the same identity for all of them) .PP 7. No signature used for standalone \s-1EMAIL\s0 reputation (would be redundant, since no \s-1IP\s0 is used at signed \s-1EMAIL_IP\s0 reputation, and we would store two identical hits) .PP 8. When available, the \s-1DKIM\s0 signer is used instead of the domain name for the \s-1DOMAIN\s0 reputation .PP 9. No \s-1IP\s0 and no signature used for \s-1HELO\s0 reputation (despite the possibility of the possible existence of multiple computers with the same \s-1HELO\s0) .PP 10. The full (unmasked \s-1IP\s0) address is used (in the address field, instead the \s-1IP\s0 field) for the standalone \s-1IP\s0 reputation .SH "LEARNING SPAM / HAM" .IX Header "LEARNING SPAM / HAM" When SpamAssassin is told to learn (or relearn) a given message as spam or ham, all reputations relevant to the message (email, email_ip, domain, ip, helo) in both global and user storages will be updated using the \f(CW\*(C`txrep_learn_penalty\*(C'\fR respectively the \f(CW\*(C`rxrep_learn_bonus\*(C'\fR values. The new reputation of given sender property (email, domain,...) will be the respective result of one of the following formulas: .PP .Vb 2 \& new_reputation = old_reputation + learn_penalty \& new_reputation = old_reputation \- learn_bonus .Ve .PP The TxRep plugin currently does track each message individually, hence it does not detect when you learn the message repeatedly. It will add/subtract the penalty/bonus score each time the message is fed to the spam learner. .SH "OPTIMIZING TXREP" .IX Header "OPTIMIZING TXREP" TxRep can be optimized for speed and simplicity, or for the precision in assigning the reputation scores. .PP First of all TxRep can be quickly disabled and re-enabled through the option "\f(CW\*(C`use_txrep\*(C'\fR". It can be done globally, or individually in each respective \&\f(CW\*(C`user_prefs\*(C'\fR. Disabling TxRep will not destroy the database, so it can be re-enabled any time later again. .PP On many systems, SQL-based storage may perform faster than the default Berkeley \s-1DB\s0 storage, so you should consider setting it up. .PP Then there are multiple settings that can reduce the number of records stored in the database, hence reducing the size of the storage, and also the processing time: .PP 1. Setting "\f(CW\*(C`txrep_user2global_ratio\*(C'\fR" to zero will disable the dual storage, halving so the disk space requirements, and the processing times of this plugin. .PP 2. You can disable all but one of the \*(L"\s-1REPUTATION WEIGHTS\*(R"\s0. The \s-1EMAIL_IP\s0 is the most specific option, so it is the most likely choice in such case, but you could base the reputation system on any of the remaining scores. Each of the enabled reputations adds a new entry to the database for each new identificator. So while for example the number of recorded and scored domains may be big, the number of stored \s-1IP\s0 addresses will be probably higher, and would require more space in the storage. .PP 3. Disabling the "\f(CW\*(C`txrep_track_messages\*(C'\fR" avoids storing a separate entry for every scanned message, hence also reducing the disk space requirements, and the processing time. .PP 4. Disabling the option "\f(CW\*(C`txrep_autolearn\*(C'\fR" will save the processing time at messages that trigger the auto-learning process. .PP 5. Disabling "\f(CW\*(C`txrep_welcomelist_out\*(C'\fR" will reduce the processing time at outbound connections. .PP 6. Keeping the option "\f(CW\*(C`auto_welcomelist_distinguish_signed\*(C'\fR" enabled may help slightly reducing the size of the database, because at signed messages, the originating \s-1IP\s0 address is ignored, hence no additional database entries are needed for each separate \s-1IP\s0 address (resp. a masked block of \s-1IP\s0 addresses). .PP Since TxRep reuses the storage architecture of the former \s-1AWL\s0 plugin, for initializing the \s-1SQL\s0 storage, the same instructions apply also to TxRep. Although the old \s-1AWL\s0 table can be reused for TxRep, by default TxRep expects the \s-1SQL\s0 table to be named \*(L"txrep\*(R". .PP To install a new \s-1SQL\s0 table for TxRep, run the appropriate \s-1SQL\s0 file for your system under the /sql directory. .PP If you get a syntax error at an older version of MySQL, use TYPE=MyISAM instead of ENGINE=MyISAM at the end of the command. You can also use other types of \s-1ENGINE\s0 (depending on what is available on your system). For example \&\s-1MEMORY\s0 engine stores the entire table in the server memory, achieving performance similar to Redis. You would need to care about the replication of the \s-1RAM\s0 table to disk through a cronjob, to avoid loss of data at reboot. The InnoDB engine is used by default, offering high scalability (database size and concurrence of accesses). In conjunction with a high value of innodb_buffer_pool or with the memcached plugin (MySQL v5.6+) it can also offer performance comparable to Redis.