Postfix + Virtual_transport + yaa

From: Klaus Zahradnik (no email)
Date: Wed Feb 01 2006 - 06:29:01 EST

  • Next message: Lee Hetherington: "Re: Best file system"

    Hello List!

    I have Postfix set up for virtual delivery for multiple domains. Now we
    would like to use vacation messages for obvious reasons.
    The only peace of software that I could find to work with postfix and
    mysql is yaa.
    However, I am too dumb to get it to work and I was hoping you guys could
    help me out.

    The problem is, that I cannot get yaa to trigger nor do I have any
    logfile output. Mails are still beeing delivered without any problems.

    postconf -n
    alias_maps = hash:/etc/aliases
    always_bcc =
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    debug_peer_level = 2
    html_directory = /var/www/html/postfix
    inet_interfaces = all
    mail_owner = postfix
    mailbox_command_maps = hash:/etc/postfix/mailbox_commands
    mailq_path = /usr/bin/mailq
    manpage_directory = /usr/local/man
    mynetworks = 127.0.0.0/8, 85.124.67.224/27, 81.223.242.224/27,
    mysql:/etc/postfix/mysql_mynetwork_maps.cf
    mynetworks_style = host
    newaliases_path = /usr/bin/newaliases
    queue_directory = /var/spool/postfix
    readme_directory = /root/postfix/
    recipient_bcc_maps = hash:/etc/postfix/sender_bcc_maps
    sample_directory = /etc/postfix
    sender_bcc_maps = hash:/etc/postfix/sender_bcc_maps
    sendmail_path = /usr/sbin/sendmail
    setgid_group = postdrop
    unknown_local_recipient_reject_code = 550
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    virtual_gid_maps = static:89
    virtual_mailbox_base = /usr/local/virtual
    virtual_mailbox_domains =
    mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_limit = 51200000
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_minimum_uid = 89
    virtual_transport = virtual
    virtual_uid_maps = static:89

    [master.cf]
    smtp inet n - n - - smtpd
    yaa unix - n n - - pipe
                                                            user=postfix

    argv=/usr/local/yaa-0.3/bin/yaa.pl
    [/master.cf]

    [transport]
    autoreply.i-net.at yaa:
    [/transport]

    [yaa.conf]
    attached
    [/yaa.conf]

    Thanks in advance and
    kind regards
    Klaus


    ######################################################
    # !!!!WARNING!!!! #
    # DO NOT REMOVE OR COMMENT OUT THE FOLLOWING LINE #
    use strict; #
    ######################################################

    # NOTICE:
    # If you're having trouble running yaa.pl and you're
    # not shure, what's going wrong, set environment varibale
    #
    # YAA_DEBUG
    #
    # and run yaa.pl again with the same arguments/configuration file.
    #
    # Yaa debug output will be written to stderr if running in single
    # message processing mode or in daemon mode with $daemon_background = 0.
    #
    # If you're running in daemon mode with $daemon_background = 1, debug messages
    # will be sent to logger subsystem if it's enabled.
    #
    # example for csh:
    # setenv YAA_DEBUG 1
    #
    # example for sh/ksh/bash:
    export YAA_DEBUG=1
    #

    # GENERAL NOTES
    #
    # excerpt taken from configuration file of excellent opensource project
    # called amavisd-new <http://www.ijs.si/software/amavisd/>
    # by Mark Martinec <http://www.ijs.si/people/mark/>.
    #
    # This file is a normal Perl code, interpreted by Perl itself.
    # - make sure this file (or directory where it resides) is NOT WRITABLE
    # by mere mortals, otherwise it represents a severe security risk!
    # - for values which are interpreted as booleans, it is recommended
    # to use 1 for true, and 0 or undef or '' for false.
    # - Perl syntax applies. Most notably: strings in "" may include variables
    # (which start with $ or @); to include characters @ and $ in double
    # quoted strings, precede them by a backslash; in single-quoted strings
    # the $ and @ lose their special meaning, so it is usually easier to use
    # single quoted strings. Still, in both cases backslash needs to be doubled.

    ######################################################
    # LOGGING SUBSYSTEM SETTINGS #
    ######################################################

    # enable logging?
    # type: boolean
    # default: 1
    # $logging = 1;

    # enable logging to syslog?
    # type: boolean
    # default: 1
    # $log_syslog = 0;

    # syslog logging facility
    # type: string
    # default: "mail"
    # this setting applies only when logging to syslog is enabled
    # $log_syslog_facility = "mail";

    # syslog logging priority
    # type: string
    # default: "info"
    # this setting applies only when logging to syslog is enabled
    # $log_syslog_priority = "info";

    # log to plaintext file?
    # type: boolean
    # default: 0
    # $log_file = 1;

    # log filename
    # type: string
    # default: undef
    # this setting applies only when logging to file is enabled
    # $log_file_filename = "/tmp/yaa.log";

    # log to stderr?
    # type: boolean
    # default: 0
    # !!!! WARNING !!!!
    # when yaa debugging is turned on (environment variable YAA_DEBUG is set),
    # STDERR output is mapped to logger subsystem and nothing actually doesn't show up
    # on real stderr, so make shure to set up syslog or file based logging.
    # !!!! WARNING !!!!
    # $log_stderr = 0;

    # log time format when logging in file
    # type: string
    # default: "[%a, %b %e %T %Y]: "
    # see strftime(3) for more details
    # $log_time_format = undef;

    ######################################################
    # DAEMON MODE SETTINGS #
    ######################################################

    # run as daemon?
    # type: boolean
    # default: 0, do not run as daemon
    # this setting enables daemon mode operation.
    # $daemon = 1;

    # fork into background when running as daemon?
    # default: 1
    # this setting applies only when operating in daemon mode
    # $daemon_background = 1;

    # daemon accept lock file
    # type: string
    # default: "/var/lock/yaa.lock"
    # this setting applies only when operating in daemon mode
    # WARNING: if running in chroot jail, this option should be
    # set relative to chroot directory
    # $daemon_lockfile = "/tmp/yaa.lock";

    # daemon pid file
    # type: string
    # default: "/var/run/yaa.lock"
    # this setting applies only when operating in daemon mode
    # $daemon_pidfile = "/tmp/yaa.pid";

    # minimum number of yaa child processes
    # type: integer
    # default: 2
    # this setting applies only when operating in daemon mode
    # $daemon_min_servers = 2;

    # maximum number of yaa child processes
    # type: integer
    # default: 3
    # this setting applies only when operating in daemon mode
    # $daemon_max_servers = 3;

    # minimum number of yaa spare child processes
    # type: integer
    # default: 1
    # this setting applies only when operating in daemon mode
    # $daemon_min_spare_servers = 0;

    # maximum number of yaa spare child processes
    # type: integer
    # default: 1
    # this setting applies only when operating in daemon mode
    #$daemon_max_spare_servers = 1;

    # daemon communication protocol
    # type: string
    # protocol which your MTA uses for communication with yaa
    #
    # NOTICE: for possible values for this configuration parameter, RUN
    # yaa.pl --list-transport-protocols
    #
    # default: "SMTP"
    # this setting applies only when operating in daemon mode
    # $daemon_protocol = "LMTP";

    # tcp listen port or unix domain socket on which yaa should listen
    # type: integer/string
    # default: 40000
    # to specify unix domain socket set value to: '/path/to/socket|unix'
    #
    # see also: perldoc Net::Server::Proto
    #
    # this setting applies only when operating in daemon mode
    # $daemon_listen_port = 40000;

    # hostname which yaa should bind to.
    # type: string
    # default: "localhost"
    # this setting applies only when operating in daemon mode
    # $daemon_listen_host = "127.0.0.1";

    # daemon tcpserver (Net::Server) log level
    # type: integer
    # default: 0
    # 'O' => disable logging
    # 0 => 'err'
    # 1 => 'warning'
    # 2 => 'notice'
    # 3 => 'info'
    # 4 => 'debug'
    $daemon_tcpserver_loglevel = 4;

    ######################################################
    # YAA OBJECT SETTINGS #
    ######################################################

    # directory used to store autoresponse message sent time database.
    # type: string
    # default: "/tmp"
    # !!!! WARNING !!!!
    #
    # - if you're running yaa chrooted (see configuration variable $chroot),
    # then you need to set this variable to value RELATIVE to chroot directory
    #
    # - directory must be writeable for uid/gid which yaa uses for message processing
    # see also $user and $group variables
    #
    # !!!! WARNING !!!!
    # $db_dir = "/db";

    # time in seconds between to autoresponses will be sent to the
    # same message sender from message recipient which has autoresponder
    # turned on.
    #
    # !!!! WARNING !!!!
    #
    # For testing purposes, set to -1 (turn off time checking),
    # BUT DO NOT SET THIS VALUE LOWER THAN 3600 (1 hour) ON
    # PRODUCTION SYSTEM !!!!
    #
    # !!!! WARNING !!!!
    # type: integer
    # default: 7200
    # $duration_interval = 24 * 60 * 60;

    ######################################################
    # AUTORESPONSE SETTINGS #
    ######################################################

    # method used for sending autoresponses and forwaring messages
    # type: string
    # possible values: "smtp", "sendmail"
    # - "smtp" uses smtp server to send mail
    # - "sendmail" invokes sendmail binary to send mail
    #
    # !!!!WARNING!!!!: weird things happen when using sendmail sending
    # method and running in daemon mode!
    #
    # default: "smtp"
    # $mail_sending_method = "smtp";

    # sendmail program path
    # type string
    # default: automaticaly searched in $PATH environmental variable;
    # undef if not found in $PATH.
    #$sendmail_path = undef;

    # SMTP server setting
    # type: string
    #
    # see also perldoc Net::SMTP
    #
    # default: localhost
    # $smtp_server = "localhost";

    # Use SMTP auth?
    # type: boolean
    # default: 0
    # $smtp_auth = 0;

    # SMTP auth username
    # type: string
    # default: undef
    # $smtp_username = undef;

    # SMTP auth password
    # type: string
    # default: undef
    # $smtp_password = undef;

    ######################################################
    # LOOKUP MAP SETTINGS #
    ######################################################

    # List of ALL lookup maps
    # You need to define lookup maps here and
    # then set lookup_map_query_order, where you reference to
    # the lookup name
    #
    # NOTICE:
    # All lookup maps are initialized BEFORE Yaa! enters chroot jail (if any)
    # and BEFORE starts processing emails.
    #
    #
    # NOTICE: To obtain list of all lookup drivers, RUN
    # yaa.pl --list-lookup-map-drivers
    #
    # type: hash of hashes
    # default: empty hash (no defined lookup maps)
    $lookup_maps = {
            #
            # !!!WARNING!!!!
            #
            # FOR COMPLETE LIST OF DRIVER CONFIGURATION ARGUMENTS
            # RUN yaa.pl --show-lookup-map-doc <DRIVER>
            #

            # Lookup map configuration format
            #
            # 'map_name' => {
            # 'driver' => 'DRIVER_NAME',
            # 'driver_param1' => 'value1'.
            # 'driver_param2' => 'value2',
            # 'driver_param3' => 'value3',
            # },

            # SQL lookup map example
            #
            # (used sql database: mysql)
            # (for other types see perldoc DBD::<yourdb>)
            #
             'my_sql_map' => {
                    'driver' => 'SQL',
                    'sql_dsn' => 'dbi:mysql:database=mydb;host=mydb.example.org',
                    'sql_username' => "postfix",
                    'sql_password' => "Ght0lXg2)",
                    'sql_select' => "select active,message,subject,charset,forward from autoresponder_data where address = %m and active='1'",
            },
            
            # PCRE lookup map example
            #
            # 'my_pcre_map' => {
            # 'driver' => 'PCRE',
            # 'file' => "file.pcre",
            # 'replacement_num' => 0
            #},
            
            # STATIC lookup map example
            # 'my_static_map' => {
            # 'driver' => 'STATIC',
            # 'result_key1' => 'result_value1',
            # 'result_key2' => 'result_value2',
            # 'result' => 'sth'
            #},
            
            # LDAP lookup map sample
            # 'my_ldap_map' => {
            # 'driver' => 'LDAP',
            # 'ldap_host' => 'ldap.example.org',
            #
            # 'ldap_bind' => 1,
            # 'ldap_bind_dn' => "cn=Manager,dc=example,dc=org",
            # 'ldap_bind_pw' => "secret",
            #
            # 'ldap_search_base' => "ou=MyOU,dc=example,dc=org",
            # 'ldap_search_filter' => "(&(objectClass=rfc822Recipient)(mail=%m)(accountActive=1)",
            # 'ldap_search_attrs' => ['autoResponseActive', 'autoResponseSubject', 'autoresponseMessage', 'autoResponseCharset', 'autoresponseForward'],
            #},
            
            # DB_File lookup map sample
            # 'my_dbf_map' => {
            # 'driver' => 'DB_File',
            # 'file' => "/path/to/mydb",
            #},
            
            # BerkeleyDB lookup map sample
            #'my_dbd_map' => {
            # 'driver' => 'BerkeleyDB',
            # 'type' => 'Btree',
            # 'file' => "/path/to/mydb"
            #},
    };

    # lookup map query order by attribute
    # for each autoresponse except 'rewrite_recipient' and 'rewrite_sender' must
    # be defined lookup query order
    #
    # Each item can be specified as:
    # + string (example: 'domain.tld')
    #
    # OR
    #
    # lookup_map_name:result_value (example: 'my_pcre_map:result')
    #
    # Lookup map is recognized by ':' character in string.
    #
    # Lookup map 'lookup_map_name' MUST BE specified in $lookup_maps configuration
    # parameter in yaa.conf
    #
    # type: hash of hashes
    # default: empty hash (no lookups order lists defined)
    $lookup_map_query_order = {
            # 'active' attribute is lookup query order list to lookup
            # tables for obtaining autoresponder activity status for message
            # recipient.
            #
            # specify list of strings/lookup maps
            #
            # !!!!WARNING!!!!: MAP driver result key must be '1', 'y', 'yes', 't' or 'true'
            # in any character case in order to recognize message recipient as active.
            #
            # first matching string (any) / lookup map result wins.
            active => [
                     'my_sql_map:active'
            ],

            # 'message' attribute is lookup query order list to lookup
            # tables for obtaining autoresponse subject.
            #
            # specify list of strings/lookup maps
            #
            # NOTICE: if none of maps don't return any result, autoresponse message subject
            # will be: 'Re: <original message subject>'
            #
            # first matching string (any) / lookup map result wins.
            subject => [
                     'my_sql_map:subject'
            ],
            
            # 'message' attribute is lookup query order list to lookup
            # tables for obtaining autoresponse message body.
            #
            # specify list of strings/lookup maps
            #
            # first matching string (any) / lookup map result wins.
            message => [
                     'my_sql_map:messge'
            ],
            
            # 'charset' attribute is lookup query order list to lookup
            # tables for obtaining autoresponse message charset.
            #
            # specify list of strings/lookup maps
            #
            # first matching string (any) / lookup map result wins.
            charset => [
                     'my_sql_map:charset'
            ],
            
            # 'forward' attribute is lookup query order list to lookup
            # tables for obtaining forward address for message recipient
            #
            #
            # specify list of lookup maps.
            # first matching string (any) / lookup map result wins.
            forward => [
                     'my_sql_map:forward'
            ],

            # 'rewrite_sender' attribute is lookup map query order
            # list to lookup tables for rewriting sender address.
            #
            # WARNING: this attribute is used ONLY WHEN OPERATING IN DAEMON MODE.
            #
            # If this list is empty and operating in daemon mode, sender address
            # WILL NOT BE REWRITTEN.
            #
            # Hint: PCRE lookup tables offer best address rewriting performance
            #
            # first matching string (any) / lookup map result wins.
            rewrite_sender => [
                    # 'map_name:result', 'map_name2:result'
            ],

            # 'rewrite_recipient' attribute is lookup map query order
            # list to lookup tables for rewriting recipient address(es).
            #
            # WARNING: this attribute is used ONLY WHEN OPERATING IN DAEMON MODE.
            #
            # If this list is empty and operating in daemon mode, recipient address(es)
            # WILL NOT BE REWRITTEN.
            #
            # Hint: PCRE lookup tables offer best address rewriting performance
            #
            # first matching string (any) / lookup map result wins.
            rewrite_recipient => [
                    # 'map_name:result', 'map_name2:result'
            ],

            # 'local_domains' attribute specifies wheter message recipient is
            # part of so called local domains. Autoresponder activity status
            # (see attribute 'active') is automatically disabled for non-local
            # domains. So, if you receiving email for domain.tld, then domain.tld
            # must be matched by lookup maps listed in this attribute.
            #
            # WARNING: domain is treated as active if any lookup map returns any result
            # (result value is not checked for performance reasons)
            #
            # specify list of domains, email addresses and lookup maps.
            #
            # EXAMPLE:
            # recipient is treated as part of local domains if:
            # + recipient is
            # + recipient has email address *@domain.tld
            # + lookup map 'some_map', defined in $lookup_maps returns any result for recipient address
            #
            # 'local_domains' => [ '', 'domain.tld', 'some_map:result' ]
            #
            # first matching string/result wins.
            #
            'local_domains' => [
                     'i-net.at', 'autoreply.i-net.at'
            ],
    };

    ######################################################
    # OTHER SETTINGS #
    ######################################################

    # chroot to some directory?
    # type: string
    # default: undef, do not chroot
    # Warning: yaa must be started as superuser to enable this feature.
    # this applies to daemon and single message processing mode
    # $chroot = undef;

    # change uid/gid before processing?
    # type: string
    # default: undef, do not change uid/gid
    # Warning: yaa must be started as superuser to enable this feature.
    # this applies to daemon and single message processing mode
    # $user = undef;
    # $group = undef;

    # Load additional perl modules before processing any message
    # Modules in this list will be loaded before Yaa! will process any
    # message in single process mode or become daemon, when running
    # in daemon mode.
    #
    # This configuration parameter is very handy when
    # when running in chroot jail
    #
    # type: array
    # default: empty array (don't load any additional modules)
    @extra_modules = (
            # !!!!WARNING!!!!
            # when as chrooted daemon, uncomment the following line
            # 'Net::Server::Mail::ESMTP::PIPELINING',
            
            # if running chrooted, and using mysql version
            # of SQL lookup map, uncomment the following line
            #'DBD::mysql',
            
            # if running chrooted, and using postgres version
            # of SQL lookup map, uncomment the following line
            #'DBD::Pg',
    );

    ######################################################
    # !!!!WARNING!!!! #
    # COMMENT OUT THE FOLLOWING LINE TO MAKE YAA WORK! #
    # !!!!WARNING!!!! #
    ######################################################
    #die "You haven't edit configuration file, have you?:))";

    ######################################################
    # !!!!WARNING!!!! #
    # DO NOT REMOVE OR COMMENT OUT THE FOLLOWING LINE #
    1; #
    ######################################################


  • Next message: Lee Hetherington: "Re: Best file system"





    Hosted Email Solutions

    Invaluement Anti-Spam DNSBLs



    Powered By FreeBSD   Powered By FreeBSD