Saturday, July 13, 2019

Postfix : SMTP; Client does not have permissions to send as this sender

If you are trying to send mails through Postfix using SMTP credentials and you are getting above error, here is the solution for you.

Check the 'from address' in the log file, this is not the same email address what's your login email id. To make the 'from address' same as login email id add following lines in the file /etc/postfix/main.cf
canonical_maps = regexp:/etc/postfix/canonical
canonical_classes = envelope_sender
canonical_maps = regexp:/etc/postfix/canonical

Now create a file /etc/postfix/canonical and add your smtp login email address in the file
// username@domainname.com
(user both back slashes in the file)

Now it will send mails by this 'from address'.

Postfix : SASL authentication failed

SASL authentication failed; cannot authenticate to server smtp.server.net[52.75.xx.x]: generic failure

If you are trying to send mails through Postfix using SMTP credentials and you are getting above error, here is the solution for you.

You need to add the following line in the file /etc/postfix/main.cf
smtp_sasl_mechanism_filter = login
Restart postfix.

I am assuming, you have added following parameters in main.cf file already.
relayhost = [smtp.server.net]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

dynamodump error : u'message': u'The security token included in the request is invalid.

Solution :
You have not added access keys and secret keys in the file $HOME/.aws/credentials. Add the content in the file.

cat ~/.aws/credentials
[default]
aws_access_key_id = AKIAJSEXAMPLEHXI3BJQ
aws_secret_access_key = 5bEYu26084qExAmPlE/f2pz4gviSfoOgSaMpLe39

PDF Compression Error

FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI

Solution : 
Download the file from here according to your operating system.
Mine is Linux x86 (64 bit) so I have downloaded Ghostscript 9.27 for Linux x86 (64 bit)
I renamed the file as gslin64. Original filename was gs-927-linux-x86_64.
Save it in /usr/bin.
Now run the following command
gslin64 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=/tmp/abc.pdf  input.pdf
where input.pdf is error pdf file and abc.pdf is error free output file which is saved inside /tmp directory 

sign_and_send_pubkey: signing failed: agent refused operation

If you are getting this ssh error while connection to any remote instance, you might have changed public and private keys recently.

To fix this issue you need to attach your ssh keys with running ssh agent. Run command
ssh-add

If you get warning 'Permissions are too open.' You need to give 400 permission to your ssh keys.

chmod 400 ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa.pub

Now it should not show error ' signing failed: agent refused operation' while connecting to remote host.