Showing posts with label postfix. Show all posts
Showing posts with label postfix. Show all posts

Monday, July 14, 2014

Dovecot, Postfix kurulumu

Dovecot kurulumu, postfix kurulumu Centos 6.5 yüklü sunucu üzerinde anlatılacaktır.

Postfix Kurulumu


1- İlk olarak /etc/hosts dosyasına maillerde kullanılacak sunucu ve ip adresi eklenir.
# nano /etc/hosts   
  192.168.0.21 example.com

2- Postfix yüklenir
# yum -y install postfix 

3- SMTP autherization paketleri yüklenir
# yum -y install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain

4- Postfix kurulumu tamamlandıktan sonra SSL sertifikası oluşturulur.
# mkdir /etc/postfix/ssl 
# cd /etc/postfix/ssl/
# openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 
# chmod 600 smtpd.key 
# openssl req -new -key smtpd.key -out smtpd.csr 
# openssl x509 -req -days 365 -in smtpd.csr -signkey smtpd.key -out smtpd.crt 
# openssl rsa -in smtpd.key -out smtpd.key.unencrypted 
# mv -f smtpd.key.unencrypted smtpd.key 
# openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 365

5- /etc/postifx/main.cf dosyası açılır ve aşağıdaki satırlar commentlenir.
# nano /etc/postfix/main.cf
    inet_interfaces = localhost  (116. satır)   
    mydestination = $myhostname, localhost.$mydomain, localhost  (164. satır)

6- /etc/postfix/main.cf dosyası tekrar açılır ve aşağıdaki satırlar eklenir.
    myhostname = mail.example.com
    mydomain =
example.com
    myorigin = $mydomain
    home_mailbox = mail/
    mynetworks = 127.0.0.0/8
    inet_interfaces = all
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_type = cyrus
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,    permit_mynetworks,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/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom


7- /etc/postfix/master.cf dosyası açılır ve aşağıdaki satırlar eklenir.
       smtps     inet  n       -       n       -       -       smtpd
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_reject_unlisted_sender=yes
      -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
      -o broken_sasl_auth_clients=yes


8- Postfix kurulumu tamalandı şimdi postfix ve saslauthd servisleri başlatılabilir.
# service postfix start
# service saslauthd start

9- Sunucu başlatıldığında otomatik olarak başlaması için
# chkconfig --level 235 postifx on
# chkconfig --level 235 saslauthd on
 
10- Şimdi SMTP bağlantısının başarılı bir şekilde kurulup kurulmadıgını kontrol edebiliiriz.
# telnet localhost 25   
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
ehlo localhost <---- bu komut girilir
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

  
çıktısı alınıyor ise başarılı bir şekilde postfix kurulmuş demektir. 

Dovecot Kurulumu
 
1- Öncelikle dovecot.org/download.html adresinden şu andaki son versiyonu olan 2.2.13 versiyonu indirilir ve daha önceden oluşturduğumuz dizine kopyalanır.
# mkdir -p /data/install/2014/
# cd /data/install/2014/
# mkdir dovecot
# wget http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz 
# tar -xzpf dovecot-2.2.13.tar.gz 
# cd dovecot-2.2.13 


2- Compile edebilmemiz için c compiler (gcc) ve diğer buna bağlı paketler indirilir.
# yum install gcc openldap-devel mysql-devel



3- Konfigürasyon ve kurulum başlatılır 
# ./configure --prefix=/usr 
            --sysconfdir=/etc 
            --localstatedir=/var 
            --docdir=/usr/share/doc/dovecot-2.2.13 
            --disable-static 

# make
# make install 



4- Softlink oluşturulur
# cd /usr/local
# ln -s dovecot-2.2.13 dovecot 


5- İndirilen dovecot paketinin içerisinde yer alan örnek konfigürasyon dosyaları /etc/dovecot dizini altına kopyalanır 
# cp -rv /usr/share/doc/dovecot-2.2.13/example-config/* /etc/dovecot 


6- Local kullanıcılar için yetkilendirme, mailbox lokasyonu gibi konfigürasyonlar aşağıdaki şekilde /etc/dovecot/local.conf dosyasına yazılmıştır.
# nano /etc/dovecot/local.conf



protocols = imap 
ssl = no 
listen = * 
mail_location = mbox:~/Mail:INBOX=/var/mail/%u 

userdb {
  driver = passwd
}
passdb {
  driver = shadow
}



7- Dovecot servisini başlatabilmek için startup script i yazmak gerekmektedir.
/etc/rc.d/init.d dizinine gidilir ve dovecot isminde bir dosya oluşturulur ve aşağıdaki satırlar içerisini kopyalanır.


#!/bin/bash
#
#       /etc/rc.d/init.d/dovecot
#
# Starts the dovecot daemon
#
# chkconfig: - 65 35
# description: Dovecot Imap Server
# processname: dovecot
# config: /etc/dovecot.conf
# config: /etc/sysconfig/dovecot
# pidfile: /var/run/dovecot/master.pid

### BEGIN INIT INFO
# Provides: dovecot
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop Dovecot Imap server
# Description: Dovecot is an IMAP server for Linux/UNIX-like systems,
#              written with security primarily in mind.  It also contains
#              a small POP3 server.
### END INIT INFO

ulimit -n 5000
# Source function library.
. /etc/init.d/functions

if [ -f /etc/sysconfig/dovecot -a $UID -eq 0 ]; then
    . /etc/sysconfig/dovecot
fi

RETVAL=0
prog="Dovecot Imap"
exec="/usr/local/dovecot/sbin/dovecot"
config="/etc/dovecot/dovecot.conf"
pidfile="/var/run/dovecot/master.pid"
lockfile="/var/lock/subsys/dovecot"

start() {
        [ $UID -eq 0 ] || exit 4
        [ -x $exec ] || exit 5
        [ -f $config ] || exit 6

        echo -n $"Starting $prog: "
        daemon --pidfile $pidfile $exec $OPTIONS
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch  $lockfile
        echo
}

stop() {
        [ $UID -eq 0 ] || exit 4
        echo -n $"Stopping $prog: "
        killproc -p $pidfile $exec
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        echo
}

reload() {
        [ $UID -eq 0 ] || exit 4
        echo -n $"Reloading $prog: "
        killproc -p $pidfile $exec -HUP
        RETVAL=$?
        echo
}

#
#       See how we were called.
#
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  reload)
        reload
        ;;
  force-reload|restart)
        stop
        sleep 1
        start
        RETVAL=$?
        ;;
  condrestart|try-restart)
        if [ -f $lockfile ]; then
            stop
            sleep 3
            start
        fi
        ;;
  status)
        status -p $pidfile $exec
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|reload|force-reload|status}"
        RETVAL=2
        [ "$1" = 'usage' ] && RETVAL=0
esac

exit $RETVAL 

8- Dovecot servis olarak eklenir ve çalıştırılabilir scripte dönüştürülür. 
# chmod +x /etc/init.d/dovecot
# chkconfig --add dovecot

9- Sistem boot edildiğinde otomatik olarak Dovecot başlatılması için
# chkconfig dovecot on
 
10-  Konfigürasyonu test etmek için kullanıcı eklenir
# useradd -m ibrahim -s /sbin/nologin
# useradd -m kiraz -s /sbin/nologin 
 
Son olarak da squirrelMail ile kullanıcı girişi yapılarak local de mail gönderimi test edilir.

How can we use svg file as a icon of v-btn (vuetify button) ?

<template>   <v-btn>     <CustomIcon />     Click me   </v-btn> </template> <script> // Import your SVG ...