User Tools

Site Tools


vps:tutby
# aptitude install mysql-server apache2 php5-cgi php5-cli php5-gd php5-mysql \
vsftpd phpmyadmin libapache2-mod-php5 php5-mcrypt vim screen php-xml-parser \
php-xml-serializer php-xml-util php5-xmlrpc

# mysqladmin -u root password FlolsIrwobyav3

# cat > /etc/apache2/sites-enabled/site.com

<VirtualHost *>
        ServerAdmin [email protected]
        ServerName site.com
        ServerAlias www.site.com
        DocumentRoot /var/www/site.com
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site.com>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/site.com-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/site.com-access.log combined
        ServerSignature On
</VirtualHost>

# useradd -d /var/www/site.com siteftp

# vim /etc/vsftpd.conf

   #anonymous_enable=YES
   local_enable=YES
   write_enable=YES
   local_umask=022
   chroot_local_user=YES

# /etc/init.d/vsftpd restart

# passwd siteftp
# mkdir /var/www/site.com
# chown siteftp /var/www/site.com
# apache2ctl restart
# vipw
меняем шелл юзера siteftp на /bin/false
# echo "/bin/false" >> /etc/shells

# aptitude install postfix-mysql postfix
# aptitude install dovecot-common dovecot-imapd dovecot-pop3d
# wget http://downloads.sourceforge.net/postfixadmin/postfixadmin_2.2.1.1_all.deb?modtime=1216813942&big_mirror=0
# dpkg -i postfixadmin_2.2.1.1_all.deb
# apachectl restart

# cat » /etc/postfix/main.cf

# Virtual mailbox settings
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

message_size_limit = 10485760
local_recipient_maps = $virtual_alias_maps $virual_mailbox_domains

# Timeouts
smtpd_timeout = 120s
smtp_helo_timeout = 60s
smtp_mail_timeout = 60s
smtp_rcpt_timeout = 90s


# Virtual mailbox settings
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
# SASL Authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

reject_unauth_destination=yes

# cat mysql_virtual_alias_maps.cf

hosts = localhost
user = postfixadmin
password = 2568106e4f23ca19764dd2f6c657c079
dbname = postfix
query = SELECT goto FROM alias WHERE address='%s' AND active='1'

# cat mysql_virtual_domains_maps.cf

user = postfixadmin
password = 2568106e4f23ca19764dd2f6c657c079
hosts = localhost
dbname = postfix
table = domain
query = SELECT domain FROM domain WHERE domain='%s' AND backupmx ='0' AND active ='1'

# cat mysql_virtual_mailbox_maps.cf

user = postfixadmin
password = 2568106e4f23ca19764dd2f6c657c079
hosts = localhost
dbname = postfix
query = SELECT CONCAT(domain,'/',maildir) FROM mailbox WHERE username='%s' AND active='1'
mysql> create database postfix;
Query OK, 1 row affected (0.40 sec)

mysql> grant all privileges on postfix.* to 'postfixadmin'@localhost identified by '2568106e4f23ca19764dd2f6c657c079';
Query OK, 0 rows affected (0.04 sec)

mysql>                                                                                                                        

# cat > /etc/dovecot/dovecot.conf

base_dir = /var/run/dovecot/

protocols = imap pop3

   protocol imap {
     listen = *:143
   }
   protocol pop3 {
     listen = *:110
   }

disable_plaintext_auth = no

log_timestamp = "%Y-%m-%d %H:%M:%S "

syslog_facility = mail

mail_location = maildir:/var/vmail/%d/%u
mail_extra_groups = mail
mail_debug = no
first_valid_uid = 150
last_valid_uid = 150
maildir_copy_with_hardlinks = yes

mail_privileged_group = mail

protocol imap {
  login_executable = /usr/lib/dovecot/imap-login

  mail_executable = /usr/lib/dovecot/imap

  imap_max_line_length = 65536

}


protocol pop3 {
  login_executable = /usr/lib/dovecot/pop3-login

  mail_executable = /usr/lib/dovecot/pop3

  pop3_uidl_format = %08Xu%08Xv

}

 protocol lda {
   postmaster_address = [email protected]

  sendmail_path = /usr/lib/sendmail

  auth_socket_path = /var/run/dovecot/auth-master

}

auth_verbose = no

auth_debug = no

auth_debug_passwords = no

auth default {
  mechanisms = plain login

  passdb pam {
  }

  passdb sql {
    args =/etc/dovecot/dovecot-sql.conf
  }

  userdb passwd {
  }

  userdb sql {
    args =/etc/dovecot/dovecot-sql.conf
  }

  user = nobody

  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0660
      user = vmail
      group = vmail
    }
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user=postfix
      group=postfix
    }
  }

}

dict {
}

plugin {

}

# cat > /etc/dovecot/dovecot-sql.conf

driver = mysql
connect = host=localhost dbname=postfix user=postfixadmin password=2568106e4f23ca19764dd2f6c657c079
default_pass_scheme = MD5

password_query = SELECT username, password FROM mailbox WHERE username = '%[email protected]%d'
user_query = SELECT maildir, 150 AS uid, 150 AS gid FROM mailbox WHERE username = '%[email protected]%d'

# cat » /etc/postfix/master.cf

# Local mail
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
# useradd -d /var/vmail -u 150  vmail
# mkdir /var/vmail
# chown vmail:vmail /var/vmail
# chown -R vmail /etc/dovecot/
# /etc/init.d/dovecot start
# /etc/init.d/postfix restart
# aptitude install  php5-imap     
# apache2ctl restart
# vim /etc/postfixadmin/config.inc.php

http://site.com/postfixadmin/setup.php

# rm /usr/share/postfixadmin/setup.php

vps/tutby.txt · Last modified: 2008/09/16 07:26 (external edit)