<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>x83.net &#187; awk</title>
	<atom:link href="http://www.x83.net/tag/awk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.x83.net</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 13:53:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Qmail commands</title>
		<link>http://www.x83.net/qmail-commands/</link>
		<comments>http://www.x83.net/qmail-commands/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 08:45:30 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[qmail-qread]]></category>
		<category><![CDATA[qmHandle]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=320</guid>
		<description><![CDATA[qmail-qread &#8211; list outgoing messages and recipients [root@server ~]# /var/qmail/bin/qmail-qread &#124; grep remote &#124; awk -F\@ &#8216;{print $2}&#8217; &#124;sort &#124; uniq &#124; sort -n aol.com bigpond.net.au comcast.net gmail.com hotmail.com msn.com nc.rr.com yahoo.com yahoo.co.uk qmHandle &#8211; qmail Handler [root@server ~]# qmHandle -s Total messages: 225 Messages with local recipients: 0 Messages with remote recipients: 225 Messages [...]]]></description>
			<content:encoded><![CDATA[<p>qmail-qread &#8211; list outgoing messages and recipients</p>
<blockquote><p>[root@server ~]# /var/qmail/bin/qmail-qread | grep remote | awk -F\@ &#8216;{print $2}&#8217; |sort | uniq | sort -n<br />
aol.com<br />
bigpond.net.au<br />
comcast.net<br />
gmail.com<br />
hotmail.com<br />
msn.com<br />
nc.rr.com<br />
yahoo.com<br />
yahoo.co.uk</p></blockquote>
<p>qmHandle &#8211; qmail Handler</p>
<blockquote><p>[root@server ~]# qmHandle -s<br />
Total messages: 225<br />
Messages with local recipients: 0<br />
Messages with remote recipients: 225<br />
Messages with bounces: 0<br />
Messages in preprocess: 0</p></blockquote>
<blockquote>
<p style="text-align: left;">qmHandle -l                       list all emails in queue<br />
qmHandle -mN                 show email no N from queue<br />
qmHandle -dN                  delete email no N from queue<br />
qmHandle -R                     show remote emails from queue<br />
qmHandle -D                     delete all messages from queue<br />
<strong>qmHandle -a                 try to send messages from queue</strong></p></blockquote>
<blockquote><p>
[root@server ~]# /var/qmail/bin/qmail-qstat<br />
messages in queue: 224<br />
messages in queue but not yet preprocessed: 0</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/qmail-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix Apache &#8211; No space left on device: Couldn&#8217;t create accept lock</title>
		<link>http://www.x83.net/fix-apache-no-space-left-on-device-couldnt-create-accept-lock/</link>
		<comments>http://www.x83.net/fix-apache-no-space-left-on-device-couldnt-create-accept-lock/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 09:02:01 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Redhat]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[ipcrm]]></category>
		<category><![CDATA[ipcs]]></category>
		<category><![CDATA[kernel.sem]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[semaphores]]></category>
		<category><![CDATA[sslmutex]]></category>
		<category><![CDATA[sysctl]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=276</guid>
		<description><![CDATA[This issue is related to semaphores. To view how many semaphores you have use: root@hal [~]# sysctl -a &#124; egrep kernel.sem\&#124;kernel.msgmni kernel.sem = 250 32000 32 128 kernel.msgmni = 16 You can change this values by adding them in /etc/sysctl.conf and then using sysctl -p to activate them. There is no need to reboot. To [...]]]></description>
			<content:encoded><![CDATA[<p>This issue is related to semaphores. To view how many semaphores you have use:</p>
<blockquote><p>root@hal [~]# sysctl -a | egrep kernel.sem\|kernel.msgmni<br />
kernel.sem = 250        32000   32      128<br />
<strong>kernel.msgmni = 16</strong>
</p></blockquote>
<p>You can change this values by adding them in /etc/sysctl.conf and then using sysctl -p to activate them.<br />
There is no need to reboot.</p>
<p>To remove sempahores use either one of these commands:</p>
<blockquote><p>for i in `ipcs -s | grep nobody | awk &#8216;{print $2}&#8217;`; do ipcrm -s $i; done<br />
/scripts/restartsrv_httpd</p></blockquote>
<p><strong>or in Perl</strong></p>
<blockquote><p>ipcs -s | grep nobody | perl -e &#8216;while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}&#8217;</p></blockquote>
<p><strong>or with xargs</strong></p>
<blockquote><p>ipcs -s | grep nobody | awk &#8216; { print $2 } &#8216; | xargs ipcrm</p></blockquote>
<p><strong>or bash style</strong></p>
<blockquote><p>for ipsemId in $(ipcs -s | grep nobody | cut -f 2 -d &#8216; &#8216;); do ipcrm $ipsemId;done </p></blockquote>
<p>Other errors :</p>
<p><em>Cannot create SSLMutex</em></p>
<p>add in httpd.conf</p>
<p><em>SSLMutex sem</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/fix-apache-no-space-left-on-device-couldnt-create-accept-lock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring users with last and lastb</title>
		<link>http://www.x83.net/monitoring-users-with-last-and-lastb/</link>
		<comments>http://www.x83.net/monitoring-users-with-last-and-lastb/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 20:39:43 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[last]]></category>
		<category><![CDATA[lastb]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.x83.net/blog/?p=137</guid>
		<description><![CDATA[Probably all of you know already about the &#8221;last&#8221; command and what it outputs. For example here is what my says: [aibo@lap ~]$ last &#124; more giani pts/2 :0.0 Tue Oct 14 21:45 still logged in giani pts/6 :0.0 Tue Oct 14 21:06 still logged in abo pts/5 :pts/3:S.1 Tue Oct 14 21:06 still logged [...]]]></description>
			<content:encoded><![CDATA[<p>Probably all of you know already about the &#8221;last&#8221; command and what it outputs.</p>
<p>For example here is what my says:</p>
<pre>
[aibo@lap ~]$ last | more
giani    pts/2        :0.0             Tue Oct 14 21:45   still logged in
giani    pts/6        :0.0             Tue Oct 14 21:06   still logged in
abo     pts/5        :pts/3:S.1       Tue Oct 14 21:06   still logged in
abo     pts/4        :pts/3:S.0       Tue Oct 14 21:05   still logged in
abo     pts/3        lap.x83.net      Tue Oct 14 21:05   still logged in
</pre>
<p>It very important to choose strong passwords for all accounts, especially root, since it is the #1 attacked account.</p>
<p>Also an other nice tools is &#8221;&#8217;lastb&#8221;&#8217; which shows the last failed logins.</p>
<pre>
Top 5 most recently attacked accounts
[root@lap ~]# lastb | awk '{print $1}' | sort | uniq -c | sort -rn | head -5
      7 root
      2 rancid
      2 giany
      1 btmp
      1
</pre>
<pre>
Top 5 most attacked accounts
[root@lap ~]# awk 'gsub(".*sshd.*Failed password for (invalid user )?", "") {print $1}' /var/log/secure* | sort | uniq -c | sort -rn | head -5
    144 root
     30 test
     18 admin
      9 user
      6 webmaster
</pre>
<pre>
Top 5 attacker IP addresses
[root@lap ~]# awk 'gsub(".*sshd.*Failed password for (invalid user )?", "") {print $3}' /var/log/secure* | sort | uniq -c | sort -rn | head -5
    397 124.109.44.155
    128 206.169.122.212
    107 89.179.174.40
     24 83.17.92.138
     15 85.25.151.96
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/monitoring-users-with-last-and-lastb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

