Another question about mail server.
I follow many tutorial and their instructions to set up a mail server on my Freebsd11 machine.
when I run the
I define user vamil with uid:5000 and group vmail with gid 5000 in my system.
These are the steps:
1. install openldap
2. install postfix
3. install dovecot
The configs are:
#dovecot.conf
#dovecot-ldap.conf
# postfix/main.cf
#postfix/master.cf
# example.ldif is:
Sorry, my post is too long.
Thanks
I follow many tutorial and their instructions to set up a mail server on my Freebsd11 machine.
when I run the
swaks --from user1@example.com --to user2@example.com --server <ip>:25
, the output of /var/log/dovecot-error is:
Code:
deliver(user2@example.com): Fatal: setuid(5002) failed with euid=5001(vmail): Operation not permitted (This binary should probably be called with process user set to 5002 instead of 5001(vmail))
These are the steps:
1. install openldap
2. install postfix
3. install dovecot
The configs are:
#dovecot.conf
Code:
base_dir = /var/run/dovecot/
protocols = imap pop3
protocol imap {
listen = *:143
}
protocol pop3 {
listen= *:110
}
disable_plaintext_auth = no
log_path = /var/log/dovecot-error
info_log_path = /var/log/dovecot-info
ssl = no
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_greeting = Dovecot ready.
mail_location = maildir:~/Maildir/%u
mail_privileged_group = mail
dotlock_use_excl = yes
verbose_proctitle = yes
first_valid_uid = 1000
first_valid_gid = 1000
protocol imap {
login_executable = /usr/local/libexec/dovecot/imap-login
mail_executable = /usr/local/libexec/dovecot/imap
imap_client_workarounds = delay-newmail netscape-eoh tb-extra-mailbox-sep
}
protocol pop3 {
login_executable = /usr/local/libexec/dovecot/pop3-login
mail_executable = /usr/local/libexec/dovecot/pop3
pop3_uidl_format = %08Xu%08Xv
mail_max_userip_connections = 3
mail_plugin_dir = /usr/local/lib/dovecot/pop3
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol managesieve {
login_executable = /usr/local/libexec/dovecot/managesieve-login
mail_executable = /usr/local/libexec/dovecot/managesieve
}
protocol lda {
postmaster_address = postmaster@example.com
mail_plugin_dir = /usr/local/lib/dovecot/lda
sendmail_path = /usr/sbin/sendmail
auth_socket_path = /var/run/dovecot/auth-master
}
auth_executable = /usr/local/libexec/dovecot/dovecot-auth
auth_process_size = 256
auth_username_format = %Lu
auth default {
mechanisms = plain login
user=postfix
passdb ldap {
args = /usr/local/etc/dovecot-ldap.conf
}
userdb passwd {
args = blocking=yes
}
userdb ldap {
args = /usr/local/etc/dovecot-ldap.conf
}
user = root
socket listen {
master {
path = /var/run/dovecot/auth-master
}
client {
path = /var/run/dovecot/auth-client
mode = 0660
user = postfix
group = postfix
}
}
}
dict_db_config = /usr/local/etc/dovecot-db.conf
#dovecot-ldap.conf
Code:
hosts = localhost
debug_level = -1
auth_bind = no
ldap_version = 3
base =ou=people,dc=example,dc=com
deref = never
scope = subtree
user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailStorageDirectory=mail
user_filter = (&(objectClass=postfixUser)(uid=%n))
pass_attrs = uid=user,userPassword=password
pass_filter = (&(objectClass=postfixUser)(uid=%n))
default_pass_scheme = LDAP-MD5
# postfix/main.cf
Code:
inet_interfaces = all
inet_protocols = ipv4
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
myhostname = mail.example.com
append_dot_mydomain = no
mynetworks =
# Local
127.0.0.0/8
# External
*.*.*.*/24
local_transport = error:Local Transport Disabled
alias_maps = hash:/etc/aliases
mydomain = example.com
mydestination =
$myhostname
localhost.$mydomain
localhost
virtual_transport = dovecot
smtpd_sasl_auth_enable = yes
Code:
dovecot unix - n n - - pipe
flags=ODRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -e -f ${sender} -d ${recipient}
# example.ldif is:
Code:
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: example
dc: example
dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: people
dn: ou=services,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: services
dn: uid=postfix,ou=services,dc=example,dc=com
objectClass: account
objectClass: top
uid: postfix
dn: uid=dovecot,ou=services,dc=example,dc=com
objectClass: account
objectClass: top
uid: dovecot
dn: uid=user1,ou=people,dc=example,dc=com
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: postfixUser
objectClass: extensibleObject
cn: user1
givenName: user1
mail: user1@example.com
mailEnabled: TRUE
mailGidNumber: 5000
mailHomeDirectory: /var/vmail/user1@example.com
mailQuota: 10240
mailStorageDirectory: maildir:/vmail/user1@example.com/Maildir
mailUidNumber: 5002
sn: Some2
uid: user1
userPassword: ******
dn: uid=user2,ou=people,dc=example,dc=com
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: postfixUser
objectClass: extensibleObject
cn: user2
givenName: user2
mail: user2@example.com
mailEnabled: TRUE
mailGidNumber: 5000
mailHomeDirectory: /var/vmail/user2@example.com
mailQuota: 10240
mailStorageDirectory: maildir:/vmail/user2@example.com/Maildir
mailUidNumber: 5003
sn: Some3
uid: user2
userPassword: ******
Thanks