Sendgrid on Compute Engine not working - postfix-mta

I setup Postfix with sendgrid just like the guide here: https://developers.google.com/compute/docs/sending-mail?hl=en#postfixsendgrid
but it's not working. when i run the test command:
printf 'Subject: test\r\n\r\npassed' | /usr/sbin/sendmail myemail#gmail.com
I get this error in the log:
Sep 1 11:58:12 instance-1 postfix/qmgr[23412]: 8205A1E38: from=<*******#instance-1.c.mindful-vial-682.internal>, size=301, nrcpt=1 (queue active)
Sep 1 11:58:12 instance-1 postfix/smtp[23422]: warning: SASL authentication failure: No worthy mechs found
Sep 1 11:58:12 instance-1 postfix/smtp[23422]: 8205A1E38: SASL authentication failed; cannot authenticate to server smtp.sendgrid.net[208.43.76.147]: no mechanism available
Sep 1 11:58:13 instance-1 postfix/smtp[23422]: warning: SASL authentication failure: No worthy mechs found
Sep 1 11:58:13 instance-1 postfix/smtp[23422]: 8205A1E38: to=<myemail#gmail.com>, relay=smtp.sendgrid.net[208.43.76.146]:2525, delay=0.62, delays=0.01/0.02/0.59/0, dsn=4.7.0, status=deferred (SASL
authentication failed; cannot authenticate to server smtp.sendgrid.net[208.43.76.146]: no mechanism available)

If you're using debian, you'll need to install libsasl2-modules as well:
apt-get install libsasl2-modules
That fixed the issue for me.

Or using a yum (i.e., RedHat, Fedora, CentOS):
yum install cyrus-sasl-plain
found this solution in sendgrid docs

try reading the solution for "No worthy mechs found" error documented at [1].
Kind Regards
Paolo
[1] - http://www.postfix.org/SASL_README.html#client_sasl_policy

The only thing that was able to resolve this issue on Google Compute Engine was to statically link my sendgrid credentials in the postfix config file:
# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:SENDGRID_ACCOUNT_EMAIL_HERE:PASSWORD_HERE
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
I found this solution in this answer

Related

Postfix Username and Password not accepted (BadCredentials)

and thank you for reading. I know this question has been asked many times - I've read a ton of different answers, and have tried most of them. None of them have worked so far. I'm pretty new to using postfix and appreciate any assistance you can provide.
I'm using Proxmox 6.1, on Debian buster. I'm attempting to use the email function for failed backups. My domain is using Gsuite mail. I have setup the SMTP relay with both my ipv4 and ipv6 public addresses, and I have verified the credentials are correct and generated new .db each time I made a change.
My sasl_passwd
smtp-relay.gmail.com:587 root#mydomain.com:password
My main.cf (domain & ip have been edited)
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
#myhostname=pve.myisp (auto generated)
myhostname = mydomain.com
#G-Suite relay test
relayhost = smtp-relay.gmail.com:587
# Use tls
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom
# Use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes
# Path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# List of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
# Eliminates default security options which are imcompatible with gmail
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
compatibility_level = 2
Error logs:
Apr 30 16:45:52 pve postfix/qmgr[34586]: 4B3AD320C9A: from=<root#mydomain.com>, size=396, nrcpt=1 (queue active)
Apr 30 16:45:54 pve postfix/smtp[34617]: 4B3AD320C9A: SASL authentication failed; server smtp-relay.gmail.com[74.125.30.28] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials m33sm110720uad.2 - gsmtp
Apr 30 16:45:54 pve postfix/smtp[34617]: 4B3AD320C9A: to=<mypersonalemail#gmail.com>, relay=smtp-relay.gmail.com[2607:f8b0:4003:c0b::1c]:587, delay=2.6, delays=0.05/0.06/2.4/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp-relay.gmail.com[2607:f8b0:4003:c0b::1c] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials v7sm169048ooo.20 - gsmtp)
I managed to solve my issue.
Ignore any & all gsuite documentation, and use [smtp.gmail.com]:587 instead of smtp-relay.gmail.com:587

Openstack Keystone Authentication failure

I am new to Openstack. I installed Openstack using Packstack in my CentOS machine. When I try to login using the default keystone_admin credentials, it showed a server error.
Here is my keystone.log file. Can somebody help?
2020-05-07 03:13:57.097 2303 WARNING keystone.server.flask.application [req-8c75dc88-73f3-4605-8a6b-3ba515d9fd84 3a3280ddae08412ab1145c193b587161 - - default -] Authorization failed. The request you have made requires authentication. from 192.168.225.30: Unauthorized: The request you have made requires authentication.
2020-05-07 03:13:57.235 2300 WARNING keystone.common.rbac_enforcer.enforcer [req-d1a5e980-617f-48d4-8322-40b0aa068140 3a3280ddae08412ab1145c193b587161 - - default -] Deprecated policy rules found. Use oslopolicy-policy-generator and oslopolicy-policy-upgrade to detect and resolve deprecated policies in your configuration.
Link to picture
try to find any rc files in your /root folder.
the file name is similar with openrc or adminrc
$ .openrc
$ try some openstack command
and it will succeed.

MailDev with Symfony 5 Mailer TLS crash

I'm working on my local machine on a Symfony 5 project. To test some mail functionality, I decided to use Node.js MailDev package.
The problem is that I found that MailDev does not support TLS encryption at this moment (version 1.1.0), and I found nothing on Symfony Mailer configuration that's allowed me to disable mail encryption.
When I try to send an email with encryption, MailDev server just crashes.
How can I solve that?
Thanks,
Navalex
Please try:
In .env file: MAILER_DSN=smtp://localhost:1025
Start server: maildev --hide-extensions STARTTLS
if you are using docker try this command
docker run -p 1080:80 -p 1025:25 nameofyourcontainer --web 80 --smtp 25 --hide-extensions STARTTLS

Cannot install Jenkins: no valid crumb

I've just installed Jenkins on a google cloud vm and configured nginx to point at 8080. I can enter the initial admin password and then i get to the screen where i can select plugins. When i click on "install suggested plugins" an error appears:
No valid crumb was included in this request
I started Jenkins with the command:
java -Dhudson.security.csrf.requestfield=Jenkins-Crumb -jar jenkins.war
stdout says:
INFO: Session node016ikde2z4paqem02o7wos0rgd1 already being invalidated
Nov 02, 2017 7:57:44 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: Found invalid crumb 27d19a27be31d1d5703128b635b60c3b. Will
check remaining parameters for a valid one...
Nov 02, 2017 7:57:44 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for
/pluginManager/installPlugins. Returning 403.
does anybody know how i can either disable CSRF or include a valid crumb in my request? I can generate a valid crumb by running:
$ curl -u "admin:ebdcf2fcf6f74ee8b4ec907a1486ml?xpath=concat(//crumbRequestField,":",//crumb)'
Jenkins-Crumb:ef6250c9afe294555e20f1b9ab875261
but i don't know what to do with it after that.
Many thanks!
To Disable CSRF (although this is not recommended), follow the below 3 steps:
Log in to Jenkins as an Administrator
GOTO: Jenkins > Manage Jenkins > Configure Global Security and enable Prevent
Cross Site Request Forgery exploits
Uncheck this option
Mention the version of the Jenkins you are using to suggest on how to provide a valid crumb in your request.

Keystone connection fail

I have install Keystone following the guide for Ubuntu14.04
When i try to create a service entity:
openstack service create --type identity \
--description "Openstack Identity" keystone
I obtain:
INFO: urllib3.connectionpool Starting new HTTP connection (1): controller
ERROR: cliff.app Internal Server Error (HTTP 500)
I am sure that i have connection to "controller",and mysql is configured to accept connections from any host.
My configuration file of keystone is:
[DEFAULT] admin_token =ADMIN
admin_port=35357
public_port=5000
[database]
connection = mysql://keystone:keystone#controller/keystone
[memcache]
servers = localhost:11211
[token]
provider = keystone.token.providers.uuid.Provider
driver =keystone.token.persistence.backends.memcache.Token
[revoke]
driver = keystone.contrib.revoke.backends.sql.Revoke
[DEFAULT]
verbose = True
And Apache is configured as shown in the guide.
Where am i failing?
I dont' know if you found and answer already but I also had this problem.
The reason was quite simple really, one of the instructions on the guide didn't work for me. This is the one:
# apt-get install ubuntu-cloud-keyring
# echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu" \
"trusty-updates/kilo main" > /etc/apt/sources.list.d/cloudarchive-kilo.list
So I was not using the kilo packages but older ones (urllib3 being one of them). How to fix this? Just create this file manually:
nano /etc/apt/sources.list.d/cloudarchive-kilo.list
And just write this inside:
deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo main
Finish it with this command, to make the update:
# apt-get update && apt-get dist-upgrade
You should have a lot of new updates now.
There you go, hope it helps, it fixed the problem for me at least.
Bruno

Resources