Postfix wysyłanie maili z poza sieci

Konfiguracja serwerów, usług, itp.
armen10
Posty: 48
Rejestracja: 16 września 2008, 11:02
Lokalizacja: Polska

Postfix wysyłanie maili z poza sieci

Post autor: armen10 »

Cześć mam sytuację, że skonfigurowałem sobie serwer postfix w pracy i działa, ale kiedy łącze się w domu z serverem to ma:
454 4.7.1 Relay access denied.
Kiedy dodam swój adres do sekcji mynetwork = x.x.x.x/24, to wszystko chodzi.
Jak zrobić, abym nie musiał za każdym razem dodawać adresu do w/w sekcji ?
Chciuałbym się łączyć z dowolnego punktu z moim serwerem i wysyłać sobie poczte.
Z góry dzięki za pomoc.
Awatar użytkownika
LordRuthwen
Moderator
Posty: 2302
Rejestracja: 18 września 2009, 21:45
Lokalizacja: klikash?

Re: Postfix wysyłanie maili z poza sieci

Post autor: LordRuthwen »

w main.cf ustaw w smtpd_helo_restrictions: permit_sasl_authenticated przed permit_mynetworks i swój ip z mynetworks możesz wywalić.
armen10
Posty: 48
Rejestracja: 16 września 2008, 11:02
Lokalizacja: Polska

Re: Postfix wysyłanie maili z poza sieci

Post autor: armen10 »

smtpd_helo_restrictions =
permit_sasl_authenticated
permit_mynetwors

mynetworks = 127.0.0.0/8

Pokazuje mi, że "451 4.3.5 Server configuration error." :(
Nawet jak w mynetworks nic nie było, to błąd był ten sam.

Jakbyś mógł mi pomóc to byłby Ci bardzo wdzięczny... Co w tym configu wg Ciebie jest źle ?

Kod: Zaznacz cały

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
#debug_peer_level = 2
#debug_peer_list = 127.0.0.1
## Mail queue settings
maximal_queue_lifetime = 2h
bounce_queue_lifetime = 1h
maximal_backoff_time = 15m
minimal_backoff_time = 5m
queue_run_delay = 5m
# DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8892
non_smtpd_milters = inet:localhost:8892
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/xxx.pl.crt
smtpd_tls_key_file = /etc/postfix/ssl/xxx.pl.key
smtpd_tls_loglevel = 1
tls_random_source = dev:/dev/urandom
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_tls_note_starttls_offer = yes
smtpd_tls_auth_only = no
policyd-spf_time_limit = 3600s
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_protocols = !SSLv2, !SSLv3
smtp_tls_exclude_ciphers = EXP, MEDIUM, LOW, DES, 3DES, SSLv2
smtpd_tls_exclude_ciphers = EXP, MEDIUM, LOW, DES, 3DES, SSLv2
tls_high_cipherlist = kEECDH:+kEECDH+SHA:kEDH:+kEDH+SHA:+kEDH+CAMELLIA:kECDH:+kECDH+SHA:kRSA:+kRSA+SHA:+kRSA+CAMELLIA:!aNULL:!eNULL:!SSLv2:!RC4:!MD5:!DES:!EXP:!SEED:!IDEA:!3DES
tls_medium_cipherlist = kEECDH:+kEECDH+SHA:kEDH:+kEDH+SHA:+kEDH+CAMELLIA:kECDH:+kECDH+SHA:kRSA:+kRSA+SHA:+kRSA+CAMELLIA:!aNULL:!eNULL:!SSLv2:!MD5:!DES:!EXP:!SEED:!IDEA:!3DES
smtp_tls_ciphers = high
smtpd_tls_ciphers = high

smtpd_relay_restrictions =
     permit_mynetworks
     permit_sasl_authenticated
     defer_unauth_destination

smtpd_sender_restrictions =
     permit_mynetworks
     permit_sasl_authenticated
     reject_unknown_reverse_client_hostname
#----------------------------------
smtpd_helo_required = yes
smtpd_helo_restrictions =
     permit_sasl_authenticated
    permit_mynetwors
    permit_sasl_authenticated
    reject_invalid_helo_hostname
    reject_non_fqdn_helo_hostname
    reject_unknown_helo_hostname
    check_helo_access hash:/etc/postfix/helo_access
#-----------------------------------
smtpd_recipient_restrictions =
     reject_invalid_hostname
     reject_unauth_pipelining
     permit_mynetworks
     reject_unauth_destination
     check_policy_service unix:private/policyd-spf
     check_client_access hash:/etc/postfix/rbl_override
     reject_rhsbl_helo dbl.spamhaus.org
     reject_rhsbl_reverse_client dbl.spamhaus.org
     reject_rhsbl_sender dbl.spamhaus.org
     reject_rbl_client zen.spamhaus.org
     reject_rbl_client multi.uribl.com
     reject_rbl_client dsn.rfc-ignorant.org
     reject_rbl_client dul.dnsbl.sorbs.net
     reject_rbl_client list.dsbl.org
     reject_rbl_client sbl-xbl.spamhaus.org
     reject_rbl_client bl.spamcop.ne
     reject_rbl_client dnsbl.sorbs.ne
     reject_rbl_client cbl.abuseat.org
     reject_rbl_client ix.dnsbl.manitu.net
     reject_rbl_client combined.rbl.msrbl.net
     reject_rbl_client rabl.nuclearelephant.com
     permit
#Enable Greylisting in Postfix
    check_policy_service inet:127.0.0.1:60000
    check_policy_service unix:private/policyd-spf
    
## SENDER DEPENDENT RELAYs
## auth
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = GSSAPI, DIGEST-MD5, CRAM-MD5, login, plain
#smtp_tls_security_level = encrypt
smtp_sasl_security_options = noplaintext, noanonymous
smtp_sasl_tls_security_options = noplaintext, noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_type = cyrus
smtpd_sasl_local_domain =
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
#-------------------------------------
myhostname = aaa.xxx.org
myorigin = /etc/mailname
mydomain = xxx.org
masquerade_domains = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, xxx.org, localhost.localdomain, localhost.localdomain, localhost
#mydestination = $myhostname, xxx.com.pl, info.xxx.net, xxx.net, localhost.$mydomain, localhost.localdomain, localhost
#mynetworks =  /etc/postfix/network_table
#mynetworks = 127.0.0.0/8
mynetworks = 127.0.0.0/8 192.168.1.0/24 34.223.444.11/28
relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
#virtual_transport = dovecot
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_domains = xxx.pl, xxx.com.pl, info.xxx.net, xxx.net

#ClamSMTP
content_filter = scan:localhost:10026
#receive_override_options = no_address_mappings


Awatar użytkownika
LordRuthwen
Moderator
Posty: 2302
Rejestracja: 18 września 2009, 21:45
Lokalizacja: klikash?

Re: Postfix wysyłanie maili z poza sieci

Post autor: LordRuthwen »

Popatrz w logu postfixa. Tam powinno być coś więcej.
armen10
Posty: 48
Rejestracja: 16 września 2008, 11:02
Lokalizacja: Polska

Re: Postfix wysyłanie maili z poza sieci

Post autor: armen10 »

Cały czas mi pokazuje 554 5.7.1 <xxx@o2.pl>: Relay access denied;
Jak dodam adres IP do mynetwork jest ok. Ale nie oto chodzi...
A da się tak w ogóle zrobić, aby serwer nie był Open Relay ? I można było się logować z każdego miejsca ?
Awatar użytkownika
pawkrol
Moderator
Posty: 939
Rejestracja: 03 kwietnia 2011, 10:25

Re: Postfix wysyłanie maili z poza sieci

Post autor: pawkrol »

Co masz na myśli mówiąc "łącze się w domu z serverem ".
Jak się łączysz klientem pocztowym,telnetem?
armen10
Posty: 48
Rejestracja: 16 września 2008, 11:02
Lokalizacja: Polska

Re: Postfix wysyłanie maili z poza sieci

Post autor: armen10 »

Jestem w domu odpalam Mozilla Thunderbird i jak nie dodam swojego domowego adresu ip do serwera, to mam ten błąd co u góry. A to server firmowy i jest ok 50 ludzi, to bez sensu dodawać każdy adres ip do servera.
Awatar użytkownika
pawkrol
Moderator
Posty: 939
Rejestracja: 03 kwietnia 2011, 10:25

Re: Postfix wysyłanie maili z poza sieci

Post autor: pawkrol »

Mniemam, że łączysz się po porcie ssl,tls. Pokaż plik master.cf.
armen10
Posty: 48
Rejestracja: 16 września 2008, 11:02
Lokalizacja: Polska

Re: Postfix wysyłanie maili z poza sieci

Post autor: armen10 »

Proszę :)

Kod: Zaznacz cały

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
smtp      inet  n       -       y       -       -       smtpd
  -o content_filter=spamassassin

spamassassin unix -     n       n       -       -       pipe
    user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

#smtp      inet  n       -       y       -       1       postscreen
#smtpd     pass  -       -       y       -       -       smtpd
#dnsblog   unix  -       -       y       -       0       dnsblog
#tlsproxy  unix  -       -       y       -       0       tlsproxy

submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=no
#  -o smtpd_tls_auth_only=yes
###
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING

smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=no
###
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       y       -       -       qmqpd
#--------------------------------------------------------------------
# ClamAV
scan unix -       -       n       -       16       smtp
   -o smtp_data_done_timeout=1200
   -o smtp_send_xforward_command=yes
   -o disable_dns_lookups=yes
127.0.0.1:10025 inet n       -       n       -       16       smtpd
   -o content_filter=
   -o local_recipient_maps=
   -o relay_recipient_maps=
   -o smtpd_restriction_classes=
   -o smtpd_client_restrictions=
   -o smtpd_helo_restrictions=
   -o smtpd_sender_restrictions=
   -o smtpd_recipient_restrictions=permit_mynetworks,reject
   -o mynetworks_style=host
#--------------------------------------------------------------------
# SPF
policyd-spf  unix  -       n       n       -       0       spawn
    user=policyd-spf argv=/usr/bin/policyd-spf
#--------------------------------------------------------------------

#628       inet  n       -       y       -       -       qmqpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
        -o syslog_name=postfix/$service_name
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

Awatar użytkownika
pawkrol
Moderator
Posty: 939
Rejestracja: 03 kwietnia 2011, 10:25

Re: Postfix wysyłanie maili z poza sieci

Post autor: pawkrol »

Zakomentuj całą sekcję submission i wklej np tak:

Kod: Zaznacz cały

submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_tls_auth_only=yes
  -o smtpd_sasl_auth_enable=yes
  -o milter_macro_daemon_name=ORIGINATING
  -o smtpd_helo_restrictions=
  -o receive_override_options=no_header_body_checks
  -o smtpd_sender_restrictions=reject_sender_login_mismatch,permit_sasl_authenticated,reject
  -o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
W thunderbird połączenie ustaw na port 587, STARTTLS.
ODPOWIEDZ