Postfix setup with restricted users

Discussion in 'Installation/Configuration' started by zoran.tasic68, Mar 28, 2014.

  1. zoran.tasic68

    zoran.tasic68 New Member

    Hi Falko,
    this is my first post - question here. I hope that you can help me.

    Namely, I followed this forum link in order to fix issue which I have to.
    And issue is: create group from this moment and onward where they will have permission to only send mails inside mail domain. Postfix is on Ubuntu 12.04 with Dovecot and MySQL. Those new users does not have to interfere with existing users and in future created which will they have permission to send and receive mail from anywhere.
    Basically, I need only one group to add - local_users.
    My question is: what lines do I have to add in and what query I have to create to Postfix read users from db?
    Here are my settings:
    # See /usr/share/postfix/ for a commented, more complete version

    # Debian specific: Specifying a file name will cause the first
    # line of that file to be used as the name. The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = no

    # TLS parameters
    #smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    #smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    smtpd_tls_auth_only = yes
    smtpd_sasl_tls_security_options = noanonymous

    #Enabling SMTP for authenticated users, and handing off authentication to Dovecot
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_security_options = noanonymous

    smtpd_recipient_restrictions =

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname = mail.domain
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    #mydestination =,,, localhost
    mydestination = localhost
    relayhost =
    mynetworks = [::ffff:]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all

    #Handing off local delivery to Dovecot's LMTP, and telling it where to store mail
    virtual_transport = lmtp:unix:private/dovecot-lmtp

    #Virtual domains, users, and aliases
    virtual_mailbox_domains = mysql:/etc/postfix/
    virtual_mailbox_maps = mysql:/etc/postfix/
    virtual_alias_maps = mysql:/etc/postfix/

    # Forward email to another address and keep a copy in the mailbox
    recipient_bcc_maps = hash:/etc/postfix/recipient_bcc_maps

    content_filter = scan:
    receive_override_options = no_address_mappings

    milter_default_action = accept
    milter_protocol = 2
    smtpd_milters = inet:localhost:8891
    non_smtpd_milters = inet:localhost:8891

    #Reject attachment
    #header_checks = regexp:/etc/postfix/header_checks
    mime_header_checks = regexp:/etc/postfix/mime_header_checks

    #Limit Denial of Service Attacks:
    default_process_limit = 100
    smtpd_client_connection_count_limit = 100
    smtpd_client_connection_rate_limit = 30
    queue_minfree = 20971520
    header_size_limit = 51200
    message_size_limit = 10485760
    smtpd_recipient_limit = 100

    And here are the queries which I used to create db, tables and users

    CREATE TABLE `virtual_domains` (
    `id` int(11) NOT NULL auto_increment,
    `name` varchar(50) NOT NULL,
    PRIMARY KEY (`id`)

    CREATE TABLE `virtual_users` (
    `id` int(11) NOT NULL auto_increment,
    `domain_id` int(11) NOT NULL,
    `password` varchar(106) NOT NULL,
    `email` varchar(100) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `email` (`email`),
    FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE

    CREATE TABLE `virtual_aliases` (
    `id` int(11) NOT NULL auto_increment,
    `domain_id` int(11) NOT NULL,
    `source` varchar(100) NOT NULL,
    `destination` varchar(100) NOT NULL,
    PRIMARY KEY (`id`),
    FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE

    Could you please help to create correct query and add correct lines to
    I have tried a lot of combinations without any success.

    Thanks in advance,
  2. zoran.tasic68

    zoran.tasic68 New Member

    Guys, can anyone help me?


Share This Page