Hello Fantomas ^^) (loves the nickname ^^))

Le 25/06/2021 à 09:34, Matus UHLAR - fantomas a écrit :
Le 24/06/2021 à 17:04, Matus UHLAR - fantomas a écrit :
On 24.06.21 16:55, Matus UHLAR - fantomas wrote:

relayhost = [mail.'external host']:587
http://www.postfix.org/postconf.5.html#relayhost

and apparently configure SMTP Authentication by using:

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_auth_enable = yes
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level=encrypt

and put '[mail.'external host']    user:password'

sorry, this had to be:

[mail.'external host']:587        user:password

(removed apostrophes and added :port)

into /etc/postfix/sasl_passwd
http://www.postfix.org/postconf.5.html#smtp_sasl_password_maps

On 24.06.21 17:40, Jean-François Bachelet wrote:
well with this kind of config I finally get mails to be sent outside the server to 'customer@anywhere' by the 587 port. that's better.


BTW, the received mail says coming from 'root'@mydomain and not as expected webmaster@mydomain :(

Whoever submits the mail, is supposed to set the sender. Othwerise, the
sending user is set from active user which is 0==root.

for testing the mail sending I've used this in the shell :


echo "please don't reply" | mail -s "Test" jfbache...@free.fr


so, you're right there isn't any sender email in this, just the destination... damn' tutos and brain that forget about this ;)


seeing what you wrote I've tried this :


echo "please don't reply" | mail -s "Test" jfbache...@free.fr from webmaster@mydomain


I've tried with FROM too and by putting the 'from' address before the destination one...

i.e : FROM blabla TO patatipatata


BTW, the received mail originate still from 'root@mydomain' ??? the 'FROM' or 'from' address is added to... destination addresses !  I get this in destination :

jfbache...@free.fr ; from@mydomain ; webmaster@mydomain


that little 'mail' system command is kind of strange... :/


the root = webmaster@mydomain exists in the aliases file so why ? what to change in  where config file to change that ?

aliases map recipients, not senders, see:
http://www.postfix.org/canonical.5.html

then the test mail meant to be sent to webmaster@mydomain is still not delivered :( error is still webmaster : user don't exists

yes, because the mail is handled locally - your postfix thinks it handles
mail for "mydomain". If "mydomain" is to be handled by remote server, you
must not set it as local.

so I must modify mail.cf 'mydestination =' variable ?  now it's set to mydomain, localhost@mydomain, localhost  (like said in that tutos... grr)


here is a copy of main.cf, can you have a look and tell me what can be wrong for what I expect from postfix :

- sends mail from hosted websites and server authorized services only to the outside world

- sends from different senders addresses (sales, webmaster, admin, etc...) to whateverdestination@whereever for each hosted site

- sends only by SMTPS secure 587 port using the externalserver

- doesn't accept in mails as this is handled by the external mail server

- doesn't accept to relay othermails from unknown senders/addresses


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


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file = /etc/ssl/mydomain.pem
smtpd_tls_key_file = /etc/ssl/private/mydomain.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

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

smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination
smtpd_sender_restrictions = permit_mynetworks
myhostname = mail.mydomain
alias_maps = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain, localhost.mydomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_tls_wrappermode = yes
smtpd_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtpd_client_restrictions = permit_sasl_authenticated, reject
milter_macro_daemon_name = originating
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password_map
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
smtpd_relay_restrictions = ${{$compatibility_level} < {1} ? {} : {permit_mynetworks permit_sasl_authenticated defer_unauth_destination}}
relayhost = [mail.externalserver]:587
# relay_domains = $mydestination
mynetworks_style = subnet
notify_classes =


mails to that address from the postfix server just 'vanishes' I find it nowhere on the server, nor in root mailbox nor user mailbox nor /var/spool/ or /var/mail...

don't know where it go

it was dropped as neither recipient, nor the sender (recipient for
non-delivery notifiaction) was deliverable.

if I understand well this should change after the mydestination value is modified...


Jun 24 17:12:45 amiga postfix/pickup[32154]: 8E5011C80B28: uid=0 from=<root@mydomain> Jun 24 17:12:45 amiga postfix/cleanup[32161]: 8E5011C80B28: message-id=<20210624151245.8E5011C80B28@mail.mydomain> Jun 24 17:12:45 amiga postfix/qmgr[32155]: 8E5011C80B28: from=<root@mydomain>, size=357, nrcpt=1 (queue active) Jun 24 17:12:45 amiga postfix/local[32164]: 8E5011C80B28: to=<webmaster@mydomain>, relay=local, delay=0.14, delays=0.09/0.01/0/0.05, dsn=5.1.1, status=bounced (unknown user: "webmaster") Jun 24 17:12:45 amiga postfix/cleanup[32161]: A77451C80B40: message-id=<20210624151245.A77451C80B40@mail.mydomain> Jun 24 17:12:45 amiga postfix/bounce[32165]: 8E5011C80B28: sender non-delivery notification: A77451C80B40 Jun 24 17:12:45 amiga postfix/qmgr[32155]: A77451C80B40: from=<>, size=2258, nrcpt=1 (queue active)
Jun 24 17:12:45 amiga postfix/qmgr[32155]: 8E5011C80B28: removed
Jun 24 17:12:45 amiga postfix/local[32164]: A77451C80B40: to=<webmaster@mydomain>, orig_to=<root@mydomain>, relay=local, delay=0.07, delays=0.03/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "webmaster")
Jun 24 17:12:45 amiga postfix/qmgr[32155]: A77451C80B40: removed


Thanks a lot for your *elp ^^)

regards,

JF

Reply via email to