Autor: Vinícius Bona | Publicado: 2013-06-25T16:07:00-07:00


DEBIAN 6 + BIND, APACHE, FTP, SSH


Instalando e configuranod o Debian:

1) Instale o Debian em modo de rede, com 2 placas derede 1 como dhcp e outra statica.

2) Configure o arquivo /etc/network/interfaces conforme abaixo:

auto l0
iface l0 inet loopback

auto eth0
ifcae eth0 inet dhcp

auto eth0:1
ifce eth0:1 inet static
address 192.168.25.1
network 192.168.25.0
netmask 255.255.255.0
broadcast 192.168.25.255

up route add -net 192.168.0.0/16 dev eth0

4) Configurando repositórios:

altere o arquivo /etc/apt/sources.list 

deb http://ftp.br.debian.org/debian&nbsp; squeeze main contrib non-free


Instalando DNS:

1) apte-get install bind9

2) juntar arquivos do named:

Acesse /etc/bind: 

cat named.conf. options &gt;&gt;&nbsp; named.conf
cat named.conf.default-zones &gt;&gt; named.conf
cat named.conf.local&gt;&gt;named.conf

Limpar os comentários,

Descomentar a linha do forwarder e inserir o endereço 10.3.63.253.


3)Configurando resolv.conf

/etc/dhcp/dhcclient.conf

Descomentar a linha prepend domain-name-servers 127.0.0.1;

search:&nbsp; adiciona prefixo aos nomes ao pesquisar por um nome de endereço
exp ping www
procurará por www.sc.senai.br (search sc.senai.br no arquivo resolv.conf)

Criar domínio CSTRC dentro do servidor

1)&nbsp; abra o arquivo namde.conf

vi named.conf&nbsp; e insira o dominio abaixo:
zone "cstrc.br" {
&nbsp; &nbsp; type master;
&nbsp;&nbsp;&nbsp; file "/etc/bind/db.cstrc.br"
&nbsp;&nbsp;&nbsp; forwarders { };
};

5) configurar arquivo da zona db.cstrc.br

#TTL tempo que as consultas ficam no cache em segundos
&nbsp;#SOA inciar uma autoridade no DNS&nbsp; - ns (servidor inicial - principal do dominio)
&nbsp;#seriaal number ANO|MES|DIA|QUATN MOD
#REFRESH - tempo de atualização; 
#RETRY- se a consulta falhar qto tempo vai levar para tentar de novo
# EXPIRE # slave nao esta conseguindo sincronizar qto tempo ela aguarda pra tentar denovo
# Negativa Cache TTL - e o ttl pras resposstas negativas - é uma respota de um domínio que não existe. 

$TTL 604800
@ &nbsp; &nbsp;&nbsp; IN &nbsp;&nbsp; SOA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ns.cstrc.br.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.cstrc.br. &nbsp;&nbsp;&nbsp;&nbsp; {&nbsp; # @ inicia uma nova zona
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 20130601&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Serial
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 604800&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;Refresh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 86400&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;Retry
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2419200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;Expire

;

&nbsp;IN &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ns.cstrc.br.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #nomde do servidosr&nbsp; da maquina que hospeda o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; # servidor DNS - listar todas as maquinas
IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ns2.cstrc.br &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; # nome da seguinda máquina DNS (não é necessário):q!

IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192.168.25.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # endereço&nbsp; IPV4 (A) da maquina NS do servidor DNS -
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #nome que esta apontando&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NS.cstrc.br&nbsp;
IN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MX &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 5 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; mail.cstrc.br.&nbsp; #configuração para servidor de e-mail - 5 =prioridade
mail &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192.25.0.1&nbsp; #endereço IP do servidro mail

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # o dominio cstrc.br
ns &nbsp; IN &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.25.1 &nbsp; &nbsp; &nbsp;&nbsp; # define o ip da maquina ns.

ssl &nbsp; IN &nbsp; &nbsp; &nbsp;&nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 192.168.25.3 &nbsp; &nbsp; &nbsp; # endereço do servidor SSL 

sv1&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192.168.25.2&nbsp;&nbsp; # endereco .2 para caso haja indisponibilidade do servidor
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # www é so subir outra maquina com .2 e nao precisa
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # aguardar TTL - aumenta TTL diminuido consumo de
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # banda e processamento - numero consultas
sv1&nbsp; IN &nbsp; &nbsp; &nbsp; &nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 192.168.25.1 &nbsp; &nbsp; &nbsp; 
ftp &nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp; CNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sv1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # CNAME -:&gt; Apelido para DNS.
ssh &nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp; CNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sv1
imap&nbsp; IN&nbsp;&nbsp; CNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mail
pop&nbsp;&nbsp;&nbsp; IN&nbsp; CNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mail





INSTALNADO APACHE e VSFTPD

1) apt-get install apaache2 vsftpd

Configurar VSFTPD

1) vi&nbsp; /etc/vstftpd.conf

anonymous_enable = YES

local_enable=YES&nbsp; # permite que usuarios locais da maquina conectem-se no FTP

write_enable=YES # permite enviar arquivos escrever no servidor

local_umask = 22&nbsp; # mascara para criacao de arquivos 

chroot_local_user = YES&nbsp; # usuário so tem acesso ao diretorio local dele


3) criando usuario para acesso ao VSTFTPD:

adduser aluno

senha senai

4) testando vstftp

ftp ftp.cstrc.br

usuario aluno
senha senai

Erro
vsftpd: refusing to run witch writable root inside chroot ()&nbsp; login failed.

chmod a-w /home/user

&nbsp;http://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/

5) criando pasta www para o usuario acessar como root

cd /home/aluno
mkdir www
chown aluno.aluno www 

#CONFIGURAÇÃO APACHE

# Criando sites www.cstrc.br

1) vim /etc/apache2/sites-available/www.cstrc.br

&lt;VirtualHost *:80&gt;
&nbsp;&nbsp;&nbsp;&nbsp; ServerName www.cstrc.br
&nbsp;&nbsp;&nbsp;&nbsp; DocumentRoot /home/aluno/www
&lt;/VirtualHost&gt;

---------------
Gerar indice dos arquivos incluir a opcao abaixo:

&lt; Directory /home/aluno/www&gt;
Options -Indexes # - na frente retira a opcao de listar os arquivos, por padrao se apache ja lista
&lt; /Directory&gt;

#habilitar pagina criada:
&nbsp;#sites-enabled -&gt; link simbolico para os sites contiid em sites-avaiable

a2ensite www.cstrc.br # cria link simbolico (habilita site) criado
a2desite www.cstrc.br # desabilita site

invoke-rc.d apache2 restart


# UTILIZAR VIRTUAL HOSTS
verificar se a opcao NameVirtualHost *:80&nbsp; está configurado no arquivo ports.conf

#sites fornecidos, via nome ou ip.


&lt;VirtualHost *:80&gt;
&nbsp;&nbsp;&nbsp;&nbsp; ServerName www.cstrc.br #essa configuração é valida quando alguem estier acesando
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; #pelo hostname especificado
&nbsp;&nbsp;&nbsp;&nbsp; DocumentRoot /home/aluno/www&nbsp; # diretório rais dos arquivos do site.
&lt;/VirtualHost&gt;


#dir.conf

#arquivo de configuiração do modo de acesso.

DirectoryInex -&gt; lista os arquivo da página que o apache irá exibir em ordem de precedencia.

# caso não encontre irá listar os arquivos contidos na pasta.


#CONFIGURANDO SSL APACHE

-&gt; Gerando chaves SSL

openssl req -x509 -nodes 
-days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/ssl.cstrc.br.key - 
out /etc/ssl/certs/ssl.cstrc.br.pem

BR


Common Name : endereço do host que irá utilizar o SSL ssl.cstrc.br

1) acessar a pasta /etc/apache2/mods-available/

ssl.load -&gt; toda a configuração do arquivo que realizará a carga do apache

ssl.conf -&gt; arquivo de configuração do modulo SSL do apache


habilitar módulo SSL no apache:

e2enmod ssl

service apache2 restart

3) habilitando sites para operacar com SSL&nbsp; 

#a2ensite default-ssl

Recarregando o apache
service apache2 restart/reload.

Habilitando site www.cstrc.br para trabalhar com SSL:

1)acesse /etc/apache2/sites-avaiable/defaultssl

vi /etc/apache2/sites-avaiable/www.cstrc.br

Inserir linhas abaixo:

&lt;VirtualHost *:80&gt;
&nbsp;&nbsp;&nbsp; Servername ssl.cstrc.br
&nbsp;&nbsp;&nbsp; Redirect / https://ssl.cstrc.br/
&lt;/VirtualHost&gt;

&lt;VirtualHost 192.168.25.3:443&gt; #virtual host que heridreciona para o site ser acessado através&nbsp; ssl.cstrc.br
&nbsp;&nbsp;&nbsp; ServerName ssl.cstrc.br #endereço do servidor
&nbsp;&nbsp;&nbsp; DocumentRoot /home/aluno/www # site SSL

&nbsp;&nbsp;&nbsp; SSLEngine On
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSLCertificateFile&nbsp;&nbsp;&nbsp; /etc/ssl/certs/ssl.cstrc.br.pem&nbsp; #crtificado ssl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSLCertificateKeyFile /etc/ssl/private/ssl.cstrc.br.key #chave ssl
&lt;/VirtualHost&gt;



3) Salve e reinicie o apache 


/etc/init.d/apache2 restart




Criando Alias pra o ip do site final 25.2

1) acesse o arquivo /etc/network/interfaces

e criar interface virtual eth0:2

COM O IP 192.168.25.3. 


#Alterar DNS

Inserir entrada no DNS abaixo:

ssl IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192.168.25.3

sv1 IN&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp; 192.168.25.1

Obs:&nbsp; naõ esquecer de alterar configurações do arquvo www.cstrc.br em /apache2/sites-avaliable/www.cstrc.br conforme acima citado


-&gt; Configurando SSL no FTP

1) criar chave
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout 
/etc/ssl/private/vsftpd.key - out /etc/ssl/certs/vsftpd.pem

Common name: ftp.cstrc.br 

2) alterar vsftpd.d e insira os comandos aabaixo:

#vi /etc/vsftpd.conf


&nbsp;# SSL
listen=YES
ssl_enable=YES
allow_anon_ssl=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
rsa_cert_file=/etc/ssl/private/vsftpd.pem 

3)salve e reinicie o vstfpd

/etc/init.d/vsftpd restart. 


INSTALANDO E-MAIL POSTFIX
Instalando POSTFIX

1) apt-get install postfix 

2) selecione a opção Internet Commont

3) em System Mail name: coloque o domínio cstrc.br


3) editar o arquivo /etc/postfix/main.cf

mydestination = cstrc.br, sv1.cstrc.br, localhost.cstrc.br, localhost #todos os dominios listados


INSTALANDO IMAP E POP DOVECOTE SERVER

1)apt-get install&nbsp; dovecot-imapd dovecot-pop3d



2) Editar o arquivo main.cf para trabalar com mail DIR (padrao é mailBOX).
vi /etc/postfix/main.cf

adicionar a linha
mailbox_command = (deixar vaziol)
home_mailbox = Maildir/

3) executar o mailx&nbsp; e enviar e-mail para o usuario aluno para criar a pasta Maildir no home do aluno para que seja possível enviar e-mail.

4) baixar o thunderbird portable e testar. configurar no imap com o ip da maquina virtual e testar.


configurando RELAY no POSTFIX:

&nbsp;permitir envio de mensagens para oturos servidores, editar o arquivo /etc/postfix/main.cf conforme abaixo:

A) ir em mynetworks e incluir a rede 10.3.60.0/22 (rede EDU do SENAI)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #
&nbsp; B) relayhost - colocar correio.feiscnet.com.br (todas as mensagens fora do host ira encaminahr para oservidor do senai).

8) configurando DNS e-mail

vi&nbsp; /etc/bind/db.cstrc.br 

IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MX&nbsp;&nbsp;&nbsp; 5 mail.cstrc.br.

mail&nbsp;&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp; 192.168.25.1

imap&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp; CNAME mail
pop&nbsp;&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp; CNAME&nbsp; mail
smtp&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp; CNAME&nbsp; mail


#postkill -f

#pega todas as msgs defered e remove da lista defered = msgs com problema. 


Configuração e habilitação do SSL no PostFIX

1) apt-get install libsasl2-2 libsasl2-modules sasl2-bin

2)Crie o arquivo /etc/postifx/sasl/smtpd.conf

echo "pwcheck_method: saslauthd" &gt; /etc/postifx/sasl/smtpd.conf

3)restart o serviço sasauthd

/etc/init.d/sasauthd&nbsp; restart

4) criando chave para o postfix

openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/postfix.pem -keyout 

/etc/ssl/private/postfix.key


Common Name: mail.cstrc.br

5)&nbsp; editar o arquivo /etc/postfix/main.cf conforme abaixo&nbsp; 

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


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

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
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_cert_file=/etc/ssl/certs/postfix.pem
smtpd_tls_key_file=/etc/ssl/private/postfix.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# Adicionado agora
smtp_use_tls=yes
smtp_tls_note_starttls_offer=yes
smtpd_tls_loglevel =1
smtpd_tls_received_header=yes

smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth
smtpd_sasl_auth_enable=yes

smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_application_name = smtpd
broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

#end

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

myhostname = sv1.cstrc.br
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = cstrc.br, localhost.cstrc.br, localhost
relayhost = correio.fiescnet.com.br
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
#mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mailbox_command = 
home_mailbox = Maildir/
recipient_delimiter = +
inet_interfaces = all



CONFIGURANDO DOVECOT PARA UTILIZAR SSL:

1) Realizar backup do arquivo /etc/dovecot/dovecot.conf

cp /etc/dovecot/dovecot.conf&nbsp; /etc/dovecot.conf.BKP

2) alterar o arquivo dovecot conforme abaixo (basta so alterar as chaves ssl_key_file e ssl_cert_file:

&nbsp;protocols = imap imaps pop3 pop3s&nbsp;log_timestamp = "%Y-%m-%d %H:%M:%S "&nbsp;mail_privileged_group = mail&nbsp;ssl_cert_file = /etc/ssl/certs/postfix.pem&nbsp;ssl_key_file = /etc/ssl/private/postfix.key&nbsp;protocol imap {&nbsp;&nbsp; }&nbsp; protocol pop3 {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pop3_uidl_format = %08Xu%08Xv&nbsp;}&nbsp;protocol managesieve {&nbsp;}&nbsp;auth default {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mechanisms = plain login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; passdb pam {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; userdb passwd {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; socket listen {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path = /var/spool/postfix/private/auth&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mode = 0660&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user = postfix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; group = postfix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;dict {&nbsp; }&nbsp;plugin {&nbsp; }

&nbsp;3) restart dovecot

#: /etc/init.d/dovecot restart

INSTALANDO WEBMAIL SQUIRRELMAIL

1) instalando webmail squirrel mail

apt-get install squirrelmail squierrelmail-locales


2)&nbsp; acesse&nbsp; o diretorio/etc/squirrelmail&nbsp; e copie o arquivo apache.conf

cp apache.conf /etc/apache2/sites-available/squirrelmail

3) habilite osite squirrelmail

a2ensite squirrelmail

4) recarregue o apache

/etc/init.d/apache2 reload

5) criando nome do servidor no DNS webmail (webmail.cstrc.br)

webmail &nbsp; IN&nbsp;&nbsp;&nbsp; CNAME&nbsp; mail

6) Criando virtualhost para webmail.cstrc.br no arquivo /etc/apache2/sites-available/squirrelmail

&lt;VirtualHost *:80&gt;
&nbsp; ServerName webmail.cstrc.br
&nbsp; DocumentRoot /usr/share/squirrlmail
&nbsp; 
&lt;/VirtualHost &gt;


#####

apache2

apache2-utils

apache2.2-bin

apache2.2-common

Server Common files

libapache2-mod-php5