Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Postfix virtual users

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
17 posts • Page 1 of 1
Author
Message
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

Postfix virtual users

  • Quote

Post by Ward » Fri Dec 01, 2006 4:35 pm

I'm trying to configure my postfix with virtual users.

Now I made my databases but i can't login! with normal users it works but with virtual not. There is some error with a query.

I've included config file, database setup,error so you have an idea

Thanks!

main.cf

Code: Select all

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
myorigin = localhost
myhostname = eddy.be
mydestination = eddy.be, localhost, localhost.Belkin, Belkin
unknown_local_recipient_reject_code = 450
mynetworks_style = subnet
mynetworks = 127.0.0.0/8 192.168.2.0/24
mailbox_command = /usr/bin/procmail
debug_peer_level = 3
debugger_command =
        PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:
        xxgdb = $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
manpage_directory = /usr/share/man
readme_directory = /usr/share/doc/postfix-2.1.5-r2/readme
default_destination_concurrency_limit = 2
alias_database = hash:/etc/mail/aliases
local_destination_concurrency_limit = 2
alias_maps = hash:/etc/mail/aliases
home_mailbox = .maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_sasl_authenticated, reject_unauth_destination
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/ssl/postfix/server.key
smtpd_tls_cert_file = /etc/ssl/postfix/server.crt
smtpd_tls_CAfile = /etc/ssl/postfix/server.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom


#virtual_alias_maps=mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps=mysql:/etc/postfix/mysql-virtual_mailboxes.cf
#virtual_mailbox_base=/usr/local/virtual
virtual_transport = virtual
virtual_uid_maps=static:5000
virtual_gid_maps=static:5000
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

mysql_virtual_alias_maps.cf

Code: Select all

user = root
password = *
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
mysql_virtual_domains_maps.cf

Code: Select all

user = root
password = *
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain

mysql-virtual_mailboxes.cf

Code: Select all

user = root
password = *
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
my postfix database

Code: Select all

+-------------------+
| Tables_in_postfix |
+-------------------+
| admin             |
| alias             |
| domain            |
| domain_admins     |
| log               |
| mailbox           |
| vacation          |
+-------------------+
7 rows in set (0.00 sec)
Alias Table

Code: Select all

+----------------------+-------------------------------------------+-------------+---------------------+---------------------+--------+
| address              | goto                                      | domain      | created             | modified            | active |
+----------------------+-------------------------------------------+-------------+---------------------+---------------------+--------+
| abuse@localhost      | abuse@change-this-to-your.domain.tld      | localhost   | 2000-01-01 01:29:50 | 2000-01-01 01:29:50 |      1 |
| hostmaster@localhost | hostmaster@change-this-to-your.domain.tld | localhost   | 2000-01-01 01:29:50 | 2000-01-01 01:29:50 |      1 |
| postmaster@localhost | postmaster@change-this-to-your.domain.tld | localhost   | 2000-01-01 01:29:50 | 2000-01-01 01:29:50 |      1 |
| webmaster@localhost  | webmaster@change-this-to-your.domain.tld  | localhost   | 2000-01-01 01:29:50 | 2000-01-01 01:29:50 |      1 |
| test@spamstop.be     | test@spamstop.be                          | spamstop.be | 2000-01-01 01:51:05 | 2000-01-01 01:51:05 |      1 |
| test@eddy.be         | test@eddy.be                              | eddy.be     | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |      1 |
+----------------------+-------------------------------------------+-------------+---------------------+---------------------+--------+
Domain table

Code: Select all

+-------------+---------------+---------+-----------+----------+-----------+----------+---------------------+---------------------+--------+
| domain      | description   | aliases | mailboxes | maxquota | transport | backupmx | created             | modified            | active |
+-------------+---------------+---------+-----------+----------+-----------+----------+---------------------+---------------------+--------+
| localhost   | -             |       0 |         0 |        0 | virtual   |        0 | 2000-01-01 01:29:50 | 2000-01-01 01:29:50 |      1 |
| spamstop.be | spamstop test |       0 |         0 |        0 | virtual   |        0 | 2000-01-01 01:50:43 | 2000-01-01 01:50:43 |      1 |
| eddy.be     |               |       0 |         0 |        0 | virtual   |        0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |      1 |
+-------------+---------------+---------+-----------+----------+-----------+----------+---------------------+---------------------+--------+
3 rows in set (0.00 sec)

Mailbox Table

Code: Select all

+------------------+------------------------------------+------+---------------------------+-------+-------------+---------------------+---------------------+--------+
| username         | password                           | name | maildir                   | quota | domain      | created             | modified            | active |
+------------------+------------------------------------+------+---------------------------+-------+-------------+---------------------+---------------------+--------+
| test@spamstop.be | $1$e40dd70b$cvT4gKIrB4KbsK5RVg1WV0 |      | test@spamstop.be/         |     0 | spamstop.be | 2000-01-01 01:51:05 | 2000-01-01 01:51:05 |      1 |
| test@eddy.be     | test                               | test | /var/virtual/eddy.be/test |     0 | eddy.be     | 2006-11-30 00:00:00 | 2006-11-22 00:00:00 |      1 |
+------------------+------------------------------------+------+---------------------------+-------+-------------+---------------------+---------------------+--------+

messages

Code: Select all

Jan  1 01:26:08 eddy postfix/virtual[5748]: fatal: bad string length 0 < 1: virtual_mailbox_base =
Jan  1 01:26:09 eddy postfix/master[5357]: warning: process /usr/lib/postfix/virtual pid 5748 exit status 1
Jan  1 01:26:09 eddy postfix/master[5357]: warning: /usr/lib/postfix/virtual: bad command startup -- throttling
Jan  1 01:27:01 eddy pop3d: Connection, ip=[::ffff:192.168.2.2]
Jan  1 01:27:01 eddy pop3d: LOGIN, user=esger, ip=[::ffff:192.168.2.2]
Jan  1 01:27:01 eddy pop3d: LOGOUT, user=esger, ip=[::ffff:192.168.2.2], top=0, retr=0, time=0
Jan  1 01:27:01 eddy pop3d: Connection, ip=[::ffff:192.168.2.2]
Jan  1 01:27:01 eddy pop3d: LOGIN FAILED, user=test, ip=[::ffff:192.168.2.2]
Jan  1 01:27:06 eddy pop3d: Disconnected, ip=[::ffff:192.168.2.2]
Jan  1 01:27:09 eddy postfix/virtual[5753]: fatal: bad string length 0 < 1: virtual_mailbox_base =
Jan  1 01:27:10 eddy postfix/master[5357]: warning: process /usr/lib/postfix/virtual pid 5753 exit status 1
Jan  1 01:27:10 eddy postfix/master[5357]: warning: /usr/lib/postfix/virtual: bad command startup -- throttling

Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Fri Dec 01, 2006 5:29 pm

Needs:

Code: Select all

virtual_mailbox_base = /what/ever/it/is 
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Fri Dec 01, 2006 6:57 pm

magic919 wrote:Needs:

Code: Select all

virtual_mailbox_base = /what/ever/it/is 

how does it work then ? he makes the dir with:

/what/ever/it/is + maildir field in mysql table mailbox

?
Top
geaaru
n00b
n00b
User avatar
Posts: 73
Joined: Fri Feb 25, 2005 11:55 pm

  • Quote

Post by geaaru » Sat Dec 02, 2006 10:17 am

Try with
virtual_mailbox_base = /var/spool/mail/

If i remember correctly is mailbox/maildir directory where postfix save messages.

If it works said me.. :)

good work!
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Sat Dec 02, 2006 10:58 am

Ward wrote:
magic919 wrote:Needs:

Code: Select all

virtual_mailbox_base = /what/ever/it/is 

how does it work then ? he makes the dir with:

/what/ever/it/is + maildir field in mysql table mailbox

?
Yes, that's it. Postfix then knows where to start creating the directories and maildirs for the virtual users. I made the directory by hand on mine.
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Sat Dec 02, 2006 12:30 pm

I've changed this in my main.cf

Code: Select all

virtual_mailbox_base= /var/virtual/eddy.be/
and the path exists with a map test for my test user!

In the mailbox table in the test@eddy.be record the mailbox field is set to test

Code: Select all

Jan  1 21:19:49 eddy postfix/trivial-rewrite[5773]: warning: do not list domain eddy.be in BOTH mydestination and virtual_mailbox_domains
Jan  1 21:19:50 eddy postfix/smtpd[5814]: NOQUEUE: reject: RCPT from unknown[192.168.2.2]: 450 <test@eddy.be>: Recipient address rejected: User unknown in local recipient table; from=<ward@loockx.be> to=<test@eddy.be> proto=SMTP helo=<test>
Jan  1 21:20:01 eddy cron[5825]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
Now I get this error but I saw that the domain (eddy.be) is added to my domains table so what is wrong?
Top
geaaru
n00b
n00b
User avatar
Posts: 73
Joined: Fri Feb 25, 2005 11:55 pm

  • Quote

Post by geaaru » Sat Dec 02, 2006 2:08 pm

Try also this options on main.cf file:

comment myorigin voice because it is used default myhostname field.
then try to set

Code: Select all

inet_interfaces = all
mydestination = $myhostname, localhost
virtual_minimum_id = 5000
# Generate maildirsize files or not
virtual_create_maildirsize = yes
# I use Courier IMAP compatibles files.
virtual_maildir_extended = yes
and then verify your /etc/hosts files if it contains eddy.be name
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Sat Dec 02, 2006 2:27 pm

geaaru wrote:Try also this options on main.cf file:

comment myorigin voice because it is used default myhostname field.
then try to set

Code: Select all

inet_interfaces = all
mydestination = $myhostname, localhost
virtual_minimum_id = 5000
# Generate maildirsize files or not
virtual_create_maildirsize = yes
# I use Courier IMAP compatibles files.
virtual_maildir_extended = yes
and then verify your /etc/hosts files if it contains eddy.be name

Changed it and my hosts file contains my eddy.be record but still it isn't working
Top
geaaru
n00b
n00b
User avatar
Posts: 73
Joined: Fri Feb 25, 2005 11:55 pm

  • Quote

Post by geaaru » Sat Dec 02, 2006 5:25 pm

Always same errors from log?
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Sat Dec 02, 2006 5:34 pm

geaaru wrote:Always same errors from log?
yes

Code: Select all

Dec  2 18:32:58 eddy postfix/smtpd[24162]: NOQUEUE: reject: RCPT from unknown[192.168.2.2]: 450 <test@eddy.be>: Recipient address rejected: User unknown in local recipient table; from=<ward@loockx.be> to=<test@eddy.be> proto=SMTP helo=<lol>
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Sat Dec 02, 2006 10:23 pm

Notice that it thinks test@eddy.be is a LOCAL user. Should be a virtual user.

Heed the Postfix error message and take it out of mydestination.
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Sun Dec 03, 2006 10:27 pm

magic919 wrote:Notice that it thinks test@eddy.be is a LOCAL user. Should be a virtual user.

Heed the Postfix error message and take it out of mydestination.
Ok this works thank you

But know he complains about a dir! that's my maildir for the test account and it's created! So why doesn't he put the mail in there ? what file does he needs to open?

Code: Select all

Jan  3 07:18:56 eddy postfix/virtual[5823]: 7B7A12D802: to=<test@eddy.be>, relay=virtual, delay=228, status=deferred (mailbox /var/virtual/eddy.be/test: cannot open file: Is a directory)
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Mon Dec 04, 2006 5:52 am

Let Postfix create that directory and it should be fine.
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Mon Dec 04, 2006 9:52 am

Code: Select all

(mailbox /var/virtual/eddy.be/test: cannot create file exclusively: Permission denied)
i've try'd chmod +xwr but wont work
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Mon Dec 04, 2006 5:43 pm

Sounds like you might have permissions/ownership problem with /var/virtual/.
Top
Ward
n00b
n00b
Posts: 74
Joined: Fri Oct 06, 2006 10:29 am

  • Quote

Post by Ward » Mon Dec 04, 2006 10:13 pm

Everything works good know except for one thing

I can't login to my virtuals user accounts with mailclients or command line!

I still get

Code: Select all

Dec  4 23:11:40 eddy pop3d: LOGIN FAILED, user=test@eddy.be, ip=[::ffff:192.168.2.2]
Dec  4 23:11:45 eddy pop3d: Disconnected, ip=[::ffff:192.168.2.2]
I've watched for a wrong query but can't find one or mistake with user table (mailbox table)
Top
magic919
Advocate
Advocate
Posts: 2182
Joined: Fri Jun 17, 2005 7:31 am
Location: Berkshire, UK

  • Quote

Post by magic919 » Tue Dec 05, 2006 8:28 am

This is not a Postfix problem as Postfix does not serve up the POP mail. Start a new thread with details of your POP server.
Top
Post Reply

17 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic