Hi,

I setup Postfix with mysql and this is working fine:

virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mysql-virtual-mailbox-domains.cf virtual_mailbox_maps = mysql:/usr/local/etc/postfix/mysql-virtual-mailbox-maps.cf virtual_alias_maps = mysql:/usr/local/etc/postfix/mysql-virtual-alias-maps.cf,
        mysql:/usr/local/etc/postfix/mysql-virtual-email2email.cf

virtual_mailbox_base = /home/virtual
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000


Then setup procmail with:

virtualprocmail unix -  n        n       -       -       pipe
        flags=DRXhuq
        user=virtualmail
argv=/usr/bin/procmail -m E_SENDER=$sender E_RECIPIENT=$recipient ER_USER=$user ER_DOMAIN=$domain ER_DETAIL=$extension NEXTHOP=$nexthop /etc/procmailrc

virtual_transport = virtualprocmail:dummy
virtualprocmail_destination_recipient_limit = 1

And this is working fine.

I then tried to add in Dspam. Here is what I did:

smtp      inet  n       -       n       -       -       smtpd
        -o content_filter=lmtp:unix:/var/run/dspam/dspam.sock
localhost:10026 inet  n -       n       -       -        smtpd
  -o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
  -o smtpd_helo_restrictions=
  -o smtpd_client_restrictions=
  -o smtpd_sender_restrictions=
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o mynetworks=127.0.0.0/8
  -o smtpd_authorized_xforward_hosts=127.0.0.0/8

Home /var/db/dspam
StorageDriver /usr/local/lib/dspam/libmysql_drv.so
DeliveryHost            127.0.0.1
DeliveryPort            10026
DeliveryIdent           localhost
DeliveryProto           LMTP
OnFail error
Trust root
Trust dspam
Trust apache
Trust mail
Trust mailnull
Trust smmsp
Trust daemon
TrainingMode toe
TestConditionalTraining on
Feature noise
Feature whitelist
Feature tb=5
Algorithm graham burton
Tokenizer osb
PValue bcr
ImprobabilityDrive on
Preference "trainingMode=TEFT"
Preference "spamAction=quarantine"
Preference "spamSubject=[SPAM]"
Preference "statisticalSedation=5"
Preference "enableBNR=on"
Preference "enableWhitelist=on"
Preference "signatureLocation=message"
Preference "tagSpam=off"
Preference "tagNonspam=off"
Preference "showFactors=off"
Preference "optIn=off"
Preference "optOut=off"
Preference "whitelistThreshold=10"
Preference "makeCorpus=off"
Preference "storeFragments=off"
Preference "localStore="
Preference "processorBias=on"
Preference "fallbackDomain=off"
Preference "trainPristine=off"
Preference "optOutClamAV=off"
Preference "ignoreRBLLookups=off"
Preference "RBLInoculate=off"
Preference "notifications=off"
AllowOverride enableBNR
AllowOverride enableWhitelist
AllowOverride fallbackDomain
AllowOverride ignoreGroups
AllowOverride ignoreRBLLookups
AllowOverride localStore
AllowOverride makeCorpus
AllowOverride optIn
AllowOverride optOut
AllowOverride optOutClamAV
AllowOverride processorBias
AllowOverride RBLInoculate
AllowOverride showFactors
AllowOverride signatureLocation
AllowOverride spamAction
AllowOverride spamSubject
AllowOverride statisticalSedation
AllowOverride storeFragments
AllowOverride tagNonspam
AllowOverride tagSpam
AllowOverride trainPristine
AllowOverride trainingMode
AllowOverride whitelistThreshold
AllowOverride dailyQuarantineSummary
AllowOverride notifications
MySQLServer             /tmp/mysql.sock
MySQLUser               dspam
MySQLPass               ********
MySQLDb                 dspam
MySQLCompress           true
MySQLReconnect          true
MySQLVirtualTable               dspam_virtual_uids
MySQLVirtualUIDField            uid
MySQLVirtualUsernameField       username
ExtLookup               off
Notifications   off
PurgeSignatures 14
PurgeNeutral    90
PurgeUnused     90
PurgeHapaxes    30
PurgeHits1S     15
PurgeHits1I     15
PurgeSignature  on
PurgeNeutral    90
PurgeUnused     on
PurgeHapaxes    on
PurgeHits1S     on
PurgeHits1I     on
LocalMX 127.0.0.1
SystemLog       on
UserLog         on
Opt out
TrackSources spam nonspam
ParseToHeaders on
ChangeModeOnParse on
ChangeUserOnParse on
ServerPID               /var/run/dspam/dspam.pid
ServerMode auto
ServerParameters        "--deliver=innocent,spam"
ServerIdent             "localhost.localdomain"
ServerDomainSocketPath  "/var/run/dspam/dspam.sock"
ProcessorURLContext on
ProcessorBias on
StripRcptDomain off
GroupConfig /var/db/dspam/group

Email is being sent to dspam, but I don't think it is sending the user uid.

Here is the error:

Dec 4 17:12:51 mail dspam[85005]: Invalid data waiting for code 500: 500 5.5.2 Error: command not recognized^M Dec 4 17:17:51 mail dspam[85005]: Received error in response to LHLO: 500 5.5.2 Error: command not recognized^M Dec 4 17:17:51 mail dspam[85005]: query error: Column 'uid' cannot be null: see sql.errors for more details
Dec  4 17:17:51 mail dspam[85005]: bailing on error -2
Dec 4 17:17:51 mail dspam[85005]: received invalid result (!DSR_ISSPAM && !DSR_ISINNOCENT): -2 Dec 4 17:17:51 mail dspam[85005]: query error: Column 'uid' cannot be null: see sql.errors for more details Dec 4 17:17:51 mail dspam[85005]: process_message returned error -5. delivering. Dec 4 17:17:51 mail dspam[85005]: query error: Column 'uid' cannot be null: see sql.errors for more details

I checked sql.errors:

[12/04/2025 17:22:51] 85005: Column 'uid' cannot be null: INSERT INTO dspam_virtual_uids (uid,username) VALUES (NULL,'dspam')

I tried to add null myself with mysql. This failed, so I tried to change the table dspam_virtual_uids to allow the uid to be null. This caused dspam daemon to exit, so I changed it back to no longer allows null again. I think the problem is that postfix is not passing the virtual user info to dspam, but I am not sure. I have tested dspam by use cat to pipe an email into it. Of course, I am specifying a user so it works just fine.


[Postfix] -> [DSPAM]                     [Postfix] -> [Procmail]
                |___ (SMTP Reinjection) ____|


Then have procmail decide where it gets delivered with:

# Pass the message through bogofilter and generate the header, but don't
# update the wordlist (yet)
:0fw
| /usr/local/bin/dspam -p -e
#
# kick out spam
:0
* X-Bogosity: Spam
/var/mail/spam


At this point I am unsure what I can do to fix this.

Kind Regards,
Al



_______________________________________________
Dspam-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to