Can't receive email with msmtp using google account - configuration

I'm experiencing issue with msmtp on my backup server (OpenSUSE 12.2). I'm trying to send email everytime some of my backups fail. For this reason I would like to use msmtp. I have everything setted up. However, even though I see sent items in my "Sent" AND "Inbox" folder in Gmail, I never received single email on my desired Email account. Could anyone help me please? Scripts follow bellow. Please see that recipient is my gmail acc in log even though in text.txt is different.
.msmtprc
account default
host smtp.gmail.com
port 587
protocol smtp
from myemail#gmail.com
tls on
tls_starttls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
tls_certcheck off
tls_nocertcheck
auth on
user myemail#gmail.com
password Mypassword
logfile ~/.msmtp
.msmtp
Feb 25 09:44:28 host=smtp.gmail.com tls=on auth=on user=myemail#gmail.com
from=myemail#gmail.com recipients=myemail#gmail.com mailsize=130 smtpstatus=250
smtpmsg='250 2.0.0 OK 1393317868 g1sm73904348eet.6 - gsmtp' exitcode=EX_OK
text.txt
From: Daily backups <myemail#gmail.com>
To: Recipient's Name <hisemail#domain.com>
Subject: Backup report
Sample text
Command for send email
$ cat text.txt | msmtp -a default myemail#gmail.com
Big thank to all of those who will try to help me.
David

This works for me....
account default
host smtp.gmail.com
port 587
logfile /tmp/msmtp.log
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth login
user myemail#gmail.com
password MyPassWord1
from First LastName
account account2
And then from raspberry Pi command line
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=default -t destinationaddress#gmail.com

Related

login openshift with kubadmin fail: Login failed (401 Unauthorized)

As per offical documentation by Openshift , we can get kubadmin password as below:
crc console --credentials
To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p gALwE-jY6p9-poc9U-gRcdu https://api.crc.testing:6443'
However , I can login successfully with developer/developer .kubeadmin will fail with "Login failed (401 Unauthorized)" . Restart CRC muiltiple times . Still not works ... Any idea about this ?
$ oc login -u developer -p developer https://api.crc.testing:6443
Login successful.
You have one project on this server: "demo"
Using project "demo"
$ oc login -u kubeadmin -p gALwE-jY6p9-poc9U-gRcdu https://api.crc.testing:6443
Login failed (401 Unauthorized)
Verify you have provided correct credentials.
Any inputs will be appreciated . Thanks in advance..
You said you restarted CRC. Have you tried deleting and recreating the cluster?
One of the first steps in productionizing a cluster is to remove the kubeadmin account - is it possible that you've done that and the "crc console --credentials" is now only displaying what it used to be?
If you have another admin account try:
$ oc get -n kube-system secret kubeadmin
The step to remove that account (see: https://docs.openshift.com/container-platform/4.9/authentication/remove-kubeadmin.html) is to simply delete that secret. If you've done that at some point in this cluster's history you'll either need to use your other admin accounts in place of kubeadmin, or recreate the CRC instance (crc stop; crc delete; crc setup)
Just in case others are having this issue and the issue persists even after trying crc stop, crc delete, crc cleanup, crc setup, crc start, I was able to sign in as kubeadmin by NOT using the following command after crc start got my CodeReady Container up and running.
eval $(crc oc-env)
Instead, I issue the crc oc-env command. In this example that the output returns /home/john.doe/.crc/bin/oc.
~]$ crc oc-env
export PATH="/home/john.doe/.crc/bin/oc:$PATH"
# Run this command to configure your shell:
# eval $(crc oc-env)
I then list the contents of the /home/john.doe/.crc/bin/oc directory which shows that the /home/john.doe/.crc/bin/oc directory is symbolically linked to the /home/john.doe/.crc/cache/crc_libvirt__amd64/oc file.
~]$ ll /home/john.doe/.crc/bin/oc
lrwxrwxrwx. 1 john.doe john.doe 61 Jun 8 20:27 oc -> /home/john.doe/.crc/cache/crc_libvirt_4.10.12_amd64/oc
And I was then able to sign in using the absolute path to the oc command line tool.
~]$ /home/john.doe/.crc/cache/crc_libvirt_4.10.12_amd64/oc login -u kubeadmin -p 28Fwr-Znmfb-V6ySF-zUu29 https://api.crc.testing:6443
Login successful.
I'm sure I could dig a bit more into this, checking the contents of my users $PATH, but suffice to say, this at least is a work around for me that gets me to be able to sign in as kubeadmin.

Error when using sendEmail

I'm trying to learn how to use sendEmail to send automated emails. This is the command I entered in Windows command prompt:
sendEmail -f myemail#gmail.com -t youremail#gmail.com -m This is a test message. -s smtp.gmail.com:465 -xu myemail#gmail.com -xp mypassword
However, I get the following error:
ERROR => Connection attempt to smtp.gmail.com:465 failed: IO::SOCKET::INET: Bad hostname 'smtp.gmail.com'
After researching this problem online, I ran telnet on smtp.gmail.com, and found that I could not open a connection. I think this is the problem, though I am still unsure what is causing it. What can I do to fix this?
Update /etc/hosts, add a ip address to smtp.gmail.com:
74.125.203.109 smtp.gmail.com
Update /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
IO::SOCKET::INET: IPV6 - Error may also cause such this kind of issues. [check it by typing ifconfig/ipconfig].
If there are multiple IPV6 addresses, then disconnect your network and reconnect it. [eth0 ifdown & eth0 ifup]

how exim show password on log files

I want to debug all auth session.
For example on /var/log/exim/mainlog display auth error like this;
login authenticator failed for (xx) [x.x.x.x]: 535 Incorrect
authentication data (set_id=xxx)
login authenticator failed for (xx) [x.x.x.x]: 535 Incorrect
authentication data (set_id=xxx)
login authenticator failed for (xx) [x.x.x.x]: 535 Incorrect
authentication data (set_id=xxx)
but i want to display password too like this;
login authenticator failed for (xx) [x.x.x.x]: 535 Incorrect
authentication data (set_id=xxx,set_pwd=yyy) login authenticator
failed for (xx) [x.x.x.x]: 535 Incorrect authentication data
(set_id=xxx,set_pwd=yyy) login authenticator failed for (xx)
[x.x.x.x]: 535 Incorrect authentication data (set_id=xxx,set_pwd=yyy)
I changed dovecot conf and added;
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
but /var/log/exim/mainlog still doesn't display password and /var/log/maillog doesn't give any information about smtp.
So, how can i catch auth error with cleared text password.
Configuration options for Exim should be edited in exim.conf, as the dovecot.conf only affects how dovecot works. They are two separate programs.
As far as I know, there is no way to directly configure Exim to log the password in cleartext in the logfile. What you can do is add lines like the following
server_debug_print = "running smtp auth $1 $2"
under the correct authenticator in your exim.conf (or all of them) and then run exim -d which enables the debugging mode (but also makes exim run in the foreground with all debug output going to stdout).
I just found a solution.
I changed dovecot.conf passdb options like;
passdb {
driver = checkpassword
args = /etc/dovecot/chk.sh
}
and write a bash script for write args on bash.log file.
like
#!/bin/bash
echo "$1 username and $2 password" > /etc/dovecot/log.txt

How to change samba and ubuntu password remotely?

So I have this file server for this school. Basically, every student uses one public login for windows and ubuntu alike. They use a custom app to login to the Samba Ubuntu Server using their own password to get to their personal directory. Once and a while they will need to change their password for this login. I need a way to change someones password that is thorough enough so that a bash script could do it, both for samba smbpasswd and ubuntu's passwd. So to sum this up, I need to know what command could be used to change someones password with no-user intervention using a bash script. Because when you type passwd username, then it asks you to type the password, I want a bash script to do this for me, so that when users want to change their password, I just need to edit that bash script. Im looking for something like "passwd user --current-password=CURRENTPASS --new-password=NEWPASS" and it would return ON THAT LINE. I also need it to work for smbpasswd so samba can change its password too.
EDIT
Found it! Wow this is great, which I knew this earlier. Using the following command works:
echo -e "newpass\nnewpass" | (smbpasswd -s username)
echo -e "newpass\nnewpass" | (passwd --stdin username)
Of course you would need to add the old password too if you were not running root. I love solving my own problems!
The solution, although posting this late, may not be secure, but was this:
echo -e "newpass\nnewpass" | (smbpasswd -s username)
echo -e "newpass\nnewpass" | (passwd --stdin username)

using mysql-proxy to manipulate login information

Is it possible to intercept and change login information within a lua script for mysql-proxy.
for example, if a user were to hit the proxy like this:
mysql -h localhost -P 4040 -u bob -D orders -p
i would want the connection not only redirected to a backend server, but also the username/database name changed, so that the above command was the equivalent of this:
mysql -h production.server -P 3306 -u bob_production -D bob_orders -p
I notice that it seems that I can only get auth information in the script after the auth has been passed, and even if I could get it before, i don't see a way to easily inject it.
Does anyone have an idea on how this would be possible within mysql-proxy, or with some other solution?
It is possible. In the share/docs directory of the installation bundle have a look at the tutorial script tutorial-scramble.lua which is an example that validates a hashed password from a remote client and substitutes the authentication credentials required by the server.
The function used in the tutorial example is: read_auth()
You might also want to monitor the authentication response from the server which can be done with read_auth_result().