The Perfect Setup - CentOS 4.4 (32-bit), How to add Virtual Users?

Discussion in 'Installation/Configuration' started by joshenry, Jan 19, 2007.

  1. joshenry

    joshenry New Member

    Hey, first post here. I'm a Linux newb and these walk throughs are great. I was able to get the server up and running within a couple hours. I even got the server working in a RAID0 configuration (Ooooo...Aaaaa) However I would like to host multiple domains and multiple emails per domain. From what I have read the easiest way to do this is with Virtual Domains.

    I've found walk throughs for VDs but not for CertOS. Since I'm so green at Linux, I can't figure out how to get it working. I'm pretty sure I've screwed things up pretty good now cause I can't even connect to the SMTP server that I've just made...I don't get a response at all.

    I pretty much have my setup as described in the perfect setup, might be some small changes as I've tried to mix this setup with another and another to see if I can get it working. I'm sorry if this question has been asked before, I couldn't find it on google. Also, please bear with me as I'm very basic with linux right now and I can't wrap my head around being able to get this thing working.:confused: :( :confused:

    Thanks for any help you can provide!


    PS - On a side note, I ran into an error during install:

    # mysqladmin -h 127.0.0.1 -u root password password
    mysqladmin: connect to server at '127.0.0.1' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'


    Or in the place of 127.0.0.1 I had the server name but it didn't make a difference. Not sure if that will be part of the problem or not but I'm sure I did something wrong here.
     
    Last edited: Jan 19, 2007
  2. martinfst

    martinfst Member Moderator

    That should be
    Code:
    # mysqladmin -h 127.0.0.1 -u root -p password
    Or leave 'password' out, and you'll be prompted to enter your password secretly.
     
  3. falko

    falko Super Moderator Howtoforge Staff

    What are you referring to when you say "virtual users"? Do you think of Postfix with MySQL and virtual users?
     
  4. joshenry

    joshenry New Member

    That's what I've read it's called. Have mysql as a back end where postfix pulls the info. People seem to call it Virtual Users. Also would like to have dovecot for an imap service like in the perfect setup.

    Thanks.
     
  5. falko

    falko Super Moderator Howtoforge Staff

  6. joshenry

    joshenry New Member

    Sweet, thanks. I'll go through that and see what I get.

    Thanks!
     
  7. joshenry

    joshenry New Member

    Hey, thanks again for the linky. I think I've got most of it working. However I'm at the following part in the How To:

    chkconfig --levels 235 amavisd on
    chkconfig --levels 235 clamd.amavisd on
    /usr/bin/freshclam
    /etc/init.d/amavisd start
    /etc/init.d/clamd.amavisd start

    I get through the virus database update but when I try to run /etc/init.d/amavisd start I get:

    # service amavisd start
    Starting amavisd: DBI version 1.43 required--this is only version 1.40 at /usr/sbin/amavisd line 9153.
    [FAILED]



    Line 9153 in /usr/sbin/amavisd:

    DBI->VERSION(1.43) if $extra_code_sql_base; # need working last_insert_id

    I changed it to:

    DBI->VERSION(1.40) if $extra_code_sql_base; # need working last_insert_id

    Am I going to break anything?

    Thanks.



    PS - Now for a problem. I'm quite tired right now so I'm going to leave it til tomorrow anyways but I'm pretty much done except two things:

    When I create the script for scanning mail then try to execute it "/usr/local/sbin/sa_rules_update.sh" it just drops one line and sits there til I hit Ctrl-C. I've tried recreating the script in case something got missed but no go.

    Also, when I try to telnet to the server on smtp it just drops a line and sits there (In Linux I can't exit the line, I have to close the window and restart the session). Does the same thing in windows...locks the window when I telnet to smtp :-/


    Well, thanks again everyone.
     
    Last edited: Jan 23, 2007
  8. falko

    falko Super Moderator Howtoforge Staff

    I don't know if this will break anything.
    But you could try to install the newest BDI like this:
    Code:
    perl -MCPAN -e shell
    install DBI
    q

    What the line it shows?
    Did you save the script with Unix linebreaks (Windows linebreaks don't work)? Did you disable SELinux?

    What's in /etc/postfix/main.cf (please strip out the comments)? What's the output of
    Code:
    hostname
    and
    Code:
    hostname -f
    ? What's in /etc/hosts? Any error messages in your mail log?
     
  9. joshenry

    joshenry New Member

    Alright, that is done. Didn't seem to make any difference when I restarted the server.

    It doesn't show any line, just drops one line and sits there blank.
    I edited the script using vi, so I'm assuming it will have Unix linebreaks in it. Here is the file:
    Code:
    #!/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/71_sare_redirect_pre3.0.0.cf -O 71_sare_redirect_pre3.0.0.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_bayes_poison_nxm.cf -O 70_sare_bayes_poison_nxm.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_html.cf -O 70_sare_html.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_html4.cf -O 70_sare_html4.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_html_x30.cf -O 70_sare_html_x30.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_header0.cf -O 70_sare_header0.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_header3.cf -O 70_sare_header3.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_header_x30.cf -O 70_sare_header_x30.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_specific.cf -O 70_sare_specific.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_adult.cf -O 70_sare_adult.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/72_sare_bml_post25x.cf -O 72_sare_bml_post25x.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/99_sare_fraud_post25x.cf -O 99_sare_fraud_post25x.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_spoof.cf -O 70_sare_spoof.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_random.cf -O 70_sare_random.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_oem.cf -O 70_sare_oem.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_genlsubj0.cf -O 70_sare_genlsubj0.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_genlsubj3.cf -O 70_sare_genlsubj3.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_genlsubj_x30.cf -O 70_sare_genlsubj_x30.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_unsub.cf -O 70_sare_unsub.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/70_sare_uri.cf -O 70_sare_uri.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://mywebpages.comcast.net/mkettler/sa/antidrug.cf -O antidrug.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.timj.co.uk/linux/bogus-virus-warnings.cf -O bogus-virus-warnings.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.yackley.org/sa-rules/evilnumbers.cf -O evilnumbers.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.stearns.org/sa-blacklist/random.current.cf -O random.current.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/88_FVGT_body.cf -O 88_FVGT_body.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/88_FVGT_rawbody.cf -O 88_FVGT_rawbody.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/88_FVGT_subject.cf -O 88_FVGT_subject.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/88_FVGT_headers.cf -O 88_FVGT_headers.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/88_FVGT_uri.cf -O 88_FVGT_uri.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/99_FVGT_DomainDigits.cf -O 99_FVGT_DomainDigits.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/99_FVGT_Tripwire.cf -O 99_FVGT_Tripwire.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.rulesemporium.com/rules/99_FVGT_meta.cf -O 99_FVGT_meta.cf &> /dev/null
    
    cd /etc/mail/spamassassin/ &> /dev/null && /usr/bin/wget http://www.nospamtoday.com/download/mime_validate.cf -O mime_validate.cf &> /dev/null
    
    /etc/init.d/amavis restart &> /dev/null
    
    exit 0
    
    <continued on next post>
     
  10. joshenry

    joshenry New Member

    Alright, here is the /etc/postfix/main.cf w/o comments. I've replaced where my hostname and domain will go but the appropriate infomation is in the file. Same with the hostname output.

    Code:
    #soft_bounce = no
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/libexec/postfix
    mail_owner = postfix
    #default_privs = nobody
    myhostname = computername
    #myhostname = virtual.domain.tld
    mydomain = mydomain.com
    #myorigin = $myhostname
    #myorigin = $mydomain
    inet_interfaces = all
    #inet_interfaces = $myhostname
    #inet_interfaces = $myhostname, localhost
    #proxy_interfaces =
    #proxy_interfaces = 1.2.3.4
    mydestination = computername.mydomain.com, localhost, localhost.localdomain
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
    #       mail.$mydomain, www.$mydomain, ftp.$mydomain
    unknown_local_recipient_reject_code = 550
    #mynetworks_style = class
    #mynetworks_style = subnet
    #mynetworks_style = host
    mynetworks = 127.0.0.0/8, 10.10.10.0/24
    #mynetworks = $config_directory/mynetworks
    #mynetworks = hash:/etc/postfix/network_table
    #relay_domains = $mydestination
    #relayhost = $mydomain
    #relayhost = [gateway.my.domain]
    #relayhost = [mailserver.isp.tld]
    #relayhost = uucphost
    #relayhost = [an.ip.add.ress]
    #relay_recipient_maps = hash:/etc/postfix/relay_recipients
    #in_flow_delay = 1s
    #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
    #recipient_delimiter = +
    #home_mailbox = Mailbox
    home_mailbox = Maildir/
    #mail_spool_directory = /var/mail
    mail_spool_directory = /var/spool/mail
    #mailbox_command = /some/where/procmail
    #mailbox_command = /some/where/procmail -a "$EXTENSION"
    #mailbox_transport = lmtp:unix:/file/name
    #mailbox_transport = cyrus
    #fallback_transport = lmtp:unix:/file/name
    #fallback_transport = cyrus
    #fallback_transport =
    #luser_relay = [email protected]
    #luser_relay = [email protected]
    #luser_relay = admin+$local
    #header_checks = regexp:/etc/postfix/header_checks
    #fast_flush_domains = $relay_domains
    #smtpd_banner = $myhostname ESMTP $mail_name
    #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
    #local_destination_concurrency_limit = 2
    #default_destination_concurrency_limit = 20
    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
    sendmail_path = /usr/sbin/sendmail.postfix
    newaliases_path = /usr/bin/newaliases.postfix
    mailq_path = /usr/bin/mailq.postfix
    setgid_group = postdrop
    html_directory = no
    manpage_directory = /usr/share/man
    sample_directory = /usr/share/doc/postfix-2.2.10/samples
    readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES
    
    smtpd_sasl_local_domain = $myhostname
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    mailbox_command =
    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
    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
    
    Output of "hostname"
    Code:
    # hostname
    computername.mydomain.com
    
    Output of "hostname -f"
    Code:
    #hostname -f
    computername.mydomain.com
    
    Output of "cat /etc/hosts"
    Code:
    # 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
    10.10.10.77             computername.mydomain.com computername
    
    Looks like there is an error about every minute the server is up. The maillog file is littered with the following:
    Code:
    Jan 24 09:40:56 localhost postfix/proxymap[14078]: fatal: unsupported dictionary type: mysql
    Jan 24 09:40:57 localhost postfix/smtpd[11720]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:40:57 localhost postfix/smtpd[11720]: warning: private/proxymap socket: service dict_proxy_open: Success
    Jan 24 09:40:57 localhost postfix/cleanup[11697]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:40:57 localhost postfix/cleanup[11697]: warning: private/proxymap socket: service dict_proxy_open: Connection reset by peer
    Jan 24 09:40:57 localhost postfix/master[11692]: warning: process /usr/libexec/postfix/proxymap pid 14078 exit status 1
    Jan 24 09:40:57 localhost postfix/master[11692]: warning: /usr/libexec/postfix/proxymap: bad command startup -- throttling
    Jan 24 09:41:57 localhost postfix/proxymap[14080]: fatal: unsupported dictionary type: mysql
    Jan 24 09:41:58 localhost postfix/smtpd[11720]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:41:58 localhost postfix/cleanup[11697]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:41:58 localhost postfix/smtpd[11720]: warning: private/proxymap socket: service dict_proxy_open: Success
    Jan 24 09:41:58 localhost postfix/cleanup[11697]: warning: private/proxymap socket: service dict_proxy_open: Connection reset by peer
    Jan 24 09:41:58 localhost postfix/master[11692]: warning: process /usr/libexec/postfix/proxymap pid 14080 exit status 1
    Jan 24 09:41:58 localhost postfix/master[11692]: warning: /usr/libexec/postfix/proxymap: bad command startup -- throttling
    Jan 24 09:42:58 localhost postfix/proxymap[14083]: fatal: unsupported dictionary type: mysql
    Jan 24 09:42:59 localhost postfix/smtpd[11720]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:42:59 localhost postfix/cleanup[11697]: warning: premature end-of-input on private/proxymap socket while reading input attribute name
    Jan 24 09:42:59 localhost postfix/smtpd[11720]: warning: private/proxymap socket: service dict_proxy_open: Success
    Jan 24 09:42:59 localhost postfix/cleanup[11697]: warning: private/proxymap socket: service dict_proxy_open: Connection reset by peer
    Jan 24 09:42:59 localhost postfix/master[11692]: warning: process /usr/libexec/postfix/proxymap pid 14083 exit status 1
    Jan 24 09:42:59 localhost postfix/master[11692]: warning: /usr/libexec/postfix/proxymap: bad command startup -- throttling
    Jan 24 09:43:59 localhost postfix/proxymap[14084]: fatal: unsupported dictionary type: mysql
    
    I'm assuming the "fatal: unsupported dictionary type: mysql" is a big part. I'm going to start searching on that and see what I find.

    I think that will be all the info you'll need for now. If you need more please email me at joshenry aT gmail d0t com . Thanks!
     
  11. falko

    falko Super Moderator Howtoforge Staff

    It means that MySQL support isn't compiled into your Postfix, so your setup cannot work.
     

Share This Page