Qmail LDAP Authentication: Difference between revisions

From QmailToaster
Jump to navigation Jump to search
(Created page with "# wget https://raw.githubusercontent.com/qmtoaster/source/main/qldapauth.c # gcc -o qdovauth qdovauth.c # mv qdovauth /home/vpopmail/bin # chown vpopmail:vchkpw /home/vpopmail/bin/qdovauth # chmod 755 /home/vpopmail/bin/qdovauth Add services to Dovecot configuration file service stats { unix_listener stats-reader { user = vpopmail group = vchkpw mode = 0660 } unix_listener stats-writer { user = vpopmail group = vchkpw mode = 0660...")
 
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Configuration#Qmail_LDAP_Authentication | Back]]<br>
To authenticate Qmail Submssion/SMTPS  against LDAP server instead of vpopmail download and compile [[https://github.com/qmtoaster/source/blob/main/qldapauth.c this]] file
<pre>
# wget https://raw.githubusercontent.com/qmtoaster/source/main/qldapauth.c
# wget https://raw.githubusercontent.com/qmtoaster/source/main/qldapauth.c
# gcc -o qdovauth qdovauth.c
# dnf install openldap-devel
# mv qdovauth /home/vpopmail/bin
# g++ -o qldapauth qldapauth.cpp -lldap
# chown vpopmail:vchkpw /home/vpopmail/bin/qdovauth
# mv qldapauth /home/vpopmail/bin
# chmod 755 /home/vpopmail/bin/qdovauth
# chown vpopmail:vchkpw /home/vpopmail/bin/qldapauth
 
# chmod 755 /home/vpopmail/bin/qldapauth
Add services to Dovecot configuration file
 
service stats {
    unix_listener stats-reader {
    user = vpopmail
    group = vchkpw
    mode = 0660
    }
    unix_listener stats-writer {
    user = vpopmail
    group = vchkpw
    mode = 0660
    }
}
 
service auth {
  unix_listener auth-qmail {
  mode = 0600
  user = vpopmail
  group = vchkpw
  }
}
 
# systemctl restart dovecot


Change Submission & SMTPS run files:
Change Submission & SMTPS run files:


#VCHKPW="/home/vpopmail/bin/vchkpw"
#VCHKPW="/home/vpopmail/bin/vchkpw"
VCHKPW="/home/vpopmail/bin/qdovauth"
VCHKPW="/home/vpopmail/bin/qldapauth"
export LDAP_HOST="192.168.1.x"
export LDAP_PORT=389


# qmailctl stop
# qmailctl stop
# qmailctl start
# qmailctl start


You should be good to go.
Check for success (or failure) in /var/log/maillog.


Check for success (or failure) in /var/log/maillog, add to run file
...qldapauth[246984]: Auth succeded for: administrator@domain.tld:192.168.1.x
export QDOVAUTH_LOG=""
or
...qldapauth[246984]: Auth failed for: administrator@domain.tld:192.168.1.x


 
</pre>
...qdovauth[210722]: passdb: user@domain.tld auth succeeded:IP:127.0.0.1
or
...qdovauth[210722]: passdb: user@domain.tld auth failed:IP:127.0.0.1

Latest revision as of 03:07, 15 October 2024

Back
To authenticate Qmail Submssion/SMTPS against LDAP server instead of vpopmail download and compile [this] file

# wget https://raw.githubusercontent.com/qmtoaster/source/main/qldapauth.c
# dnf install openldap-devel
# g++ -o qldapauth qldapauth.cpp -lldap
# mv qldapauth /home/vpopmail/bin
# chown vpopmail:vchkpw /home/vpopmail/bin/qldapauth
# chmod 755 /home/vpopmail/bin/qldapauth

Change Submission & SMTPS run files:

#VCHKPW="/home/vpopmail/bin/vchkpw"
VCHKPW="/home/vpopmail/bin/qldapauth"
export LDAP_HOST="192.168.1.x"
export LDAP_PORT=389

# qmailctl stop
# qmailctl start

Check for success (or failure) in /var/log/maillog.

...qldapauth[246984]: Auth succeded for: administrator@domain.tld:192.168.1.x
or
...qldapauth[246984]: Auth failed for: administrator@domain.tld:192.168.1.x