linuxware
(usa Ubuntu)
Enviado em 25/07/2013 - 13:33h
Buckminster escreveu:
Veja se não falta habilitar o acesso ao relay da sua rede interna.
Entre no arquivo no arquivo /etc/postfix/main.cf e procure pelas linhas:
inet_interfaces = all
mynetworks_style = subnet
mynetworks = 127.0.0.1/8, 192.168.0.0/24 << aqui você coloca sua rede interna, mas deixe o localhost (127.0.0.1/8).
E também talvez seja necessário mexer no serviço inetd. Veja isto:
http://virtual01.lncc.br/~licht/linux/servidores.postfix.arq.html
Procure CL7.0 e CL8 nesse link.
Buck,
Vou postar o meu Main.cf pra vcs darem uma olhada, e também meu script que está sendo usado no Gateway.
### MAIN .CF ###
# postfix config file
# uncomment for debugging if needed
soft_bounce=yes
# postfix main
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4
# postfix paths
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.2/samples
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES
# network settings
inet_interfaces = all
mydomain = servidorwebhosting.minidns.net
myhostname = servidorwebhosting.minidns.net
mynetworks = all
mydestination = $mydomain, localhost
relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf
# mail delivery
recipient_delimiter = +
# mappings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#transport_maps = hash:/etc/postfix/transport
#local_recipient_maps =
# virtual setup
virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf,
regexp:/etc/zpanel/configs/postfix/virtual_regexp
virtual_mailbox_base = /var/zpanel/vmail
virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
# debugging
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
# authentication
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
# tls config
smtp_use_tls = no
smtpd_use_tls = no
#smtp_tls_note_starttls_offer = yes
#smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
#smtpd_tls_session_cache_timeout = 3600s
#tls_random_source = dev:/dev/urandom
#smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
# Change mail.example.com.* to your host name
#smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key
#smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt
# smtpd_tls_CAfile = /etc/pki/tls/root.crt
# rules restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain
# uncomment for realtime black list checks
# ,reject_rbl_client zen.spamhaus.org
# ,reject_rbl_client bl.spamcop.net
# ,reject_rbl_client dnsbl.sorbs.net
smtpd_helo_required = yes
unknown_local_recipient_reject_code = 550
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining
###### gateway ##################
#!/bin/bash
iniciar(){
#Carrega o modulo
modprobe iptable_nat
#Ativa o compartilharmento da internet para o dhcp
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#libera as portas smtp
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port smtp -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port smtp -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port smtps -j ACCEPT
#libera http, https, pop3, pop3s
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port http -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port https -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port pop3 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port pop3s -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port poppassd -j ACCEPT
#libera imap
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port imap -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port imaps -j ACCEPT
#libera o ISP
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 8080 -j ACCEPT
#libera SSH
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port ssh -j ACCEPT
#libera DNS
iptables -A INPUT -p udp -s 0/0 -d 0/0 --destination-port domain -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port domain -j ACCEPT
#libera FTP
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port ftp-data -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port ftp -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 32000:65534 -j ACCEPT
#libera mysql
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port mysql -j ACCEPT
#libera as portas do DVR
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 3500 -j ACCEPT
iptables -A INPUT -p udp -s 0/0 -d 0/0 --destination-port 3500 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 8200 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 8200 -j ACCEPT
iptables -A OUTPUT -p tcp -s 0/0 -d 0/0 --destination-port 3500 -j ACCEPT
iptables -A OUTPUT -p tcp -s 0/0 -d 0/0 --destination-port 8200 -j ACCEPT
iptables -A OUTPUT -p udp -s 0/0 -d 0/0 --destination-port 3500 -j ACCEPT
iptables -A OUTPUT -p udp -s 0/0 -d 0/0 --destination-port 8200 -j ACCEPT
#libera a porta 465 para acesso externo para uso do smtp do zpainel
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 587 -j ACCEPT
iptables -A INPUT -p udp -s 0/0 -d 0/0 --destination-port 587 -j ACCEPT
iptables -A OUTPUT -p tcp -s 0/0 -d 0/0 --destination-port 587 -j ACCEPT
iptables -A OUTPUT -p udp -s 0/0 -d 0/0 --destination-port 587 -j ACCEPT
#bloquea facebook pc estoque
iptables -A FORWARD -i eth1 -s 192.168.0.107 -m string --algo bm --string "facebook.com" -j DROP
iptables -A FORWARD -i eth1 -s 192.168.0.107 -m string --algo bm --string "twitter.com" -j DROP
#bloqueia gamevicio, ou outros sites
iptables -A FORWARD -i eth1 -s 192.168.0.107 -m string --algo bm --string "gamevicio.com" -j DROP
iptables -A FORWARD -i eth1 -s 192.168.0.107 -m string --algo bm --string "youtube.com" -j DROP
#redireciona ip externo para ip do dvr
#iptables -t nat -A PREROUTING -p tcp --dport 3500 -j DNAT --to-destination 192.168.0.109:3500
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 3500 -j DNAT --to-destination 192.168.0.109:3500
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 8200 -j DNAT --to-destination 192.168.0.109:8200
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.109 --dport 3500 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.109 --dport 8200 -j ACCEPT
#redireciona acesso eth0 para 192.168.0.111 ,portas 80,8080, 443, 110, 25, 587 e 53
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 80 -j DNAT --to-destination 192.168.0.111:80
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 8080 -j DNAT --to-destination 192.168.0.111:8080
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 443 -j DNAT --to-destination 192.168.0.111:443
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 110 -j DNAT --to-destination 192.168.0.111:110
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 25 -j DNAT --to-destination 192.168.0.111:25
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 177.53.80.39 --dport 587 -j DNAT --to-destination 192.168.0.111:587
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 80 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 8080 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 443 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 110 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 25 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -p tcp -d 192.168.0.111 --dport 587 -j ACCEPT
}
parar(){
iptables -F
iptables -F -t nat
}
case "$1" in
"start")iniciar;;
"stop")parar;;
"restart")parar; iniciar;;
*) echo "Escolha um parametro: Start, Stop ou Restart"
esac
Eu testei o outlook denovo, e ele retornava o mesmo erro " não foi possivel conectar ao servidor de saida..." quando eu usava a porta 587. Ele só logou aqui no local, quando usei a 25.
Outro fato é que, ele não acha as configurações automaticas, como acontece quando você coloca seu gmail lá no e-mail por exemplo.
Eu tenho que definir na mão.