Does Dovecot-LDA need the -f argument (and what is its purpose)? - email

Dovecot-LDA seems to deliver mail without the -f argument, and delivered mail is identical with and without it, however many setup guides include it in the delivery command. I'm frequently seeing error messages regarding invalid -f arguments, and I figure that removing it from my delivery command should fix this.
How does the -f argument change Dovecot-LDA's behaviour, and do I really need to provide it?

-f sets "envelope sender". It is email address used in SMTP protocol MAIL FROM: command to indicate where delivery failure notifications should be send.
AFAIK dovecot-lda does not use it itself but may be used by sieve filters.
AFAIK Most MTA/SMTP servers put envelope sender address in Return-Path: header before the final delivery (e.g. before passing the message to dovecot-lda).
My rule of thumb suggestion: Try to fix your problem.
IF it is hard to fix AND you do not use envelope sender in sieve scripts
THEN you may remove -f option from dovecot-lda command line parameters.

Related

Why does BitBake error if it can't find www.example.com?

BitBake fails for me because it can't find https://www.example.com.
My computer is an x86-64 running native Xubuntu 18.04. Network connection is via DSL. I'm using the latest versions of the OpenEmbedded/Yocto toolchain.
This is the response I get when I run BitBake:
$ bitbake -k core-image-sato
WARNING: Host distribution "ubuntu-18.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
ERROR: OE-core's config sanity checker detected a potential misconfiguration.
Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
Following is the list of potential problems / advisories:
Fetcher failure for URL: 'https://www.example.com/'. URL https://www.example.com/ doesn't work.
Please ensure your host's network is configured correctly,
or set BB_NO_NETWORK = "1" to disable network access if
all required sources are on local disk.
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
The networking issue, the reason why I can't access www.example.com, is a question for the SuperUser forum. My question here is, why does BitBake rely on the existence of www.example.com? What is it about that website that is so vital to BitBake's operation? Why does BitBake post an Error if it cannot find https://www.example.com?
At this time, I don't wish to set BB_NO_NETWORK = "1". I would rather understand and resolve the root cause of the problem first.
Modifying poky.conf didn't work for me (and from what I read, modifying anything under Poky is a no-no for a long term solution).
Modifying /conf/local.conf was the only solution that worked for me. Simply add one of the two options:
#check connectivity using google
CONNECTIVITY_CHECK_URIS = "https://www.google.com/"
#skip connectivity checks
CONNECTIVITY_CHECK_URIS = ""
This solution was originally found here.
For me, this appears to be a problem with my ISP (CenturyLink) not correctly resolving www.example.com. If I try to navigate to https://www.example.com in the browser address bar I just get taken to the ISP's "this is not a valid address" page.
Technically speaking, this isn't supposed to happen, but for whatever reason it does. I was able to work around this temporarily by modifying the CONNECTIVITY_CHECK_URIS in poky/meta-poky/conf/distro/poky.conf to something that actually resolves:
# The CONNECTIVITY_CHECK_URI's are used to test whether we can succesfully
# fetch from the network (and warn you if not). To disable the test set
# the variable to be empty.
# Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master
CONNECTIVITY_CHECK_URIS ?= "https://www.google.com/"
See this commit for more insight and discussion on the addition of the www.example.com check. Not sure what the best long-term fix is, but the change above allowed me to build successfully.
If you want to resolve this issue without modifying poky.conf or local.conf or any of the files for that matter, just do:
$touch conf/sanity.conf
It is clearly written in meta/conf/sanity.conf that:
Expert users can confirm their sanity with "touch conf/sanity.conf"
If you don't want to execute this command on every session or build, you can comment out the line INHERIT += "sanity" from meta/conf/sanity.conf, so the file looks something like this:
Had same issue with Bell ISP when accessing example.com gave DNS error.
Solved by switching ISP's DNS IP to Google's DNS (to avoid making changes to configs):
https://developers.google.com/speed/public-dns/docs/using

Download mail using IMAP with fetchmail

I need to download all mail messages from a mail account with fetchmail.
When I try with POP3 I can download all mail correctly in this format:
[root#srv root]# ls /home/mail_import/MAIL_USER/new/
1453828024.7837_0.srv
1453828029.7843_0.srv
But pop3 protocol don't allow to choose a folder, so i need to use IMAP.
I cannot download the mails separately when using IMAP. I tried and I have a single file with all mails.
For example:
[root#srv home]# stat /home/mail_import/MAIL_USER/teste
File: ‘/home/mail_import/MAIL_USER/teste’
[root#srv home]# head /home/mail_import/MAIL_USER/teste
From root#SRV Tue Jan 26 18:56:31 2016
Return-path: <root#SRV >
Envelope-to: MAIL_USER#SRV
Delivery-date: Wed, 02 Dec 2015 15:47:00 -0500
I need to download all mails using imap in separate files like the pop3.
My .fetchmailrc is:
set bouncemail
set no spambounce
set softbounce
set properties ""
defaults:
antispam -1
batchlimit 100
poll DOMAIN with proto IMAP
user 'USER' there with password 'PASS' is 'MAIL' here
options keep fetchall ssl mda "/usr/bin/procmail -f %F -d %T";
folder INBOX
and my .procmailrc is:
MAILDIR=/home/mail_import/MAIL_ACCOUNT
DEFAULT=$MAILDIR/INBOX
LOGFILE=/var/log/procmail
LOCKFILE=$MAILDIR/.default.lock
VERBOSE=on
:0 fhw
|formail
#
## Any other rules the user wishes to either include with INCLUDERC,
## or hardcode into this file, would go here.
## --------------------------------------------------------------------------
## If we're here, the mail didn't match any other rules, so deliver normally.
:0:
$DEFAULT
## If that fails, report an error and throw the mail away.
EXITCODE=75
:0
/dev/null
There is some correct option to download the e-mail using IMAP separately equal POP3?
I don't see why you are using Procmail here at all. Just run Fetchmail and let it fetch your mail. Specify a destination folder in a suitable format, and go.
Whether or not email messages are separate files is not a feature of the protocol. It is a feature of the delivery program you use; if you choose to deliver to a file (Berkeley mbox format; what you are seeing here, with a From_ line at the beginning of every message) then all messages will be delivered to a single file. If you deliver to a folder (in maildir format, for example, with the new tmp cur subdirectories) you will get the result you are asking for. Just do whatever you did to get your POP3 messages into the maildir folder MAIL_USER, only using imap instead of pop3, and you are all set.
If you specifically want to do this in Procmail, change
DEFAULT=$MAILDIR/INBOX
to
DEFAULT=$MAILDIR/
But the entirety of your .procmailrc seems pointless. Why do you pipe stuff through formail? The actions you have simply duplicate Procmail's default behavior, with a couple of bugs. I think you could simplify both your own understanding and the process by figuring out how to have Fetchmail deliver the messages straight where you want them. (Not entirely sure whether it supports maildir, though; quick googling was inconclusive. Maybe don't specify an mda at all if that's how you made this happen with POP3.)

Setting up DKIM for Parse.com

How can I set up DKIM with the DNS record for the domain we use for mails being sent from Parse.com, like registration emails?
Parse has only this one line of instructions:
"Run the following in your terminal: dig +short k1._domainkey.parse.com txt for the most up-to-date DKIM value."
But what next? The output is something like this: "k=rsa\; p=MIGfMA0GCSqGSIb3...44Dyfnzp7zmQIDAQAB".
How does the DNS entry has to look like?
Like this?
k1._domainkey.parse.com IN TXT "k=rsa\; p=MIGfMA0GCSqGSIb3...44Dyfnzp7zmQIDAQAB"
You need to put this on your own DNS. If your domain is company.com, a record like this in your company.com zone file should do it:
k1._domainkey.company.com In TXT "k=rsa\; p=MIGfMA0GCSqGSIb3...44Dyfnzp7zmQIDAQAB"
Just make sure that parse.com will DKIM sign the message with your company.com domain and set d=k1!
According to http://dkimcore.org/c/keycheck, I needed to delete the \ after k=rsa for the key type to be valid.

Configuring postfix to only send to a specified domain

In order to not accidentally send real emails to people outside the company from an integration test server, I'd like to configure postfix to only send emails to addresses like *#somecompany.com and drop all other emails. Is it possible to somehow configure it in /etc/postfix/main.cf and if yes then how?
You can specify like that with the help of /etc/postfix/transport file
You can add the line transport_maps = hash:/etc/postfix/transport in main.cf
Do the steps below
Create a transport - transport1 and Mail sent to user "user#gmail.com" should go through transport1 and all other mail sent should go through default.
First stop dual instances of postfix if any.
Open /etc/postfix/main.cf
and set inet to all.
Add the following to master.cf
transport1 unix - - n - 1 smtp
-o smtp_bind_address= (add a space at 1st)
-o syslog_name=postfix-localroute1 (add a space at 1st)
Add/create the following to /etc/postfix/transport
somecompany.com transport1:
Run postmap after defining the transport file.
postmap /etc/postfix/transport
I have defined a transport above. It means all mail to #somecompany.com will go through you specifed in transport and that ip will not b displayed as it is in maillog. Instead it will be shown as postfix-localroute1
Add the following to main.cf
transport_maps = hash:/etc/postfix/transport
Run:postmap /etc/postfix/transport
Reload postfix:postfix reload

Debian - invoke external script from exim on receipt of emails

I am looking fopointers on the best approach to process incoming emails to a certain vhost and to call an external script with the email data as parameters - basically to allow email to be sent to a certain "private" email address at a host which then auto inserts something into that sites database. I currently have exim set up as the mail handler.
You have to follow exim single file configurations structure. In routers section write your own custom router that will deliver email to your desired php script. In transport section write your own custom transport that will ensure delivery to the desired script using curl. Just write the following configurations in your /etc/exim.cnf file:
############ROUTERS
runscript:
driver = accept
transport = run_script
unseen
no_expn
no_verify
############TRANSPORT
run_script:
debug_print = "T: run_script for $local_part#$domain"
driver = pipe
command = /home/bin/curl http://my.domain.com/mailTest.php --data-urlencode $original_local_part#$original_domain
Where mailTest.php will be your destined script.
Procmail is a good generic answer. If your needs are very specific, you could hook in your own script directly from your .forward (or Exim's corresponding construct -- can't remember exactly how it differs), but oftentimes, wrapping your own script inside a simple .procmailrc helps you avoid a bunch of iffy details of email delivery, and concentrate on the actual processing.
:0
' ^Subject: secretpassword adduser \/[A-Z]+
| echo "insert $MATCH into users" | mysql -d users