Sunday, August 6, 2017

ubuntu - Kernel attempts to kill MySQL with sigkill

I'm running an Ubuntu server for MySQL.



Server info




  • Ubuntu 12.10

  • MySQL installed via apt


  • RAM: 512M

  • innodb_buffer_pool_size : 300M

  • There is no other memory intensive application running on this box.



Problem



Every morning, at approx. 6:40am something happens to cause a noticeable change in memory:



https://dl.dropbox.com/u/12520837/mem.s.png




At the same time, a systematic "kill" of running processes seems to occur, causing MySQL to restart.




Apr 10 06:43:40 mysql-01 kernel: [1866472.511966] select 1 (init), adj 0, size 41, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.511973] select 385 (dbus-daemon), adj 0, size 44, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.511975] select 389 (rsyslogd), adj 0, size 124, to kill




Apr 10 06:43:40 mysql-01 kernel: [1866472.511982] select 4578 (snmpd), adj 0, size 160, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.514157] select 1 (init), adj 0, size 41, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.514164] select 385 (dbus-daemon), adj 0, size
44, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.514166] select 389 (rsyslogd), adj 0, size 124, to kill



Apr 10 06:43:40 mysql-01 kernel: [1866472.514171] select 4578 (snmpd), adj 0, size 160, to kill




Apr 10 06:43:44 mysql-01 /etc/mysql/debian-start[21807]: Upgrading MySQL tables if necessary.



Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21810]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored



Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21810]: Looking for 'mysql' as: /usr/bin/mysql



Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21810]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck



Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21810]: This installation of MySQL is already upgraded to 5.5.29, use --force if you still need to run mysql_upgrade




Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21821]: Checking for insecure root accounts.
Apr 10 06:43:45 mysql-01 /etc/mysql/debian-start[21826]: Triggering myisam-recover for all MyISAM tables




Any help diagnosing this would be much appreciated!

Saturday, August 5, 2017

linux - Messages deferred (time out while sending message body)



I have a Linux CENTOS Server running PostFix. It has no mailboxes, but is a mail gateway, for several Domains in another destination Server, which is also a Linux CENTOS running Sendmail. So, after checking the emails with antivirus and antispam, the Postfix Server delivers them to the Sendmail Server which hosts the real mailboxes.




Many of our customers are claiming they don't receive several emails, or receive them with many hours delay, so we monitored the /var/log/maillog file at the Postfix Server, and found out that those emails are not being delivered to the Sendmail Server and are deferred with messages like:




Aug 23 11:48:58 srv7 postfix/smtp[618]: 980C773D64B: to=, relay=srv6.multisitesdominios.com.br[200.184.161.136], delay=2375, status=deferred (conversation with srv6.multisitesdominios.com.br[200.184.161.136] timed out while sending message body)




Most of these emails have attachments, so probably they are a little large. We realized that small emails pass and are received normally.



My questions:





  1. What is the real reason of this problem, is it really the emails size?

  2. Is there any Postfix parameter we should tune to avoid it?

  3. Would the problem be at the destination Server (the Sendmail one) and not at this "gateway" Server (the Postfix one)?

  4. What would be the definite solution?


Answer




  1. It's indirectly the size. It takes too long without receiving progress on the data so that either side hangs up


  2. smtp_data_xfer_timeout. It defaults to 180 seconds which should be OK in every scenario.

  3. It can be on both. But probably it is the network in between.

  4. Check why the communication stalls.


apache 2.2 - Apache2 ssl + virtualhosts of the same domain



My webserver hosts several subdomains (vhosts) of a website, say sub1.example.com and sub2.example.com. The only difference between these vhosts is the documentroot. Everything else is shared across vhosts.



Now I would like to do the same for HTTPS, but of course ssl + virtualhost is tricky. The good thing is that my SSL certificate is valid for my complete domain. Hence I don't need to specify per-vhosts certificate. The only thing that I want to specify per vhost is the document root.



The FAQ says:





Name-Based Virtual Hosting is a very popular method of identifying
different virtual hosts. It allows you to use the same IP address and
the same port number for many different sites. When people move on to
SSL, it seems natural to assume that the same method can be used to
have lots of different SSL virtual hosts on the same server.



It is possible, but only if using a 2.2.12 or later web server, built
with 0.9.8j or later OpenSSL. This is because it requires a feature
that only the most recent revisions of the SSL specification added,

called Server Name Indication (SNI).




I am using Ubuntu 11.10 which ships with Apache 2.2.20 and openssl 1.0.0e so I think I should be good. However, I can't get it to work. I already have default and default-ssl sites enabled. If I add a virtualhost like I would do for HTTP:




ServerName sub1.example.com
DocumentRoot /var/www/sub1




And then try to restart Apache, I get:




[Thu Mar 01 23:55:15 2012] [warn] default VirtualHost overlap on
port 443, the first has precedence Action 'start' failed.



Answer



What you probably need is three things:





  1. A NameVirtualHost *:80 directive. If you want to follow the Ubuntu conventions, put this in ports.conf.

  2. Fix the host specification on the default SSL vhost. It's set to in the default config; it needs to match the listener specification of your other vhost and your NameVirtualHost directive.

  3. You also need to specify the SSL-related settings in your new vhost. SSLEngine On and your certificate settings are needed.



..and if this isn't the case, then please provide your existing config and the output of apache2ctl -S.


apache 2.2 - Interpreting Netstat output

I have a LAMP stack running Fedora 12 and I am run the following instruction through the command line on the server:
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n



As far as I understand this should show me the IPs of the connected processes and how many connections per IP there are, correct?



I would need some help in interpreting the results. Out of 250 total connections, 140 don't show any IP (just a blank), 80 are from my slave DB, 20 are from IP 0.0.0.0 and only 10 are from what appears to be normal connections to the server.



My questions are thus:
1. What do the 140 blank IPs represent?

2. Why does my slave DB (MySQL) need 80 connections? Can this number be reduced? If so how?
3. What are 20 0.0.0.0 connections?



I apologise if this is a trivial question, but I am a relative newbie at this.



Adding part of the netstat -anp (just removed my servers IPs and had to trim because of post length limit):




Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nams

tcp 0 0 0.0.0.0:2234 0.0.0.0:* LISTEN 1616/sshd
tcp 0 0 my-server-ip:443 201.23.177.150:18846 SYN_RECV -
tcp 0 0 my-server-ip:443 182.156.150.187:41594 SYN_RECV -
tcp 0 0 my-server-ip:443 151.61.126.161:50591 SYN_RECV -
tcp 0 0 my-server-ip:443 119.30.38.84:51449 SYN_RECV -
tcp 0 0 my-server-ip:443 190.121.239.151:38961 SYN_RECV -
tcp 0 0 my-server-ip:443 201.23.160.144:54884 SYN_RECV -
tcp 0 0 my-server-ip:443 151.61.126.161:50592 SYN_RECV -
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 1625/dovecot
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 1625/dovecot

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2393/mysqld
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 1625/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 1625/dovecot
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1302/rpcbind
tcp 0 0 my-server-ip:80 201.23.177.72:17927 SYN_RECV -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1436/cupsd
tcp 0 0 0.0.0.0:44183 0.0.0.0:* LISTEN 1356/rpc.statd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1718/master
tcp 0 0 my-server-ip:46961 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46978 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47147 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47264 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47250 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47243 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47273 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47267 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46955 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 70 my-server-ip:47282 my-slave-db-ip:3306 ESTABLISHED 25697/httpd
tcp 0 0 my-server-ip:47034 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:41433 my-slave-db-ip:3306 ESTABLISHED 24983/httpd

tcp 0 0 my-server-ip:46986 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47247 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 52 my-server-ip:2234 177.42.224.14:57947 ESTABLISHED 25774/0
tcp 0 0 my-server-ip:46969 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 70 my-server-ip:41504 my-slave-db-ip:3306 ESTABLISHED 24982/httpd
tcp 0 0 my-server-ip:47271 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46970 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 69 my-server-ip:47275 my-slave-db-ip:3306 ESTABLISHED 25836/httpd
tcp 0 0 my-server-ip:46953 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47080 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47094 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47019 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46956 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46963 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 70 my-server-ip:46930 my-slave-db-ip:3306 ESTABLISHED 24976/httpd
tcp 0 0 my-server-ip:46906 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47272 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 70 my-server-ip:46888 my-slave-db-ip:3306 ESTABLISHED 25709/httpd
tcp 0 0 my-server-ip:2234 177.42.224.14:64099 ESTABLISHED 25866/sshd: root@no
tcp 0 0 my-server-ip:47112 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47221 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 240 my-server-ip:47276 my-slave-db-ip:3306 ESTABLISHED 25374/httpd
tcp 0 0 my-server-ip:47109 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 240 my-server-ip:47278 my-slave-db-ip:3306 ESTABLISHED 25711/httpd
tcp 0 0 my-server-ip:41195 my-slave-db-ip:3306 ESTABLISHED 24966/httpd
tcp 0 0 my-server-ip:46975 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47027 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 86 my-server-ip:47281 my-slave-db-ip:3306 ESTABLISHED 25599/httpd
tcp 0 70 my-server-ip:46993 my-slave-db-ip:3306 ESTABLISHED 25841/httpd
tcp 0 0 my-server-ip:47119 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47165 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47032 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47054 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 1 my-server-ip:47322 94.100.187.197:25 SYN_SENT 25909/smtp
tcp 0 0 my-server-ip:47185 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 70 my-server-ip:46893 my-slave-db-ip:3306 ESTABLISHED 25712/httpd
tcp 0 0 my-server-ip:41273 my-slave-db-ip:3306 ESTABLISHED 24974/httpd
tcp 0 0 my-server-ip:47076 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47214 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47241 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47176 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47012 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:3306 my-slave-db-ip:57117 ESTABLISHED 2393/mysqld
tcp 0 0 my-server-ip:143 177.42.224.14:62179 ESTABLISHED 23981/imap-login
tcp 0 0 my-server-ip:47060 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 240 my-server-ip:47280 my-slave-db-ip:3306 ESTABLISHED 25602/httpd
tcp 0 0 my-server-ip:46967 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47003 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46972 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:46946 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 0 my-server-ip:47202 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47017 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 644 my-server-ip:46811 my-slave-db-ip:3306 ESTABLISHED 25604/httpd
tcp 0 0 my-server-ip:47030 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47253 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47044 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47274 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 my-server-ip:47096 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 240 my-server-ip:47277 my-slave-db-ip:3306 ESTABLISHED 25842/httpd
tcp 0 0 my-server-ip:47269 my-slave-db-ip:3306 TIME_WAIT -

tcp 0 240 my-server-ip:47279 my-slave-db-ip:3306 ESTABLISHED 25506/httpd
tcp 0 490 my-server-ip:46673 my-slave-db-ip:3306 ESTABLISHED 25665/httpd
tcp 0 0 my-server-ip:47045 my-slave-db-ip:3306 TIME_WAIT -
tcp 0 0 :::2234 :::* LISTEN 1616/sshd
tcp 0 0 :::443 :::* LISTEN 24956/httpd
tcp 0 0 :::111 :::* LISTEN 1302/rpcbind
tcp 0 0 :::80 :::* LISTEN 24956/httpd
tcp 0 0 ::1:631 :::* LISTEN 1436/cupsd
tcp 0 0 :::25 :::* LISTEN 1718/master
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:88.154.220.155:33982 ESTABLISHED 25842/httpd

tcp 0 47 ::ffff:my-server-ip:443 ::ffff:186.122.246.21:52748 ESTABLISHED 25837/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:55078 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55984 ESTABLISHED 25608/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:41350 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:90.210.173.3:51483 ESTABLISHED 25697/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55965 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.144.158.19:40385 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:47388 TIME_WAIT -
tcp 0 6230 ::ffff:my-server-ip:443 ::ffff:106.197.152.19:48216 FIN_WAIT1 -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:36967 CLOSE_WAIT 24974/httpd

tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55968 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:93.146.164.167:50292 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:206.53.54.187:38688 ESTABLISHED 25374/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:81.136.129.137:52966 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55966 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:220.255.1.131:8102 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:41.222.192.226:64538 ESTABLISHED 25832/httpd
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:60849 CLOSE_WAIT 24966/httpd
tcp 0 513 ::ffff:my-server-ip:443 ::ffff:187.80.54.17:41707 FIN_WAIT1 -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:57877 CLOSE_WAIT 24983/httpd

tcp 0 0 ::ffff:my-server-ip:443 ::ffff:180.178.25.61:5453 ESTABLISHED 25506/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.144.158.195:4773 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:79.26.90.157:24409 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:197.200.85.248:13747 ESTABLISHED 25599/httpd
tcp 0 6230 ::ffff:my-server-ip:443 ::ffff:41.53.45.194:33870 FIN_WAIT1 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55960 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:2.158.95.179:60733 ESTABLISHED 24976/httpd
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:213.30.118.99:55288 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.144.158.195:4769 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:187.80.191.105:45382 FIN_WAIT2 -

tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55967 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:83.35.243.61:53344 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:40979 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:200.81.44.250:31556 TIME_WAIT -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:57631 CLOSE_WAIT 24982/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55980 ESTABLISHED 25605/httpd
tcp 0 11201 ::ffff:my-server-ip:443 ::ffff:93.65.181.47:53717 FIN_WAIT1 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:188.80.5.246:53477 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:41.190.8.31:12272 ESTABLISHED 25217/httpd
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:39440 CLOSE_WAIT 25712/httpd

tcp 0 0 ::ffff:my-server-ip:80 ::ffff:178.96.198.45:43412 TIME_WAIT -
tcp 0 6230 ::ffff:my-server-ip:443 ::ffff:41.17.156.241:36223 FIN_WAIT1 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55983 ESTABLISHED 25713/httpd
tcp 0 213 ::ffff:my-server-ip:443 ::ffff:187.119.160.67:59660 FIN_WAIT1 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55964 TIME_WAIT -
tcp 1 455 ::ffff:my-server-ip:80 ::ffff:187.141.84.94:56325 CLOSING -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:197.252.77.141:5340 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:201.52.83.193:50966 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:151.26.113.212:26581 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:56702 TIME_WAIT -

tcp 0 6230 ::ffff:my-server-ip:443 ::ffff:95.66.57.147:60665 FIN_WAIT1 -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:46.222.107.130:55683 TIME_WAIT -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:201.23.160.151:29801 CLOSE_WAIT 25709/httpd
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:85.77.28.94:47593 ESTABLISHED 25841/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:151.60.30.6:48331 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:117.229.95.166:48579 ESTABLISHED 25711/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.61.76:37227 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:43040 TIME_WAIT -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:80.7.104.8:56232 CLOSE_WAIT 25604/httpd
tcp 0 6230 ::ffff:my-server-ip:443 ::ffff:41.190.3.232:17447 FIN_WAIT1 -

tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55985 ESTABLISHED 24991/httpd
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:186.182.113.12:59188 TIME_WAIT -
tcp 1 0 ::ffff:my-server-ip:80 ::ffff:201.23.160.151:28767 CLOSE_WAIT 25665/httpd
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:178.240.115.10:53294 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:85.62.234.254:45417 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:2.232.62.163:43565 FIN_WAIT2 -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:117.230.223.85:48221 ESTABLISHED 25602/httpd
tcp 0 1 ::ffff:my-server-ip:80 ::ffff:189.60.238.52:42449 FIN_WAIT1 -
tcp 0 28 ::ffff:my-server-ip:443 ::ffff:101.2.90.246:50399 CLOSING -
tcp 0 513 ::ffff:my-server-ip:443 ::ffff:49.201.248.245:60295 FIN_WAIT1 -

tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.4.135.249:65105 ESTABLISHED 25836/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:201.191.198.96:32171 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55982 ESTABLISHED 25843/httpd
tcp 0 1 ::ffff:my-server-ip:80 ::ffff:189.131.12.46:55981 FIN_WAIT1 25546/httpd
tcp 0 3533 ::ffff:my-server-ip:443 ::ffff:189.116.225.43:52473 ESTABLISHED 25727/httpd
tcp 0 0 ::ffff:my-server-ip:80 ::ffff:83.178.136.202:40922 TIME_WAIT -
tcp 0 0 ::ffff:my-server-ip:443 ::ffff:41.206.15.18:9701 TIME_WAIT -
udp 0 0 0.0.0.0:39616 0.0.0.0:* 1356/rpc.statd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1384/dhclient
udp 0 0 0.0.0.0:5353 0.0.0.0:* 1336/avahi-daemon:

udp 0 0 0.0.0.0:111 0.0.0.0:* 1302/rpcbind
udp 0 0 0.0.0.0:60021 0.0.0.0:* 1336/avahi-daemon:
udp 0 0 0.0.0.0:629 0.0.0.0:* 1302/rpcbind
udp 0 0 0.0.0.0:631 0.0.0.0:* 1436/cupsd
udp 0 0 0.0.0.0:684 0.0.0.0:* 1356/rpc.statd
udp 0 0 :::111 :::* 1302/rpcbind
udp 0 0 :::629 :::* 1302/rpcbind
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 10999 1436/cupsd /var/run/cups/cups.sock

unix 2 [ ACC ] STREAM LISTENING 11536 1625/dovecot /var/run/dovecot/dict-server
unix 2 [ ACC ] STREAM LISTENING 11538 1625/dovecot /var/run/dovecot/login/default
unix 2 [ ACC ] STREAM LISTENING 11543 1625/dovecot /var/run/dovecot/auth-worker.1626
unix 2 [ ACC ] STREAM LISTENING 11892 1718/master public/cleanup
unix 2 [ ACC ] STREAM LISTENING 11924 1718/master public/flush
unix 2 [ ACC ] STREAM LISTENING 11944 1718/master public/showq
unix 2 [ ACC ] STREAM LISTENING 11567 1626/dovecot-auth /var/run/dovecot/auth-master
unix 2 [ ACC ] STREAM LISTENING 10206 1316/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ] DGRAM 7400 1/init @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 19051 2393/mysqld /var/lib/mysql/mysql.sock

unix 23 [ ] DGRAM 10066 1256/rsyslogd /dev/log
unix 2 [ ] DGRAM 7555 551/udevd @/org/kernel/udev/udevd
unix 2 [ ] DGRAM 11146 1469/hald @/org/freedesktop/hal/udev_event
unix 2 [ ACC ] STREAM LISTENING 11899 1718/master private/tlsmgr
unix 2 [ ACC ] STREAM LISTENING 11903 1718/master private/rewrite
unix 2 [ ACC ] STREAM LISTENING 11908 1718/master private/bounce
unix 2 [ ACC ] STREAM LISTENING 11912 1718/master private/defer
unix 2 [ ACC ] STREAM LISTENING 11916 1718/master private/trace
unix 2 [ ACC ] STREAM LISTENING 11920 1718/master private/verify
unix 2 [ ACC ] STREAM LISTENING 11928 1718/master private/proxymap

unix 2 [ ACC ] STREAM LISTENING 11932 1718/master private/proxywrite
unix 2 [ ACC ] STREAM LISTENING 11936 1718/master private/smtp
unix 2 [ ACC ] STREAM LISTENING 11940 1718/master private/relay
unix 2 [ ACC ] STREAM LISTENING 11948 1718/master private/error
unix 2 [ ACC ] STREAM LISTENING 11952 1718/master private/retry
unix 2 [ ACC ] STREAM LISTENING 11956 1718/master private/discard
unix 2 [ ACC ] STREAM LISTENING 11960 1718/master private/local
unix 2 [ ACC ] STREAM LISTENING 11964 1718/master private/virtual
unix 2 [ ACC ] STREAM LISTENING 11968 1718/master private/lmtp
unix 2 [ ACC ] STREAM LISTENING 11972 1718/master private/anvil

unix 2 [ ACC ] STREAM LISTENING 11976 1718/master private/scache
unix 2 [ ACC ] STREAM LISTENING 11082 1469/hald @/var/run/hald/dbus-zZ2k930EI0
unix 2 [ ACC ] STREAM LISTENING 11561 1626/dovecot-auth /var/spool/postfix/private/auth
unix 2 [ ACC ] STREAM LISTENING 11124 1469/hald @/var/run/hald/dbus-3PhM3NhFOT
unix 2 [ ACC ] STREAM LISTENING 10147 1302/rpcbind /var/run/rpcbind.sock
unix 2 [ ACC ] STREAM LISTENING 10285 1336/avahi-daemon: /var/run/avahi-daemon/socket
unix 2 [ ACC ] STREAM LISTENING 11594 1635/saslauthd /var/run/saslauthd/mux
unix 2 [ ACC ] STREAM LISTENING 12223 1762/abrtd /var/run/abrt/abrt.socket
unix 2 [ ACC ] STREAM LISTENING 11055 1461/acpid /var/run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 11440 1595/pcscd /var/run/pcscd.comm

unix 2 [ ] DGRAM 561886 25911/bounce
unix 3 [ ] STREAM CONNECTED 561870 1978/tlsmgr private/tlsmgr
unix 3 [ ] STREAM CONNECTED 561869 25910/smtp
unix 2 [ ] DGRAM 561861 25910/smtp
unix 3 [ ] STREAM CONNECTED 561856 1978/tlsmgr private/tlsmgr
unix 3 [ ] STREAM CONNECTED 561855 25909/smtp
unix 2 [ ] DGRAM 561847 25909/smtp
unix 3 [ ] STREAM CONNECTED 561857 25909/smtp private/smtp
unix 3 [ ] STREAM CONNECTED 561845 2111/qmgr
unix 3 [ ] STREAM CONNECTED 561844 2393/mysqld /var/lib/mysql/mysql.sock

unix 3 [ ] STREAM CONNECTED 561843 25906/proxymap
unix 3 [ ] STREAM CONNECTED 561842 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561841 25906/proxymap
unix 2 [ ] DGRAM 561829 25906/proxymap
unix 3 [ ] STREAM CONNECTED 561837 25906/proxymap private/proxymap
unix 3 [ ] STREAM CONNECTED 561828 25905/trivial-rewri
unix 2 [ ] DGRAM 561820 25905/trivial-rewri
unix 3 [ ] STREAM CONNECTED 561838 25905/trivial-rewri private/rewrite
unix 3 [ ] STREAM CONNECTED 561819 2111/qmgr
unix 3 [ ] STREAM CONNECTED 561804 2393/mysqld /var/lib/mysql/mysql.sock

unix 3 [ ] STREAM CONNECTED 561803 25697/httpd
unix 3 [ ] STREAM CONNECTED 561802 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561801 25697/httpd
unix 3 [ ] STREAM CONNECTED 561798 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561797 25599/httpd
unix 3 [ ] STREAM CONNECTED 561796 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561795 25599/httpd
unix 3 [ ] STREAM CONNECTED 561792 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561791 25602/httpd
unix 3 [ ] STREAM CONNECTED 561790 2393/mysqld /var/lib/mysql/mysql.sock

unix 3 [ ] STREAM CONNECTED 561789 25602/httpd
unix 3 [ ] STREAM CONNECTED 561787 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561786 25506/httpd
unix 3 [ ] STREAM CONNECTED 561785 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561784 25506/httpd
unix 3 [ ] STREAM CONNECTED 561782 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561781 25711/httpd
unix 3 [ ] STREAM CONNECTED 561780 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561779 25711/httpd
unix 3 [ ] STREAM CONNECTED 561777 2393/mysqld /var/lib/mysql/mysql.sock

unix 3 [ ] STREAM CONNECTED 561776 25842/httpd
unix 3 [ ] STREAM CONNECTED 561775 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561774 25842/httpd
unix 3 [ ] STREAM CONNECTED 561772 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561771 25374/httpd
unix 3 [ ] STREAM CONNECTED 561770 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561769 25374/httpd
unix 3 [ ] STREAM CONNECTED 561760 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 561759 25836/httpd
unix 3 [ ] STREAM CONNECTED 561758 2393/mysqld /var/lib/mysql/mysql.sock

unix 3 [ ] STREAM CONNECTED 561757 25836/httpd
unix 3 [ ] STREAM CONNECTED 560678 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 560677 25841/httpd
unix 3 [ ] STREAM CONNECTED 560676 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 560675 25841/httpd
unix 3 [ ] STREAM CONNECTED 560401 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 560400 24976/httpd
unix 3 [ ] STREAM CONNECTED 560399 2393/mysqld /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 560398 24976/httpd
unix 3 [ ] STREAM CONNECTED 560346 1626/dovecot-auth /var/run/dovecot/login/default

email - Yahoo Domain Keys setup, getting dkim=permerror (no key)



I'm working on getting DKIM installed on my outgoing mail server, to help my email deliverability to my Yahoo clients (all legit emails, etc, no spamming).



I've got DKIM-Signature: and DomainKey-Signature: headers being generated, but a test mailer to my Yahoo account had this line in the headers:



Authentication-Results: mta250.mail.re2.yahoo.com from=example.com;

domainkeys=permerror (no key); from=example.com; dkim=permerror (no
key)



Any ideas what I may have missed?


Answer



You do not have the proper dns records set up.



You can test it youself with policy checker and selector checker.
Here is a good tutorial for setting the right records.
and also and online form for doing the same.

It seems that you have SPF records. You should definitely remove them!
Here is a case against spf.


networking - DNS resolution failing over to secondary DNS - why?




We have large number of branch offices connected via VPN, but without any kind of server infrastructure. The client machines in each office get their network configuration from an ASA 5505, which is also used for the VPN connection.



The Windows XP client machines are configured to use one of our corporate DNS servers as the primary, with the DNS server of the ISP as the secondary. The idea is that if the VPN connection fails for any reason, staff in the office will still be able to access the internet, and access our webmail and home access portal. In the majority of cases this works fine.



However, for offices based in South America we are seeing DNS resolution on the client machines regularly being done against the ISP DNS server - this results in our corporate resources being effectively unavailable to staff in the offices.



The client machines are able to ping the corporate DNS server ok. When doing an nslookup of a corporate hostname, I get a reply.



I'm thinking one of the following (or a combination) is happening:





  • our corporate DNS server is not always replying to requests in a timely fashion (although why this would only affect clients in one geographic region I don't know)

  • DNS queries from Latin America are somehow delayed, causing the client to treat it as failed (although we have offices at the end of much slower VSAT connections which do not have this issue)

  • a single failure is resulting in a DNS cache entry in Windows that somehow results in the lookups not happening on subsequent tries



Has anyone else come across this issue? Any ideas for resolutions?


Answer



Windows queries DNS in this order:





  • hosts file

  • local DNS cache

  • Preferred DNS servers

  • Other DNS servers



MS also has an article describing how the DNS server list is obtained:





The DNS Client service uses a server search list, ordered by preference. This list includes all preferred and alternate DNS servers configured for each of the active network connections on the system.



The list is arranged based on the following criteria:




  • Preferred DNS servers are given first priority.

  • If no preferred DNS servers are available, then alternate DNS servers are used.

  • Unresponsive servers are removed temporarily from these lists.





Windows has an escalating timeout for DNS requests:



Value      Default value  Attempt
1st limit 1 second Query the preferred DNS server on a preferred connection.
2nd limit 2 seconds Query the preferred DNS server on all connections.
3rd limit 2 seconds Query all DNS servers on all connections (1st attempt).
4th limit 4 seconds Query all DNS servers on all connections (2nd attempt).
5th limit 8 seconds Query all DNS servers on all connections (3rd attempt).
6th value (Must be 0.)



I could not find a clear answer on this exact point, but it sounds like if it doesn't get a response from your primary DNS in 1 or 2 seconds (1st or 2nd attempt, respectively), then that server will be removed from the DNS server lookup list for 15 minutes, and so it will use the secondary DNS servers. Since those servers have up to an 8 second timeout, they are much more likely to respond. (It's unclear to me if it continues to query the preferred DNS server during the 3rd+ attempt if it's already failed).



I also suspect that you do indeed have a WAN latency issue for this geographical area, as it would explain why the timeouts are working.






One solution is to change the DNS query timeouts, using the DNSQueryTimeouts registry parameter. See also http://drewthaler.blogspot.com/2005/09/changing-dns-query-timeout-in-windows.html







Another solution is to put a local caching DNS server on the network, and have the clients use that. You can use a DNS server that may be built in to a router, or install something like dnsmasq.


apache 2.2 - Apache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat

I am using apache2 server running on debian which forwards all the http request to tomcat installed on same machine.



I have two files under my /etc/apache2/ folder



apache2.conf and httpd.conf



I modified httpd.conf file to look like following.






# forward all http request on port 80 to tomcat
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/

# gzip text content
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
DeflateCompressionLevel 9
BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html


# Turn on Expires and mark all static content to expire in a week
# unset last modified and ETag
ExpiresActive On
ExpiresDefault A0

ExpiresDefault A604800

Header unset Last-Modified
Header unset ETag
FileETag None
Header append Cache-Control "max-age=604800, public"


RewriteEngine On

# rewrite all www.example.com/content/XXX-01.js and YYY-01.css files to XXX.js and YYY.css
RewriteRule ^content/(js|css)/([a-z]+)-([0-9]+)\.(js|css)$ /content/$1/$2.$4


# remove all query parameters from URL after we are done with it
RewriteCond %{THE_REQUEST} ^GET\ /.*\;.*\ HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .* http://example.com%{REQUEST_URI}? [R=301,L]

# rewrite all www.example.com to example.com
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]




I want to achieve following.




  1. forward all traffic to tomcat

  2. GZIP all the text content.

  3. Put 1 week expiry header to all static files and unset ETag/last modified header.

  4. rewrite all js and css file to certain format.

  5. remove all the query parameters from URL


  6. forward all www.example.com to example.com



The problem is only 1 and 2 are working.
I tried a lot with many combinations but the expire and rewrite rule (3-6) do not work at all. I also tried moving these rules to apache2.conf and .htaccess files but it didn't work either. It does not give any error but these rules are simple ignored.



expires and rewrite modules are ENABLED.



Please let me know what should I do to fix this.
1. Do I need to add something else in httpd.conf file (like Options +FollowSymLink) or something else?

2. Do I need to add something in apache2.conf file?
3. Do I need to move these rules to .htaccess file? If yes, what should I write in that file and where should I keep that file? in /etc/apache2/ folder or /var/www/ folder?
4. Any other info to make this work?



Thanks,
Ankit

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...