Patch di qmail

12 febbraio 2024 by Roberto Puzzanghera 18 commenti

Per mia comodità ho spostato i sorgenti di qmail sources nel mio spazio github. Ciononostante, tutte le informazioni riguardanti qmail e programmi correlati continueranno a essere riportate in questo spazio web, e questo spazio rimarrà il luogo ove chiedere eventualmente supporto. Da ora in poi, annzichè rilasciare una patch combinata, rilascerò un pacchetto da scaricare da github, che sarà ovviamente il risultato della applicazione delle patch elencate sotto sul programma netqmail-1.06 originale.

Changelog

AVVISO: SE STAI AGGIORNANDO qmail A PARTIRE DA UNA VERSIONE PRECEDENTE ALLA VERSIONE 2024.11.11, TIENI PRESENTE CHE dk-filter E' STATO CANCELLATO, PERTANTO E' NECESSARIO RICONFIGURARE DKIM E IL FILE rc.

  • Feb 12, 2024
    - DKIM patch upgraded to v. 1.48
    * fixed minor bug using filterargs for local deliveries (commit)
    - Fixed several compilation warnings (commit)
    - Fixed incompatible redeclaration of library function 'log2' in qmail-send.c qsutil.c as showed by notqmail friends here
    - removed FILES, shar target from Makefile
  • Feb 6, 2024
    -DKIM patch upgraded to v. 1.47
    * fixed a bug which was preventing filterargs' wildcards to work properly on sender domain
  • Jan 20, 2024 (diff here)
    liberal-lf: bare LF no longer allowed by default due to smuggling vulnerability CVE-2023-51765. Bare LF can be allowed by defining ALLOW_BARELF in tcprules or in run file.
  • Jan 15, 2024
    TLS patch by F. Vermeulen upgraded to version 20231230 (more info at https://inoa.net/qmail-tls/ tx Greg Bell for the patch)
    - support to openssl 3.0.11
  • Jan 11, 2024
    - dkim patch upgraded to version 1.46
    * dk-filter.sh has been dropped. If signing at qmail-remote level, before upgrading, you have to review the configuration as explained below.
    - The variables USE_FROM, USE_SENDER and DKIMDOMAIN have been dropped
    - when signing at qmail-remote level qmail-dkim now has to be called directly by spawn-filter in the rc file. man spawn-filter for more info
    - In case of bounces the signature will be automatically based on the from: field. This will solve issues of DMARC reject by google in case of sieve/vacation bounces.
    - In case of ordinary bounces (mailbox not found, for instance) the bounce domain will be taken from control/bouncehost and, if doesn't exist, from control/me
  • Dec 9, 2023
    -sources moved to github

Il mio pacchetto qmail include varie modifiche e le ultime versioni di alcune patch di uso comune, applicate sul programma originale netqmail-1.06:

[Vedi i dettagli sulla patch applicata qui]

Altre patch:

Sei invitato a dare un'occhiata alla prossima pagina di questa guida, che si propone di presetare alcuni test di funzionamento di queste patch alla fine.

Installazione della libreria libsrs2

Questa libreria è un prerequisito della patch SRS, che è inclusa nella mia patch combinata. E' obbligatoria l'installazione, altrimenti la compilazione andrà in errore.

wget http://www.libsrs2.org/srs/libsrs2-1.0.18.tar.gz
tar xzf libsrs2-1.0.18.tar.gz
cd libsrs2-1.0.18
./configure
make
make install
ldconfig
cd ../

Accertiamoci che la libreria libsrs2 sia stata effettivamente linkata, altrimenti andremo incontro a un crash e riavvio infinito di qmail-send con una quantità crescente di processi avviati che porterà in breve a un auto-DoS:

> ldconfig -p|grep libsrs2
        libsrs2.so.0 (libc6,x86-64) => /usr/local/lib/libsrs2.so.0
        libsrs2.so (libc6,x86-64) => /usr/local/lib/libsrs2.so

Nel caso si fosse optato per l'installazione delle libsrs2 con un pacchetto fornito dalla propria distribuzione Linux, è possibile che le librerie si trovino in /usr/lib e non su /usr/local/lib. In tal caso controllate l'effettiva esistenza del file /usr/local/include/srs2.h; se non lo trovate modificate manualmente il file srs.c presente nella cartella sorgente di netqmail in questo modo:

#include </usr/local/include/srs2.h>
#include </usr/include/srs2.h>

Scaricare i sorgenti

Se ti stai chiedendo come mai sia necessario scaricare e installare nuovamente qmail, è necessario ricordare che il programma chkuser incluso nel mio pacchetto ha vpopmail come prerequisito, mentre lo stesso vpopmail richiede di essere installato sopra il qmail originale. Quindi la caena di compilazione è netqmail > vpopmail > patched qmail.

QMAIL_VERSION=2024.02.12
wget https://github.com/sagredo-dev/qmail/archive/refs/tags/v${QMAIL_VERSION}.tar.gz
tar xzf v${QMAIL_VERSION}.tar.gz
cd qmail-${QMAIL_VERSION}

 

Configurazione di chkuser

Il pacchetto qmail appena scaricato e applicato ha chkuser abilitato e configurato per eseguire il controllo dell'esistenza del destinatario (recipient verification) e il MAV (Mail From: Address Verification). E' possibile personalizzarne la configurazione modificando il file chkuser_settings.h prima della compilazione di qmail.

Configurazione della patch force-tls

Le impostazioni predefinite della pacth prevedono che l'autenticazione sia proibita se non si presenta il comando STARTTLS. Se invece si vuole consentire le connessione non c4riptate con TLS, è sufficiente porre

export FORCETLS=0

nel proprio run file (vedere dopo). Valori diversi da 0 o nessuna dichiarazione forzano il TLS prima dell'atutenticazione.

Configurazione di qmail-auth

Come impostazione predefinita l'autenticazione viene eseguita in modalità LOGIN o PLAIN. Sei invitato a leggere il file README.auth per ulteriori dettagli riguuardanti l'utilizzo della variabile di ambiente SMTPAUTH, specialmente sei interessato a usare CRAM-MD5.

Ricompilazione di qmail

Coloro che stanno facendo una nuova installazione di qmail possono ora compilare come segue

make setup check

e passare al paragrafo successivo (Creare la SSL key).


Coloro che invece hanno già qmail in esecuzione e stanno ricompilando per un aggiornamento dovrebbero stoppare qmail prima di installare.

La patch BIG-TODO che è stata applicata può richiedere che la coda venga rigenerata, la prima volta che la si usa. Pertanto è bene essere consapevoli che tutti i messaggi nella coda verranno distrutti quando questa viene cancellata prima dell'installazione di qmail.

Per sapere se vi sono messaggi in coda digitare questo comando:

> qmailctl stat

/service/qmail-send: up (pid 18127) 6 seconds
/service/qmail-send/log: up (pid 18134) 6 seconds
/service/qmail-smtpd: up (pid 18126) 6 seconds
/service/qmail-smtpd/log: up (pid 18135) 6 seconds
/service/qmail-submission: up (pid 18131) 6 seconds
/service/qmail-submission/log: up (pid 18132) 6 seconds
/service/vpopmaild: up (pid 18129) 6 seconds
/service/vpopmaild/log: up (pid 18128) 6 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0

Comunque, se non si deve gestire un server di grandi dimensioni, si può sempre usare la versione della mia patch combinata che non contiene la patch BIG-EXT-TODO.

In definitiva è necessario lanciare questo comando la prima volta che si installa la patch con la BIG-TODO:

qmailctl stop
rm -r /var/qmail/queue

Ora ricompiliamo qmail:

make

Se qmail è in esecuzione arrestare i servizi prima dell'installazione:

qmailctl stop

Infine installare qmail e poi avviarlo:

make setup
qmailctl start

Creare la SSL key

SE non hai intenzione di costruire un un open relay (che consente l'invio di email connettendosi da remoto con accesso smtp/tls) puoi saltare questo punto.

Per mettere in sicurezza l'autenticazione smtp bisogna creare un certificato SSL. Il certificato deve essere di proprietà dell'utente sotto il quale viene eseguito qmail-smtpd, nel nostro caso vpopmail.

# make cert

Generating a 1024 bit RSA private key
..................++++++
.......++++++
writing new private key to '/var/qmail/control/servercert.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IT
State or Province Name (full name) [Some-State]:Italy
Locality Name (eg, city) []:Cagliari
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Name
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:smtp.yourdomain.net
Email Address []:postmaster@yourdomain.net

# make tmprsadh
# chown vpopmail.vchkpw /var/qmail/control/*.pem

E' importante che il "Common Name" corrisponda al nome a dominio del server che viene usato come relay.

Ora creiamo un cronjob che aggiorni giornalmente il certificato:

# crontab -e

03 05 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2>&1

Importante: se si sta usando la mia patch e nella vostra installazione qmail-submission viene lanciato sotto un utente diverso da vpopmail (diversamente da quanto suggerito in questa guida), è necessario modificare di conseguenza il file update_tmprsadh, altrimenti è possibile eccedere il timeout della connessione a causa della mancanza dei privilegi di lettura del certificato.

Installazione di un certificato SSL valido

Non appena il server è funzionante sarà il caso di ritornare qui per installare un certificato valido fornito da Let's Encrypt. Si veda questa pagina al proposito.

Dettaglio delle patch

qmail-authentication

It provides cram-md5, login, plain authentication support for qmail-smtpd (port 587) and qmail-remote.

Added FORCEAUTHMAILFROM environment variable to REQUIRE that authenticated user and 'mail from' are identical.

Added SMTPAUTHMETHOD, SMTPAUTHUSER and SMTP_AUTH_USER env variables for external plugins (see http://qmail-spp.sourceforge.net/doc/)

qmail-tls

  • Author: Frederik Vermeulen
  • Info: http://inoa.net/qmail-tls/
  • Version 20231230
  • added DISABLETLS environment variable, useful if you want to disable TLS on a desired port

It implements TLS encrypted and authenticated SMTP between the MTAs and from MUA to MTA. I have adjusted the file update_tmprsadh to chown the .pem files to vpopmail, which runs qmail-smtpd.

You may be interested to take a look to the page concerning smtp-auth and TLS testing here.

force-tls

  • Author: Marcel Telka
  • Download
  • Version: 2016.05.15

optionally gets qmail to require TLS before authentication to improve security.
You have to declare FORCETLS=0 if you want to allow the auth without TLS

chkuser

performs recipient verification and Mail From: Address Verification (MAV).

Small adjustments and a bug fix by Luca Franceschini here. Now CHKUSER_DISABLE_VARIABLE, CHKUSER_SENDER_NOCHECK_VARIABLE, CHKUSER_SENDER_FORMAT_NOCHECK,
CHKUSER_RCPT_FORMAT_NOCHECK and CHKUSER_RCPT_MX_NOCHECK can be defined at runtime level as well.

You may be interested to take a look to this page concerning chkuser testing.

qmail-queue-custom-error.patch

Enables simscan and qmail-dkim to return the appropriate message for each e-mail it refuses to deliver. Simscan rejects with the name of the virus or the spam-score; qmail-dkim rejects with the verification failure message.

qmail-SPF

It can check incoming mails inside the SMTP daemon, add Received-SPF lines and optionally block undesired transfers.

qmail-SRS

implements Sender Rewriting Scheme fixing SPF break upon email forwarding. To enable SRS read carefully the configuration instructions above.

Oversize DNS

This patch enables qmail to handle large DNS packets.

Reread concurrency patch

  • Author: Jul
  • Version: 2
  • Patch

rereads control/concurrencylocal and control/concurrencyremote files when qmail-send receives a HUP signal.

Big Concurrency patch

  • Author: Johannes Erdfelt
  • Patch

It sets the spawn limit above 255.

Big Concurrency fix

Fixes a compiler error if you set concurrency higher than 509 in /usr/local/src/netqmail-1.06/conf-spawn.

maildir++ patch

  • Author: Bill Shupp
  • Version:  20050125
  • Patch

adds maildirquota support to qmail-pop3d and qmail-local.
Fixed a bug where the filesize part of the S=<filesize> component of the Maildir++ compatible filename is wrong (tx MG). More info here.

Better qmail-smtpd Logging patch

Facilitates diagnosing qmail-smtpd logging its actions and decisions (search for a line starting with qmail-smtp:). This is useful for discovering fake IP addresses with bad HELO’s when qmail-smtpd doesn’t log anything.

Greeting delay patch

  • Author: John Simpson (?)
  • Patch
  • More info here

adds a user-definable delay after SMTP clients have initiated SMTP sessions, prior to qmail-smtpd responding with "220 ESMTP". It can reject connections from clients which tried to send commands before greeting. You can control the delay via the environment variable SMTPD_GREETDELAY (was GREETDELAY in the original patch). A value of SMTPD_GREETDELAY=”30” will delay qmail-smtpd’s response for 30 seconds.

DKIM and SURBL patch

adds DKIM signing & verification support to qmail at both qmail-smtpd and qmail-remote/local level and SURBL filtering support to qmail.  

/var/qmail/control/cache and subdirs assigned to the vpopmail user.

EXT-TODO patch

  • Authors: Claudio Jeker and Andre Oppermann
  • Release: 5. Jan. 2003
  • Patch
  • README

addresses a problem known as the silly qmail (queue)  problem.

BIG-TODO patch

  • Author: Russell Nelson
  • Patch

Makes qmail use a hashing mechanism in the todo folder similar to that used in the rest of the queue.

qmail-inject-null-sender patch

Prevents qmail-inject from rewriting the null sender, fixing an issue with sieve vacation/reject messages.

doublebounce-trim patch

  • Authors: Russell Nelson (modified version by Charles Cazabon)
  • Patch

Prevents double bounces from hitting your queue a second time provided that you delete the first line from /var/qmail/control/doublebounceto

qmail-taps-extended

Provides the ability to archive each email that flows through the system. Archiving only messages from or to certain email addresses is possible as well.

outgoingip patch

  • Author: Andy Repton (adjusted by Sergio Gelato)
  • Patch
  • Robbie Walker provided a patch to correct qmail-qmqpc.c's call to timeoutconn(), because the function signature was modified by the original outgoingip patch

By default all outgoing emails are sent through the first IP address on the interface. In case of a multiple IP server this patch makes qmail send outgoing emails with the IP eventually stored in control/outgoingip. The ehlo domain is NOT modified by this patch.

qmail-rfc2821 patch

  • Author: Matthias Andree
  • Patch
  • More info here

makes qmail rfc2821 compliant.

Ali Erturk TURKER added implicit TLS (SMTPS) support (patch here).

smtpd-502-to-500 patch

  • Author: Jonathan de Boyne Pollard
  • Patch
  • More info here

makes qmail rfc2821 compliant

qmail-dnsbl patch

  • Author: Fabio Busatto
  • Download
  • Modified by Luca Franceschini to add support for whitelists, TXT and A queries, configurable return codes 451 or 553 with custom messages
  • More info here

allows you to reject spam and virus looking at the sender's ip address. Added a line to make qmail-smtpd log the reject reason as well as the envelope to facilitate diagnostics.

qmail-moreipme patch

prevents a problem caused by an MX or other mail routing directive instructing qmail to connect to itself without realizing it's connecting to itself, saving CPU time.

qmail-hide-ip-headers

It will hide your Private or Public IP in the email Headers when you are sending Mail as a Relay Client.

qmail-date-localtime patch

  • Author: John Saunders
  • Patch

causes the various qmail programs to generate date stamps in the local timezone.

qmail-liberal-lf patch

allows qmail-smtpd to accept messages that are terminated with a single \n instead of the required \r\n  sequence.

Bare LF are no longer allowed by default due to smuggling vulnerability CVE-2023-51765. Bare LF can be allowed by defining ALLOW_BARELF in tcprules or in run file.

qmail-maxrcpt

  • author: Michael Samuel
  • Patch

allows you to set a limit on how many recipients are specified for any one email message by setting control/maxrcpt. RFC 2821 section 4.5.3.1 says that an MTA MUST allow at least 100 recipients for each message, since this is one of the favourite tricks of the spammer.
I slightly modified the patch also to log its response.

qmail-eMPF patch

eMPF follows a set of administrator-defined rules describing who can message whom.  With this, companies can segregate various parts of their organizations email activities, as well as provide a variety of security-enhancing services.

It's useful in case of spammed servers, to temporarily stop outgoing messages. It adds a line like this in your qmail-smtp log:

2015-03-30 18:05:54.442596500 policy_check: remote someone@somewhere.xy -> local user@yourdomain.xy (UNAUTHENTICATED SENDER)
2015-03-30 18:05:54.442612500 policy_check: policy allows transmission

qregex

  • By  Andrew St. Jean. Contributors: Jeremy Kitchen, Alex Pleiner, Thanos Massias. Original patch by Evan Borgstrom)
  • More info here
  • README

adds the ability to match address evelopes via Regular Expressions (REs) in the qmail-smtpd process.

Added new control file 'badhelonorelay', control/badmailto renamed control/badrcptto (Tx Luca Franceschini).

brtlimit

adds control/brtlimit and BRTLIMIT variable to limit max invalid recipient errors before closing the connection.

validrcptto

It works in conjunction with chkuser with both cdb and mysql accounts. Look here for details

reject-relay-test

  • Author: Russell Nelson
  • More info here

It gets qmail to reject relay probes generated by so-called anti-spammers. These relay probes have '!', '%' and '@' in the local (username) part of the address.

bug fixed in smtpd.c addrparse function

Fixed a little bug in 'mail from' address handling (see the patch by Andre Opperman at http://qmail.cr.yp.narkive.com/kBry6GJl/bug-in-qmail-smtpd-c-addrparse-function)

qlog patch

  • Author: Luca Franceschini
  • The qlog patch is inside this bunch of patches (later adjustments here)

smtpd logging with fixed format (note: 'size' field is evaluated only when control/databytes or DATABYTES are set. An entry 'qlogenvelope' is generated after accepting or rejecting every recipients in the envelope phase, example:

qlogenvelope: result=rejected code=553 reason=rblreject detail=b.barracudacentral.org helo=test.machine.it mailfrom=test@domain.com rcptto=test@pippo.com relay=no rcpthosts=yes size= authuser= authtype= encrypted= sslverified=no localip=15.15.15.15 localport=25 remoteip=14.143.30.83 remoteport=57502 remotehost= qp= id=39156
qlogenvelope: result=accepted code=250 reason=rcptto detail=chkuser helo=test mailfrom=test@test.com rcptto=test@pippo.com relay=no rcpthosts=yes size= authuser= authtype= encrypted= sslverified=no localip=15.15.15.15 localport=25 remoteip=12.181.218.154 remoteport=57742 remotehost= qp= pid=37357

an entry 'qlogreceived' is generated after DATA (message accepted o rejected by qmail-queue)

qlogreceived: result=accepted code=250 reason=queueaccept detail= helo=test.machine.it mailfrom=test@domain.com rcptto=test@gmail.com relay=yes rcpthosts= size= authuser=pippo@pippo.com,pluto@pippo.com authtype=login encrypted=tls sslverified=no localip=192.168.200.162 localport=25 remoteip=192.168.200.162 remoteport=52602 remotehost= qp=30982 pid=30980

reject null senders patch

  • by Luca Franceschini

useful in special cases if you temporarily need to reject the null sender (although breaks RFC compatibility). You just need to put 1 (actually any number different from 0) in your control/rejectnullsenders or defin REJECTNULLSENDERS to reject the null sender with a 421 error message.

remove-cname-check patch

Removed dns_cname call in qmail-remote.c instead of changing the funcion in dns.c,in case another patch requires dns_cname(). Avoids qmail getting large amounts of DNS data we have no interest in and that may overflow our response buffer.

any-to-cname patch

  • Author: Jonathan de Boyne Pollard
  • Download

Avoids qmail getting large amounts of DNS data we have no interest in and that may overflow our response buffer.

rcptcheck patch

 

Originally designed for the purpose of receipt validation, it can also be used to limit the number of email a given IP and/or auth-user and/or domain can send in a given time interval. It has to be used in conjuction with the rcptcheck-overlimit.sh LF's script.

qmail-channels

Allows you to add an arbitrary number of supplemental remote queues, each distinguished by a list of recipient domains and separate throttling (concurrency) capabilities. This patch also allows dynamic throttling of the concurrency control files so you can just send qmail-send a HUP signal instead of restarting the service every time.

This patch is useful when some email providers complain of too many emails receveid at the same time (in case of news letters for instance).

Edit conf-channels before compiling: Total number of channels (queues) available for delivery. Must be at least 2, and anything above 2 are considered supplemental channels.

qmail-remote-logging

Gets qmail-remote to log sender, recipient and IP adddress all together in the "Delivery success/failure" line

Here is the sample log lines:

@400000004b1bdd4d1f89d84c delivery 10: success: <From:owner-freebsd-current@freebsd.org_To:user@remotedomain.com>_193.140.X.X_accepted_message.
/Remote_host_said:_250_ok_1260117440_qp_15626/

@400000004b1bdbb8191f1954 delivery 6: failure: <From:a@surgate.net_To:test323232@remoteserver.com>_212.252.x._does_not_like_recipient.
/Remote_host_said:_550_non-existent_recipient/alici_bulunamadi/Giving_up_on_212.252.x.x/

cve-2005-1513 fix

 addresses a vulnerability issue spotted by Georgi Guninski in 2005.

qmail-spp

  • Author: Pawel Foremski
  • Version: 0.42
  • More info here

qmail-spp provides plug-in support for qmail-smtpd. It allows you to write external programs and use them to check SMTP command argument validity. The plug-in can trigger several actions, like denying a command with an error message, logging data, adding a header and much more.

The qmail-spp functionality is disabled by default, so that it will be transparent for ancient users of this patch. If you want to enable qmail-spp just export the variable ENABLE_SPP in your run file. Note that the variable NOSPP is not available here.

fastremote

While sending individual messages with qmail consumes very little CPU, sending multiple large messages in parallel can effectively DoS a sender due to inefficiencies in qmail-remote's "blast" function. In its original form, this function scans the message one byte at a time to escape leading periods and newlines, as required by SMTP.

This patch modifies blast to scan the message in larger chunks. Tests show that the change reduces the CPU time consumed by qmail-remote by a factor of 10.

Commenti

Chiariamnto su Creare la SSL key

Buongiorno Roberto,

Se ho già un SAN let's encrypt la procedura del certificato autogenereato la posso saltare?
Il certificato servercert.pem mi viene da let's encrypt e di conseguenza non serve il crontab /var/qmail/bin/update_tmprsadh.
Ho capito bene?

Grazie ancora
Gabriele

Rispondi |

Chiariamnto su Creare la SSL key

Si, è così

Rispondi |

compilazione con patch tls

Buongiorno,

ho applicato la patch con supporto tls netqmail-1.06-tls-20200107.patch, ma durante la compilazione ho il seguente errore:

./compile tls.c
./compile ssl_timeoutio.c
./load qmail-remote control.o constmap.o timeoutread.o \
timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
tls.o ssl_timeoutio.o -L/usr/local/ssl/lib -lssl -lcrypto \
ipalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
str.a fs.a auto_qmail.o `cat dns.lib` `cat socket.lib`
qmail-remote.o: In function `quit':
qmail-remote.c:(.text+0x9c9): undefined reference to `SSL_get_state'
qmail-remote.o: In function `tls_init':
qmail-remote.c:(.text+0xd45): undefined reference to `OPENSSL_init_ssl'
qmail-remote.c:(.text+0xd4a): undefined reference to `TLS_client_method'
qmail-remote.c:(.text+0xd6b): undefined reference to `SSL_CTX_set_options'
qmail-remote.c:(.text+0xdb9): undefined reference to `SSL_CTX_set_post_handshake_auth'
qmail-remote.c:(.text+0xf5f): undefined reference to `OPENSSL_sk_num'
qmail-remote.c:(.text+0xf86): undefined reference to `OPENSSL_sk_value'
qmail-remote.c:(.text+0xfc1): undefined reference to `OPENSSL_sk_pop_free'
qmail-remote.c:(.text+0x11ac): undefined reference to `OPENSSL_init_ssl'
qmail-remote.c:(.text+0x11b1): undefined reference to `TLS_client_method'
qmail-remote.c:(.text+0x11ce): undefined reference to `SSL_CTX_set_options'
qmail-remote.c:(.text+0x1493): undefined reference to `OPENSSL_sk_pop_free'
qmail-remote.c:(.text+0x14c7): undefined reference to `OPENSSL_sk_pop_free'
tls.o: In function `ssl_error':
tls.c:(.text+0x65): undefined reference to `OPENSSL_init_ssl'
ssl_timeoutio.o: In function `ssl_timeoutrehandshake':
ssl_timeoutio.c:(.text+0x33f): undefined reference to `SSL_verify_client_post_handshake'
collect2: error: ld returned 1 exit status
Makefile:1445: recipe for target 'qmail-remote' failed
make: *** [qmail-remote] Error 1

il file conf-cc è

cc -O2 -DTLS=20200107 -I/usr/local/include/

e in /usr/local/include è presente la directory opessl con tutti i file .h

qualcuno sa dirmi dove sbaglio?

Grazie

Michele

Rispondi |

compilazione con patch tls

Stai installando la mia patch o solo la qmail-tls? Quale versione di openssl?

Rispondi |

Ma la qregex patch?

Ciao Roberto,

ottimo lavoro, ma come mai non hai incluso la patch qregex? Usi un altro modo per avere le funzionalità di badmailfrom badmailto badrdns etc, ?

Rispondi |

In realtà la qregex è presente

In realtà la qregex è presente nella mia combined, perchè prerequisito della dkim e se non ricordo male anche della qmail-tap. La dkim patch però l'ha talmente devastata che credo non funzioni più secondo lo scopo originario. Se ci vuoi giocare e vedere se funziona mi farebbe piacere saperlo cmq

Detto questo riesco benissimo a farne a meno settando a dovere chkuser, che controlla la correttezza sia del sender che del rcpt, anche se non fa il check del reverse dns.

Rispondi |

qmail remote auth

Ciao Roberto,
complimenti per la guida, utilizzo qmail da anni con meno patch ma era ora che qualcuno ne facesse una combinata. Complimenti ancora per l'assiduo lavoro!!
Mi trovo in difficoltà con l'autenticazione remota: non riesco bene a capire il funzionamento di authsenders. Ho provato anche a vedere sul sito www.fehcom.de ma nulla da fare.
Ecco in sintesi il problema:
In passato utilizzato una patch chiamata qmail-remote-auth reperibile dal sito tomclegg.net. Alla fine modificavi smtproutes aggiungendo username e password.
L'ho sempre utilizzata molto anche per smistare il traffico verso vari server.
Il mio /var/qmail/control/smtproutes poteva essere così
libero.it:smtp.libero.it xx@libero.it password
alice.it:out.alice.it xx@alice.it password
:smtp.miodominio.net xx@miodominio.net password

Mi sembra di capire che authsenders, al contrario di smtproutes, smista le mail in base al mittente, e non al dominio di destinazione. Confermi? Come potrei risolvere il problema?

Rispondi |

Ciao Carlo,sull'uso di

Ciao Carlo,

sull'uso di authsenders trovi qualche informazione sul man di qmail-remote:

       authsenders
            Authenticated sender.  For  each  sender  included  in  authsenders:  sender:relay:port|user|password
            qmail-remote  will  try  SMTP Authentication of type CRAM-MD5, LOGIN, or PLAIN with the provided user
            name user and password password (the  authentication  information)  and  eventually  relay  the  mail
            through relay on port port.  The use of relay and port follows the same rules as for smtproutes Note:
            In case sender is empty, qmail-remote will try to deliver each outgoing mail SMTP  authenticated.  If
            the authentication information is missing, the mail is delivered none-authenticated.  authsenders can
            be constructed as follows:

               @example.com|generic|passwd
               .subdomain.example.com|other|otherpw
               mail@example.com|test|testpass
               info@example.com:smtp.example.com:26|other|otherpw
               :mailrelay.example.com:587|e=mc2|testpass

dovendoti autenticare in remoto devi specificare l'utente/password, poi il destinatario non è necessario specificarlo, nel senso che spedisci a chi ti pare, una volta superata l'autenticazione

ciao :)

Rispondi |

authsenders

Si infatti ma il problema è proprio quello... io vorrei autenticarmi presso un server esterno in base al dominio di destinazione e non in base al mittente. Mi rifaccio al funzionamento di smtproutes (nella versione originale di qmail), nel quale tu indichi il dominio di destinazione e il server al quale desideri inoltrare le mail.

Come posso fare?

Ho visto che esistono delle patch che fanno questo ma non posso applicarle sopra la tua patch...

http://tomclegg.net/qmail/#qmail-remote-auth (già la uso ma non supporta cram-md5 e tls)

http://www.ingorohloff.de/soft/qmail.html (farebbe esattamente al caso mio ma non riesco ad applicarla sopra la tua patch)

Di nuovo grazie mille per la cortesia e la pazienza....

Carlo

Rispondi |

Re: authsender

a me pare che authsender funzioni proprio come desideri tu.

For  each  sender  included  in  authsenders:  sender:relay:port|user|password qmail-remote  will  try  SMTP Authentication..

Quindi l'autenticazione non è fatta in base al sender, ma rispetto a user|password relativi ad un dato sender. Hai provato a usare ad esempio

@dominiosender.xyz|userid|password

in questo caso le mail spedite da carlo@dominiosender.xyz a chicchessia saranno inviate dal server remoto previa autenticazione, no?

fammi sapere, ciao :)

Rispondi |

smtproutes

Mi sa che non ci siamo capiti bene, faccio un esempio che dovrebbe chiarire il tutto.

Immaginiamo per ipotesi, di lavorare su qmail senza patch. Mando una mail da carlo@miodominio.net a test@libero.it.

In smtproutes ho:
libero.it:smtp.libero.it
:smtp.mioprovider.net

qmail-remote riconosce il destinatario della mail e invierà la mail a smtp.libero.it. Qualsiasi mail diversa da "libero.it" verrà inviata tramite smtp.mioprovider.net

Ora immaginiamo di spedire la stessa mail (da carlo@miodominio.net a test@libero.it) con qmail in versione patchata by Roberto.
smtproutes non lo posso usare perché non mi fa autenticare. Creerò quindi il file authsenders come segue:

libero.it:smtp.libero.it
:smtp.mioprovider.net

qmail-remote patchato analizzerà authsenders. Il mittente è carlo@miodominio.net quindi la mail verrà inviata tramite smtp.mioprovider.net.

Spero di essere riuscito a spiegarmi meglio...
Come posso raggiungere lo stesso risultato dopo aver applicato le patch?

Se hai un minuto per guardare la patch di Tom Clegg vedrai che modifica direttamente il funzionamento di smtproutes senza variare il principio di funzionamento.

Ancora una volta grazie mille per la collaborazione,
Carlo

Rispondi |

Re: smtproutes

libero.it:smtp.libero.it
:smtp.mioprovider.net

qmail-remote patchato analizzerà authsenders. Il mittente è carlo@miodominio.net quindi la mail verrà inviata tramite smtp.mioprovider.net.

cosi è chiaro che non va perchè non ti sei autenticato.

Prima di tutto, mi pare di capire dal man che il dominio debba essere preceduto dalla @. Io farei così:

@libero.it:smtp.libero.it|userid|password

in tal modo le mail inviate da un account @libero.it vengono instradate verso il relay remoto smtp.libero.it dove ci si identifica come 'userid' e 'password'

Stasera non ho molto tempo di guardare quella patch, ma appena posso ci do uno sguardo. Aggiungerla alla mia combined non è semplice, prima dovresti levare qmail-auth e magari anche qmail-tls e force-tls.. però vedi se funziona così.. non avrebbe senso un authsenders che non rendesse questo.. deve funzionare cosi

Rispondi |

differenza tra authsenders e smtproutes

Nella risposta precedente mi ero dimenticato di mettere le credenziali di autenticazione.... nel mio server c'erano.
Infatti il motivo per cui ti ho scritto non è per segnalare un malfunzionamento ma per chiederti un consiglio.

La mia riflessione nasce appunto dalle differenze di funzionamento tra authsenders-smtproutes e dalla necessità di dover utilizzare il primo perché il secondo non mi permette l'autenticazione.
Giustamente authsenders analizza il mittente della mail e in base ad esso decide con quale server inviare, con relative credenziali di accesso.
Smtproutes invece analizza il destinatario e successivamente lo invia tramite il server specificato... unica pecca non potergli dare delle credenziali di autenticazione.

La patch che ti segnalo io invece, fa esattamente quello che mi servirebbe ma dovrei rinunciare alla tua patch per via dei conflitti.. poi comunque non supporta il cram-md5... sarebbe magari più indicata questa
http://www.ingorohloff.de/soft/qmail.html
ma mi rendo conto di volere la botte piena e la moglie ubriaca e sappiamo tutti che non è possibile.

Ad ogni modo se tu riuscissi nella magia sarei l'uomo più contento del mondo, e probabilmente non solo io visto il numero di patch presenti sull'argomento.
Ringraziandoti ancora per la disponibilità ti saluto.

Carlo

Rispondi |

qmail-auth-0.8.1

Carlo, leggendo il README della nuova patch qmail-auth di e. hoffmann http://www.fehcom.de/qmail/smtpauth.html mi è tornata in mente la tua richiesta. Sembra che vi sia il supporto per l'autenticazione in base al dominio di destinazione in qmail-remote.

Io però non so se/quando avrò il tempo di aggiornare la mia patch combinata..

***

EDIT: la giornata di pasqua era così noiosa.. così ho aggiornato la mia patch combinata :)

Rispondi |

Re: differenza

ora ho capito cosa vuoi dire...

rilasciare una variante della mia patch combinata? non ne ho il tempo.. come puoi ben capire è già molto impegntivo curarne una :) se proprio sei interessato potrei farlo come consulenza.

ti consiglio però di provare a cassare la parte qmail-remote della qmail-auth di e. hoffmann e inserire quell'altra. Toglierla tutta non mi pare una buona idea perchè non ti consentiebbe di usare l'autenticazione su qmail.smtpd

ciao :)

Rispondi |

qmail problems

Ciao ho due problemi, il primo è che gmail non riesce a scaricare dal pop3 sulla 110 riceve connection timeout, se mi loggo da telnet mi autentica senza alcun problema o timeout. Il secondo problema è che l'smtp auth è abilitato il certificato c'è, ma se proprio a inviare mail da outlook non ci riesco mi richiede sempre la password di invio come se fosse sbagliata. Uso vpopmai con maildir ma non autenticazione a db quella normale... sapresti darmi delle indicazioni? Prima di procedere al patch dell'smtp auth, qmail funzionava correttamente...

Rispondi |

stai usando la mia patch?

Ciao, stai usando la mia patch combinata?

E' un po' poco per capire che succede.. se stai usando la mia patch e seguendo la mia guida mandami i log di pop3 e di smtp usando il contatto in alto e ci sentiamo via mail

Rispondi |

Ciao Roberto,Se provo a

Ciao Roberto,

Se provo a scriverti dal menu in alto "contact", quando provo a inviare crasha e non riesco a spedirti nulla. Se mi scrivi direttamente all'email facciamo prima!

Nel mio caso però c'è qualcosa che non va..
La mia esigenza è abilitare l'auth sulla stessa porta 25 senza aprirne un'altra. Inoltre utilizzo vpopmail con autenticazione classica e non da db, in pratica ho tutta la struttura su files.

Ho installato la tua patch combinata e sia TLS che l'AUTH vengono abilitati.
Ma ho il seguente problema il POP3 dall'esterno va sempre in timeout (da localhost no) e l'autenticazione provandola da outlook e da telnet non va a buon fine, temo che chkuser si aspetti che le mail esistano su db quando in realtà non ci sono, xkè sono su file.

Inoltre non posso più ricevere posta xkè l'smtp respinge le mail siccome per lui non esistono e quindi le manda indietro con "delivery failed".

Purtroppo dai logs in /var/log/qmail/smtpd e /var/log/qmail/pop3
non emergono errori, nessun denied o auth failed.

Non so come fornirti maggiori dettagli

Grazie!

Rispondi |

Ultimi commenti
Vedi anche...
Articoli recenti

RSS feeds