linux mail using wrong domain to send an email - linux

I am using linux "mail" client. When I try to send an email echo "test" | mail -s "testing" myemail#personal.com I receive a 550 error bounce back because the domain is invalid.
On the server there are 2 domains. One is public the other is strictly internal. How do I force only the mail client to use the public domain?
Here is the failure message.
Final-Recipient: RFC822; myemail#personal.com
Action: failed
Status: 5.1.8
Diagnostic-Code: SMTP; 550 5.1.8 Invalid domain: server_hostname.internal.domainname
Last-Attempt-Date: Wed, 12 Feb 2014 12:22:06 -0500

The fix ended up by modifying the submit.cf and sendmail.cf in /etc/mail/
# my official domain name
# ... define this only if sendmail cannot automatically determine your domain
Djdomain_name
You need to include the Dj which will be followed by the hostname.
Thank you for everyones help.

Related

msmtp cannot send mail via OVH SMTP to root address

I'm trying to get daemons to send email from a Debian 10 Server.
I'm using msmtp-mta with an OVH SMTP server. It's properly configured.
Everything works fine when sending email directly via the mail command, like so :
echo "test" | mail -s "test" email#domain.com
However, some daemons like smartd try to send email to root#localhost, but with a malformed recipient address root, which the OVH SMTP doesn't like at all :
send-mail: recipient address root not accepted by the server
send-mail: server message: 501 5.1.3 Invalid address
send-mail: could not send mail (account default from /etc/msmtprc)
Can't send mail: sendmail process failed with error code 65
and in the msmtp log :
Apr 25 00:39:49 host=ssl0.ovh.net tls=on auth=on user=***REDACTED*** from=***REDACTED*** recipients=root smtpstatus=501 smtpmsg='501 5.1.3 Invalid address' errormsg='recipient address root not accepted by the server' exitcode=EX_DATAERR
I tried adding root: email#domain.com to /etc/aliases adn relaoding with newaliases, and even put a .forward in root's homedir.
Has anyone experienced this before ? Shouldn't msmtp honor /etc/aliases and/or .forward and replace root's email address ?
Please check with msmtp -v if you have another alias that might override the one you're settings. You'll be able to check if it correctly register your aliases using that command.
You may also want to add aliases /etc/aliases to your /etc/msmtprc file.
You may also add a default alias in /etc/aliases if you would like all the mails to be send with a from corresponding: default: awesome.mail#example.tld

DKIM DNS Record found but emails indicate no signature found

When I scan my DNS Records my DKIM records are found, but when I send an email no DKIM signature is found. Below is the preliminary information I think is needed to help troubleshoot this issue. Any help would be appreciated.
Registrar \ Nameservers: Godaddy
Hosting: Digitalocean
OS: Ubuntu 14.04
DNS Records (DKIM test websites find the domainkey and indicate no errors):
TXT default._domainkey v=DKIM1; g=*; k=rsa; p=domainkeygoeshere 600 seconds
Mail:
echo "just a new test" | mail -s "email contents" to#destination.com -aFrom:from#mydomain.com
Reply:
DKIM Information:
DKIM Signature
This message does not contain a DKIM Signature
dkim=none header.d=mydomain.com; x-hmca=none header.id=from#mydomain.com
==========================================================
Summary of Results
==========================================================
SPF check: pass
DomainKeys check: neutral
DKIM check: permerror
SpamAssassin check: ham
"permerror"
The message could not be verified due to some error that
is unrecoverable, such as a required header field being
absent. A later attempt is unlikely to produce a final result.
DKIM Installation (Followed this tutorial):
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy
File: /etc/opendkim/TrustedHosts
127.0.0.1
localhost
192.168.0.1/24
mydomain.com
12.12.12.12
*.mydomain.com
#*.example.net
#*.example.org
File: /etc/opendkim/KeyTable
default._domainkey.mydomain.com mydomain.com:mail:/etc/opendkim/keys/mydomain.com/mail.private
#mail._domainkey.example.net example.net:mail:/etc/opendkim/keys/example.net/mail.private
#mail._domainkey.example.org example.org:mail:/etc/opendkim/keys/example.org/mail.private
File: /etc/opendkim/SigningTable
*#mydomain.com default._domainkey.mydomain.com
#*#example.net mail._domainkey.example.net
#*#example.org mail._domainkey.example.org
root#mydomain:/etc/opendkim/keys/mydomain.com# ls
mail.private mail.txt
Hard to debug with that information, but try to remove _domainkey from your configuration files.
My configuration:
DNS-Record:
TXT mail._domainkey v=DKIM1; h=sha256; k=rsa; p=*key* 600
/etc/opendkim.conf:
OversignHeaders From
Canonicalization relaxed/relaxed
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts
KeyTable refile:/etc/opendkim/KeyTable
LogWhy Yes
MinimumKeyBits 1024
Mode sv
PidFile /var/run/opendkim/opendkim.pid
SigningTable refile:/etc/opendkim/SigningTable
Socket inet:8891#localhost
Syslog Yes
SyslogSuccess Yes
TemporaryDirectory /var/tmp
UMask 022
UserID opendkim:opendkim
/etc/opendkim/KeyTable:
domain.tld domain.tld:mail:/etc/opendkim/mail
/etc/opendkim/SigningTable:
*#domain.tld domain.tld
/etc/opendkim/TrustedHosts:
127.0.0.1
/etc/postfix/main.cf:
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
Also check the owner and permissions of the /etc/opendkim/ dir with ls -la, or just set them again with:
chown -Rv opendkim:opendkim /etc/opendkim
chmod go-rwx /etc/opendkim/*
Did you restart postfix and opendkim after configuring them?
service opendkim restart
service postfix restart
I hope this helps somehow and you can find whats wrong.

Linux configuration -- ssmtp: Cannot open smtp.gmail.com:587

Hi I have RHEL5 with ssmtp installed on it ssmtp-2.61-22.el5.i386.rpm
my /etc/ssmtp/ssmtp.conf updated as below :-
AuthUser=mymail#gmail.com
AuthPass=mypassword
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
UseTLS=Yes
RewriteDomain=gmail.com
also revaliases updated as below :
root:mymail#gmail.com:smtp.gmail.com:587
i have shutdown sendmail service
when i try to send email with ssmtp i get below error
[root#ctmtest ssmtp]# echo "test" | ssmtp -vvv mymail#gmail.com
[<-] 220 smtp.gmail.com ESMTP v26sm42795996pfi.56 - gsmtp
[->] EHLO ctmtest
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
ssmtp: Cannot open smtp.gmail.com:587
i searched lots of tag with this error , but unable to fix this
my system is able to connect smtp.gmail.com on port 587
[root#ctmtest ssmtp]# telnet smtp.gmail.com 587
Trying 74.125.200.108...
Connected to smtp.gmail.com (74.125.200.108).
Escape character is '^]'.
220 smtp.gmail.com ESMTP o90sm11695907pfi.17 - gsmtp
is there anyone who have fixed this ? please suggest
I encountered the same problem. The following steps worked for me:
sudo vi /etc/ssmtp/ssmtp.conf
Add the following:
TLS_CA_FILE=/etc/pki/tls/certs/ca-bundle.crt
root=XXXX#gmail.com
mailhub=smtp.gmail.com:587
AuthUser=XXXX
AuthPass=XYXYX
UseSTARTTLS=Yes
UseTLS=Yes
hostname=AAAA
Replace:
XXXX- username(mail)
XYXYX- password(mail password)
AAAA- hostname(get by running $hostname)
sudo vi /etc/ssmtp/revaliases
Add the following:
root:XXXX#gmail.com:smtp.gmail.com:587
Replace :
XXXX - username(mail)
Try running the mail now:
$mail -s "adasdas" XXXX#gmail.com
CC:
XYZLoremIpsum
.
'ctrl+D'
It solved my problem.
Hopefully for a system(Office) you need to configure correct proxy settings otherwise you will get an error:
cannot send message: Process exited with a non-zero status
try changing this option
Allowing less secure apps to access your account
https://support.google.com/accounts/answer/6010255?hl=en
This is perhaps because you're not setting the hostname parameter of ssmtp.conf. It should be a resolvable, fully-qualified domain name; yours is defaulting to the machine name of ctmtest (as shown in the EHLO command that you quote above).
The issue that user963 mentions in their answer may also be in action here, but in that case you'll get a different error message, something like ssmtp: Authorization failed (534 5.7.14 ...).
This should be a comment on Haider Raza's answer, but I am short of 1 rep point to comment lol.
From https://superuser.com/questions/431539/special-characters-in-ssmtp-password
ssmtp has bugs parsing passwords containing '=', ':' or '#'. You can use the following workaround:
feed the password directly in the command line argument
ssmtp -ap "Hash#Password" ...
alternatively put the password in an environment variable.
ssmtp -ap $PASSWD ...
Hope it helped.
first to get your hostname type in terminal : hostname
copy it and past in hostname parameter in ssmtp.conf
On my Gentoo Linux system, the error ssmtp: Cannot open smtp.server.com:port was caused by an ownership/permissions issue: the file /etc/ssmtp/ssmtp.conf should belong to the group ssmtp, which it didn't (and any user allowed to access ssmtp should be a member of that group).
I ws looking for a solution for cacti smtp mail sender.
And found myself actually sending an email using the postfix service .
I also used localhost in the postfix config.
Thanks!
This is my config for outlook365.com that works on Centos 6.10 (Final) - replace all [square brackets] with your own settings:
/etc/ssmtp/ssmtp.conf
root=[admin_emailemail#domain.ext]
mailhub=smtp.office365.com:587
RewriteDomain=[domain.ext]
# to find out run hostname command in shell
Hostname=[hostname_or_domain]
AuthUser=[your_smtp_authentication_mailbox#domain.ext]
AuthPass=[your_password]
AuthMethod=LOGIN
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
# Use SSL/TLS certificate to authenticate against smtp host.
# When enabled it was failing to send emails
#UseTLSCert=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
/etc/ssmtp/revaliases
root:[your_sender_or_authentication_mailbox#domain.ext]:smtp.office365.com:587
Mail functions are all highly broken, so are the numerous tutorials on the internet.
This is pretty bad, for something that MUST be EASY for BEGINNERS.
A little panels of unclear errors you will face:
mailx: unrecognized option '-d'
💩
mailx: unrecognized option '-v'
💩
s-nail: Setting up PseudoRandomNumberGenerator: *SSL RAND_*
s-nail: New-style URL used without *v15-compat* being set
/home/you/dead.letter 3/106
s-nail: ... message not sent
💩
s-nail: Connecting to XX.XX.XX.XXX:465 ... connected.
s-nail: SMTP: Resource temporarily unavailable
💩
s-nail: Obsoletion warning: Use of old-style credentials, which will vanish in v15!
💩
s-nail: Obsoletion warning: please don't use *smtp*: assign a smtp:// URL to *mta*!
💩
s-nail: Unexpected EOF on SMTP connection
💩💩💩
No, there is no needs of any credentials to send a simple mail.
STEP 1: Install mail-utils
sudo apt install mailutils
STEP 2: Install mutt
sudo apt install mutt
STEP 3: Run the postfix setup
sudo dpkg-reconfigure postfix
Usage press TAB to select OK
Select "Internet site"
Enter your domain, or whatever
Leave all other settings as default. (Press RETURN till the end)
Mails will then be sent from this email: yourCurrentsession#whatever.com
STEP 4: Apply settings
service postfix reload
STEP 5: Send email
echo "Hello world" | mutt -s "Message sent at $(date)" recipient#gmail.com -y
STEP 6: Optional. Change sender email and name. Create a .muttrc file in the home folder.
echo -e "set from = \"aname#something.net\"\nset realname = \"Yay\"" > ~/.muttrc

Tuleap - SVN checkout issue : error 500

I'm using the docker image of tuleap in version 8.3.
I setup an AD in /etc/tuleap/plugins/ldap/etc/ldap.inc and enable it in /etc/tuleap/conf/local.inc with
$sys_auth_type = 'ldap';
I then created a subversion project and add my user with the Add user button in using the autocompletion ==> my user get recognized, it was never added to tuleap before, so I think the connection with the AD is working.
But when I do a
svn list --username myuser http://tuleap/svnroot/toto, I get :
Redirecting to URL 'https://tuleap/svnroot/toto':
Authentication realm: <https://tuleap:443> LDAP Subversion Authorization (toto)
Password for 'myuser':
svn: E175002: Unable to connect to a repository at URL 'https://tuleap/svnroot/toto'
svn: E175002: Server sent unexpected return value (500 Internal Server Error) in response to OPTIONS request for 'https://tuleap/svnroot/toto'
I can't find any error in /var/log/httpd/error_log
Any ideas ?
Please make sure that you have appropriate access to checkout the code from repo. If you have access and getting error 500 then please navigate to %appdata%\subversion\auth\svn.simple in Windows
In linux run this command -
rm -f~/.subersion/auth/svn.simple/*
Let us know if this helps you .

Cant connect to FTP with newly created account

I am trying to connect to a new user account I created via SSH with the command
useradd -s /bin/false -d /home/username james
I added/edited the password via SSH with the command
passwd james
When trying to connect to my server using this user and pass via FileZilla I get the following error messages.
Response: 331 User James OK. Password required
Command: PASS *****
Response: 530 Login authentication failed
Error: Critical error
Error: Could not connect to server
When I try to login with this user/pass through SFTP I get the following error messages
Status: Connected to domain.com
Error: Connection closed by server with exitcode 1
Error: Could not connect to server
Either way it seems it doesn't allow me to use this newuser anywhere.
My server details
Linux 2.6.18-308.11.1.el5 GNU/Linux
(Red Hat 4.1.2-52)
Centos
Regarding FTP, the FTP server commonly used on Linux systems requires users to have a shell that's listed in the file /etc/shells. For example, this online ftpd man page says that, among other things, "The user must have a standard shell returned by getusershell(3).". The page for getusershell() shows that it reads shells from /etc/shells.
You could probably make FTP work adding /bin/false to /etc/shells. Your Linux system might have a more suitable shell available, like /usr/sbin/nologin.
Regarding SFTP, the ssh server normally provides SFTP service by by invoking a program called sftp-server. If you examine the server's sshd_config file, you'll probably find a line like this:
Subsystem sftp /usr/lib/openssh/sftp-server
sshd runs the subsystem program as a shell command, using the user's shell. If you set the user's shell to /bin/false, then sshd ends up running the command:
/bin/false -c /usr/lib/openssh/sftp-server
/bin/false ignores its command-line arguments and exits with code 1, so the SFTP client's session drops immediately after it starts.
sshd has an internal SFTP server component that can be used instead of the external program. The usual way of limiting SSH access to SFTP for some users is to set up a Match group within sshd_config, forcing the internal-sftp command for certain classes of users. Here are a couple examples of that:
http://en.wikibooks.org/wiki/OpenSSH/Cookbook/SFTP#SFTP-only_Accounts
https://serverfault.com/questions/354615/allow-sftp-but-disallow-ssh
Dont use "-s /bin/false". Use "-s /sbin/nologin" instead and it should be fine.
Make sure your account password hasn't expired. Mine did, and Filezilla exited with error code 1.
After logging onto the server and updating the account password (prompted immediately after connecting), I am now able to connect with SFTP & Filezilla.
Probably is a password related issue, check account
chage -l <user>
account must not be expired.
FTP doesn't allow /usr/sbin/nologin user
Response: 220 Welcome to the Scent Library's File Service.
Command: USER ftpuser
Response: 331 Please specify the password.
Command: PASS ******
Response: 530 Login incorrect.
filezilla 530 error - but password is correct
vsftpd: 530 Login incorrect
530 Login or password incorrect!
How can I connect via FTP using FileZilla? I get a 530 error.
Response: 220 Welcome to Test FTP service.
Command: USER ftpuser
Response: 331 Please specify the password.
Command: PASS ******
Response: 530 Login incorrect.
Error: Critical error
Error: Could not connect to server
Change user's shell
usermod -s /usr/sbin/nologin username
Then edit "/etc/shells" file and add this line
/usr/sbin/nologin
In order to connect to the server using ftp, you also need to run a ftp server / service or daemon.
An example of such ftp server is "vsftpd"
After installing it, you will also need to configure it and allow anonymous ftp access or ftp access to existing users
You will find the configuration file in the path "/etc/vsftpd/vsftpd.conf"
The below link might be useful for you --
https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-on-centos-6--2

Resources