Issues with Postfix using "Virtual Users And Domains With Postfix, Courier And MySQL"

Discussion in 'HOWTO-Related Questions' started by Kyse, Jan 3, 2007.

  1. Kyse

    Kyse New Member

    Hello, I recently installed Zod - Fedora Core 6 and have been running through this HowTO "Virtual Users And Domains With Postfix, Courier And MySQL (Fedora Core 5)". I completed everything up to the point you telnet localhost 25, and receive no response back from postfix. See the quote box:

    HTML:
    [root@lace ~]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    
    Some background for anyone able to assist me: Currently have kyse.us domain. kyse.us points directly to my box (for purposes of letting people using port 27910 for quake 2 connect). www.kyse.us is redirected to www2.kyse.us:81, and webmail.kyse.us is directed to webmail2.kyse.us:81. My intension is to leave www.kyse.us for regular web space, and use the webmail.kyse.us for connecting to the mail on this server, and also using a webmail interface if I can get one set up. The box is behind a router/firewall, however the ports are open. SELinux is disable, as is the box's firewall.

    /etc/hosts file:
    HTML:
    [root@lace ~]# cat /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1       localhost.localdomain   localhost
    192.168.1.7     webmail2.kyse.us        webmail2
    [root@lace ~]#
    /etc/postfix/main.cf file - edited out a bunch of #Description lines to reduce post to 10k.
    HTML:
    [root@lace ~]# cat /etc/postfix/main.cf
    
    
    # SOFT BOUNCE
    #soft_bounce = no
    
    # LOCAL PATHNAME INFORMATION
    queue_directory = /var/spool/postfix
    
    command_directory = /usr/sbin
    
    daemon_directory = /usr/libexec/postfix
    
    # QUEUE AND PROCESS OWNERSHIP
    
    mail_owner = postfix
    
    
    #default_privs = nobody
    
    # INTERNET HOST AND DOMAIN NAMES
    
    #myhostname = domain.tld
    #myhostname = virtual.domain.tld
    
    mydomain = kyse.us
    myhostname = webmail2.$mydomain
    # SENDING MAIL
    
    #myorigin = $myhostname
    #myorigin = $mydomain
    
    # RECEIVING MAIL
    
    
    #inet_interfaces = all
    #inet_interfaces = $myhostname
    #inet_interfaces = $myhostname, localhost
    inet_interfaces = all
    
    #proxy_interfaces =
    #proxy_interfaces = 1.2.3.4
    
    
    mydestination = localhost, localhost.localdomain, localhost.$mydomain
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
    #       mail.$mydomain, www.$mydomain, ftp.$mydomain
    
    # REJECTING MAIL FOR UNKNOWN LOCAL USERS
    
    #local_recipient_maps = unix:passwd.byname $alias_maps
    #local_recipient_maps = proxy:unix:passwd.byname $alias_maps
    #local_recipient_maps =
    
    unknown_local_recipient_reject_code = 550
    
    # TRUST AND RELAY CONTROL
    
    #mynetworks_style = class
    #mynetworks_style = subnet
    mynetworks_style = host
    
    
    #mynetworks = 168.100.189.0/28, 127.0.0.0/8
    #mynetworks = $config_directory/mynetworks
    #mynetworks = hash:/etc/postfix/network_table
    
    #relay_domains = $mydestination
    
    # INTERNET OR INTRANET
    
    #relayhost = $mydomain
    #relayhost = [gateway.my.domain]
    #relayhost = [mailserver.isp.tld]
    #relayhost = uucphost
    #relayhost = [an.ip.add.ress]
    
    # REJECTING UNKNOWN RELAY USERS
    
    #relay_recipient_maps = hash:/etc/postfix/relay_recipients
    
    # INPUT RATE CONTROL
    
    #in_flow_delay = 1s
    
    # ADDRESS REWRITING
    # "USER HAS MOVED" BOUNCE MESSAGES
    
    # TRANSPORT MAP
    
    # ALIAS DATABASE
    
    #alias_maps = dbm:/etc/aliases
    alias_maps = hash:/etc/aliases
    #alias_maps = hash:/etc/aliases, nis:mail.aliases
    #alias_maps = netinfo:/aliases
    
    
    #alias_database = dbm:/etc/aliases
    #alias_database = dbm:/etc/mail/aliases
    alias_database = hash:/etc/aliases
    #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
    
    # ADDRESS EXTENSIONS (e.g., user+foo)
    
    #recipient_delimiter = +
    
    # DELIVERY TO MAILBOX
    
    #home_mailbox = Mailbox
    #home_mailbox = Maildir/
     
    
    #mail_spool_directory = /var/mail
    #mail_spool_directory = /var/spool/mail
    
    
    # IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
    # ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
    #
    #mailbox_command = /some/where/procmail
    #mailbox_command = /some/where/procmail -a "$EXTENSION"
    
    #mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
    
    mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
    
    # local_destination_recipient_limit = 300
    # local_destination_concurrency_limit = 5
    
    # To use the old cyrus deliver program you have to set:
    #mailbox_transport = cyrus
    
    
    #fallback_transport = lmtp:unix:/var/lib/imap/socket/lmtp
    #fallback_transport =
    
    
    
    #luser_relay = $user@other.host
    #luser_relay = $local@other.host
    #luser_relay = admin+$local
      
    
    #header_checks = regexp:/etc/postfix/header_checks
    
    # FAST ETRN SERVICE
    
    #fast_flush_domains = $relay_domains
    
    # SHOW SOFTWARE VERSION OR NOT
    
    #smtpd_banner = $myhostname ESMTP $mail_name
    #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
    
    # PARALLEL DELIVERY TO THE SAME DESTINATION
    
    #local_destination_concurrency_limit = 2
    #default_destination_concurrency_limit = 20
    
    # DEBUGGING CONTROL
    
    debug_peer_level = 2
    
    
    #debug_peer_list = 127.0.0.1
    #debug_peer_list = some.domain
    
    
    debugger_command =
             PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
             xxgdb $daemon_directory/$process_name $process_id & sleep 5
    
    
    # debugger_command =
    #       PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont;
    #       echo where) | gdb $daemon_directory/$process_name $process_id 2>&1
    #       >$config_directory/$process_name.$process_id.log & sleep 5
    #
    # Another possibility is to run gdb under a detached screen session.
    # To attach to the screen sesssion, su root and run "screen -r
    # <id_string>" where <id_string> uniquely matches one of the detached
    # sessions (from "screen -list").
    #
    # debugger_command =
    #       PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; screen
    #       -dmS $process_name gdb $daemon_directory/$process_name
    #       $process_id & sleep 1
    
    # INSTALL-TIME CONFIGURATION INFORMATION
    #
    # The following parameters are used when installing a new Postfix version.
    # 
    # sendmail_path: The full pathname of the Postfix sendmail command.
    # This is the Sendmail-compatible mail posting interface.
    # 
    sendmail_path = /usr/sbin/sendmail.postfix
    
    # newaliases_path: The full pathname of the Postfix newaliases command.
    # This is the Sendmail-compatible command to build alias databases.
    #
    newaliases_path = /usr/bin/newaliases.postfix
    
    # mailq_path: The full pathname of the Postfix mailq command.  This
    # is the Sendmail-compatible mail queue listing command.
    # 
    mailq_path = /usr/bin/mailq.postfix
    
    # setgid_group: The group for mail submission and queue management
    # commands.  This must be a group name with a numerical group ID that
    # is not shared with other accounts, not even with the Postfix account.
    #
    setgid_group = postdrop
    
    # html_directory: The location of the Postfix HTML documentation.
    #
    html_directory = no
    
    # manpage_directory: The location of the Postfix on-line manual pages.
    #
    manpage_directory = /usr/share/man
    
    # sample_directory: The location of the Postfix sample configuration files.
    # This parameter is obsolete as of Postfix 2.1.
    #
    sample_directory = /usr/share/doc/postfix-2.3.3/samples
    
    # readme_directory: The location of the Postfix README files.
    #
    readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
    myhostname = webmail2.kyse.us
    mynetworks = 127.0.0.0/8
    virtual_alias_domains = 
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    smtpd_sasl_local_domain = $myhostname
    I can post more of the file contents if there are other files you might need to see.

    Thank you,

    Kyse
     
  2. Kyse

    Kyse New Member

    Also, I know im getting a little ahead of myself. But is there a webmail program that works with this setup, that will let me have the following conclusion:

    I log into webmail using kyse as login name.

    I can view kyse@kyse.us email, view kyse@anotherisp.email, view kyse@anotherisp2.email?

    Thanks,

    Kyse
     
  3. Kyse

    Kyse New Member

    After messing around with some things I got it to say something when I telnet in, but found another problem :/ I have no idea where this protocol mismatch comes from, but will post configs upon request. Heh...

    Here's what the telnet session does now.

    HTML:
    [root@webmail2 ~]# telnet localhost 22
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    SSH-2.0-OpenSSH_4.3
    ehlo localhost
    Protocol mismatch.
    Connection closed by foreign host.
    [root@webmail2 ~]# 
     
  4. martinfst

    martinfst HowtoForge Supporter

    Port 22 is for ssh communication. If you really want telnet (never do this if your accessing systems on the Internet) then use port 21.

    But as you are on a linux box, why not use the 'ssh' client command? It's there or if not, it's easily installed. just type
    Code:
    ssh
    But you're testing your mail server, right? (just skimming though your posting):eek: ...
    Then you should use
    Code:
    telnet localhost [B]25[/B]
     
  5. Kyse

    Kyse New Member

    Aw man, I fooled myself. looks like postfix still isn't working. :(
     
  6. Kyse

    Kyse New Member

    Here's the /var/log/maillog

    HTML:
    Jan  3 16:18:55 lace postfix/proxymap[8696]: fatal: unsupported dictionary type: mysql
    Jan  3 16:18:56 lace postfix/master[7883]: warning: process /usr/libexec/postfix/proxymap pid 8696 exit status 1
    Jan  3 16:18:56 lace postfix/master[7883]: warning: /usr/libexec/postfix/proxymap: bad command startup -- throttling
    Jan  3 16:18:56 lace postfix/smtpd[7975]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan  3 16:18:56 lace postfix/smtpd[7975]: warning: private/proxymap socket: service dict_proxy_open: Success
    
    Think that could have something to do with it?
     
  7. Kyse

    Kyse New Member

    Got some of the warnings gone, still having trouble with this one from my /var/log/maillog file

    Any ideas?
     
  8. Kyse

    Kyse New Member

    Ok, I think I've got why this is happening figured out.

    1) when trying to buildrpm, I get the message '-mcpu=' is deprecated. Use '-mtune=' or '-march=' instead.

    2) RPM is not placed in /usr/src/redhat/RPMS/i386/ or /usr/src/redhat/RPMS/*/ even..

    3) I downloaded the postfix-2.2.8-2.3.i386.rpm and attempted to rpm it and got the following errors: file * from install of postfix-2.2.8-1.2 conflicts with file from package postfix-2.3.3-2

    So, 1, postfix wasn't patched due to rpmbuild errors creating no rpm for me to install. And 3, now I can't even install the older postfix cause the newer version is out. Anyone know a way to fix this issue so I can either install the older RPM, or build my new 2.3.3 postfix?

    Thanks
     
  9. Kyse

    Kyse New Member

    OK falko, check it..

    I got it all working, now im trying to edit the database using mysql.

    it gives me the same error for editing domains as users but I have users to copy/paste, so here it is:

    mysql> INSERT INTO 'users' ('email', 'password', 'quota') VALUES ('kyse@kyse.us', ENCRYPT('blah'), 10485760);
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users' ('email', 'password', 'quota') VALUES ('kyse@kyse.us', ENCRYPT('blah' at line 1
    mysql>


    Any ideas? :p
     
  10. Kyse

    Kyse New Member

    OK, here's where I'm standing now... hehe..

    I can send and receive email to and from the one account I craeted in the databases now. kyse@kyse.us. However if I try to send an email to internal user accounts on the mail server, such as root@kyse.us or external email addresses such as kyse@cox.net, I get undeliverable return messages back to outlook.

    What am I missing? :(
     
  11. falko

    falko Super Moderator

    The correct syntax is

    Code:
    INSERT INTO users (email, password, quota) VALUES ('kyse@kyse.us', ENCRYPT('blah'), 10485760);
    What's in your mail log when this happens?
     
  12. Kyse

    Kyse New Member

    The very first email to cox.net didn't make it, but all the rest of them did, so thats ok. Apparently I need to get my ip address on a whitelist for verizon.net :/

    So, how can I set this up to receive my cox.net email from the cox web server?

    kyse@kyse.us
    Inbox
    Outbox
    Trash
    kyse@cox.net
    Inbox
    Outbox
    Trash

    make it where when I compose, I can choose which email address I want to send from (ie if I pick kyse@cox.net it sends via the cox.net smtp server).

    Too complicated or doable? hehe.
     
  13. Kyse

    Kyse New Member

    I can send/receive emails just fine from within the router config. From outside the routers network, I can connect/log to incoming and outgoing ports/server, however outlook says sending a test email failed. Any ideas as to why?
     
  14. falko

    falko Super Moderator

    What's the exact error message in Outlook? What's in your mail log when this happens?
     
  15. Kyse

    Kyse New Member

    I think what it is is, cox just like verizon wont allow sending mail unless you are using their smtp server? Anyways, I think I can get around that by having outlook use the isp smtp server to send the test email. Hopefully verizon will whitelist my domain sooner than later.

    I setup squirrelmail last night, works great with your setup. One thing I noticed is it's folder handling abilities isn't as good as I'd like.
    If you have a folder named Online Transactions, it dosn't work because looking for a directory Online Transactions causes it to find /Online/ which dosn't exist. In addition the created directories are not supported as far as the new mail notification and quota plugins are concerned. I'm sure the code can be edited for such purposes, but I am not that fimilar with php yet. Yea YET! :p
     
  16. falko

    falko Super Moderator

    If your ISP is blocking port 25, you can have a look here: http://www.howtoforge.com/forums/showthread.php?t=72&highlight=relayhost
     

Share This Page