Postfix EHLO Banner - smtp

I have a peculiar problem with Postfix 3.1.0:
When a connecting client issues EHLO, the server responds with a line that contains its internal hostname, instead of the expected value of the smtpd_banner parameter.
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mxdomain.com ESMTP
EHLO a.aa
250-localhost.name.internal
250-PIPELINING
250-SIZE 41943040
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 8BITMIME
In the above example
the mxdomain.com ESMTP has been configured using smtpd_banner = mxdomain.com ESMTP in main.cf.
The localhost.name.internal text, I would like to have to be the same mxdomain.com text. The current value comes from $myhostname
How do I make the second banner contain mxdomain.com, or can it be removed somehow?

How do I make the second banner contain mxdomain.com, or can it be removed somehow?
Don't set smtpd_banner, set myhostname instead e.g.:
myhostnasme = mx.domain.com

Related

Connection with couchbase is getting hung

I am trying to connect with couchbase like given below
telnet 127.0.0.1 11210
I am getting connected also but when i am giving keyword "stats" it is getting hung there
root#vcb01-korakoram:~# telnet 127.0.0.1 11210
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
stats
^C
quit
^CConnection closed by foreign host.
for coming out I pressed 2-3 time "ctrl-C"
Tried to cnnect by using cbstats as given below:
root#vcb01-korakoram:~# /opt/couchbase/bin/cbstats 127.0.0.1:11210 all
Stats '' are not available from the requested engine. (Memcached error #36: EACCESS : Not authorized for command : {"error":{"context":"An exception occurred. command: [STAT]","ref":"d6582c0d-a06a-411b-bc29-bfa758359a37"}})
but here it is showing this issue
Please let me know what is the issue.

Haproxy agent-check

I am following the guides to setup haproxy for mysql load balancer, and to detect slave lag and change weight accordingly.
https://www.percona.com/blog/2014/12/18/making-haproxy-1-5-replication-lag-aware-in-mysql/#comment-10967915
I manage to setup the PHP file (run as service) and it listen well to the port defined (3307). Telnet to the port 3307 is a success and it return the correct seconds_behind_master value.
Now the Haproxy part:
After configuring Haproxy and reload, the Haproxy doesn't do any agent-check on the port 3307.
I shut down the slave to make the seconds_behind_master = NULL, check the haproxy web interface, nothing is changed. The slave server is still up and running.
Can anyone please point me to the right direction?
Tried using both haproxy 1.5.19 (upgrade from previous version) and 1.6.3 (fresh install)
Update:
Haproxy configuration
frontend read_only-front
bind *:3310
mode tcp
option tcplog
log global
default_backend read_only-back
backend read_only-back
mode tcp
balance leastconn
server db01 1.1.1.1:3306 weight 100 check agent-check agent-port 6789 inter 1000 rise 1 fall 1 on-marked-down shutdown-sessions
server db02 2.2.2.2:3306 weight 100 check agent-check agent-port 6789 inter 1000 rise 1 fall 1 on-marked-down shutdown-sessions
Mange to Telnet and "fputs" the weight in PHP script, when I Stop Slave of 1 of the mysql server.
telnet 127.0.0.1 6789
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
down
However, when checking the stats, it still shows 100 up. I even try other variable such as "up 1%", still unable to change the weight.
echo "show stat" | socat stdio /run/haproxy/admin.sock | cut -d ',' -f1,2,18,19
# pxname,svname,status,weight
read_only-front,FRONTEND,OPEN,
read_only-back,db-vu01,UP,100
read_only-back,db-vu02,UP,100
read_only-back,BACKEND,UP,200

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]

Can't receive email with msmtp using google account

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

mysql client port

I'm connecting to a remote MySQL server (on the default port 3306) using the C API call mysql_real_connect().
How can I discover which TCP port is used on the client host?
Is it possible to specify the port that I wish to use?
1
You can use lsof.
Type following in your shell:
$ lsof | grep TCP
And then look for the port on which your mysql server is listening.
You can also make use of netstat.
Details can be found by man netstat.
2
As far as I know, you can not.
the MYSQL structure has an FD buried in it (for me at least; tested on centos7 with mariadb 5.5.58).
you can use that to find the local address and port
struct sockaddr_in laddr;
socklen_t sb = sizeof(laddr);
if (getsockname(mysql.net.fd, (sockaddr*)&laddr, &sb) == -1)
printf("getsockname() failed, err %s\n",strerror(errno));
else
printf("local address [%x] port [%u]",ntohl(laddr.sin_addr.s_addr),ntohs(laddr.sin_port));