<?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>yurisk.info &#187; Linux</title>
	<atom:link href="http://yurisk.info/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://yurisk.info</link>
	<description>Yuri Slobodyanyuk&#039;s blog on IT Security and Networking</description>
	<lastBuildDate>Tue, 31 Jan 2012 11:28:48 +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>Time-based access limiting on Checkpoint or any Linux for that matter</title>
		<link>http://yurisk.info/2011/11/14/time-based-access-limiting-on-checkpoint-or-any-linux-for-that-matter/</link>
		<comments>http://yurisk.info/2011/11/14/time-based-access-limiting-on-checkpoint-or-any-linux-for-that-matter/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 21:08:16 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Checkpoint]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1776</guid>
		<description><![CDATA[Time-based access-lists in Cisco world are available since &#8230; last century for sure. But is it possible that Linux doesn&#8217;t have anything like that ? No way &#8211; of course it can do and do it better. Here is how . Access control based on time of the day is available via pam module, and [...]]]></description>
			<content:encoded><![CDATA[<p>Time-based access-lists in Cisco world are available since &#8230; last century for sure. But is it possible that Linux doesn&#8217;t have anything like that ? No way &#8211; of course it can do and do it better. Here is how .<br />
Access control based on time of the day is available via pam module, and as almost all software today supports working with pam modules, it means it is available universally.<br />
Steps to do it are these:</p>
<ul>
<li> Enable pam_time.so module for the software of interest in its config file in /etc/pam.d ;</li>
<li> Configure time range(s) when this service is accepting connections using file /etc/security/time.conf
<li> Most probably restart the service and we are set. </li>
<p>E.g. Let&#8217;s restrict user ftp_user so that it is able to connect to vsftpd daemon only during working hours of the weekdays.<br />
- Add to file /etc/pam.d/vsftpd the following line<br />
   <strong> account     required    /lib/security/pam_time.so </strong><br />
- Set time limits in /etc/security/time.conf with this line<br />
    <strong> vsftpd;*;ftp_user;Wk0800-1700 </strong><br />
- Restart vsftpd to force it using pam_time.so module (need to do it just first time)<br />
  <strong> #service vsftpd restart </strong><br />
And now during the off-limit hours the ftp_user will not be able to connect by FTP, that is it .</p>
<p>For Checkpoint all the above holds true, but as you don&#8217;t have much servers there , the most probable candidate for such restrictions is ssh daemon. For example firewall that the client has access by ssh to it as well &#8211; while mail alerts for such access (see <a href="http://yurisk.info/2010/02/01/mail-alert-on-ssh-login-or-any-other-rule-hit-in-checkpoint/"> Mail alert on ssh access in Checkpoint</a>) will warn me about such access, it does me no good if someone on client side accesses the firewall at 02:00 am at night and I get alert . But if it happens during working hours only, I can see such alert and act in real time.<br />
Example for limiting ssh access to the firewall to working hours only.<br />
<strong>/etc/security/time.conf : </strong><br />
  sshd;*;client_user;Wk0900-1900<br />
<strong>/etc/pam.d/sshd :</strong><br />
 account    required    /lib/security/pam_time.so</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2011/11/14/time-based-access-limiting-on-checkpoint-or-any-linux-for-that-matter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Watch your DNS records day and night with Nagios</title>
		<link>http://yurisk.info/2011/10/09/watch-your-dns-records-day-and-night-with-nagios/</link>
		<comments>http://yurisk.info/2011/10/09/watch-your-dns-records-day-and-night-with-nagios/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 10:11:22 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1722</guid>
		<description><![CDATA[Domain records are most visible vulnerable and many time crucial asset of the company. Attackers need not break your firewall protection, find and develop exploits for software running on your server to cut off your company from mails &#8211; it is enough for them to cause a change of MX record and it&#8217;s done &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Domain records are most visible vulnerable and many time crucial asset of the company.<br />
Attackers need not break your firewall protection, find and develop exploits for software running on your server to cut off your company from mails &#8211; it is enough for them to cause a change of MX record and it&#8217;s done &#8211; no incoming mails.<br />
I&#8217;ve seen real life example of this happening with huge company when due to human error  made to MX record that went unnoticed the company didn&#8217;t get mails.<br />
While  there are companies making millions on protecting domains (do whois on Google.com,Facebook.com to see example) you can at least spot potential problems automatically in no time with Nagios.<br />
The plugin to watch for DNS record is called check_dns and works this way &#8211; you configure which hostname to query and what the IP address for it should be , if the IP return doesn&#8217;t much the one configured the Critical condition occurs and alert is fired.<br />
This is the simplest of possible checks &#8211; to check hostname to IP mapping, more advanced checks are possible with check_dig  plugin.<br />
Example &#8211; if IP of the hostname mx20.013net.net that handles mail for my provider changes from 194.90.9.19, the alert will be sent:<br />
 <strong>check_dns   -H mx20.013net.net -a 194.90.9.19  -s 8.8.8.8</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2011/10/09/watch-your-dns-records-day-and-night-with-nagios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two tips to secure SSH access from specific IPs to specific users in Checkpoint or any Linux</title>
		<link>http://yurisk.info/2011/04/05/two-tips-to-secure-ssh-access-from-specific-ips-to-specific-users-in-checkpoint-or-any-linux/</link>
		<comments>http://yurisk.info/2011/04/05/two-tips-to-secure-ssh-access-from-specific-ips-to-specific-users-in-checkpoint-or-any-linux/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 07:06:06 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Checkpoint]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1636</guid>
		<description><![CDATA[Today I&#8217;ll bring you two tips to secure SSH access to the Checkpoint firewall beyond firewall rules itself. SSH access is the most powerful way to own the firewall so it should be secured to the paranoid level and even then it is never enough. Tip 1 Change the listening port.You may say obscurity is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ll bring you two tips to secure SSH access to the Checkpoint firewall beyond firewall rules itself. SSH access is the most powerful way to own the firewall so it should be secured to the paranoid level and even then it is never enough.<br />
 <strong>Tip 1 Change the listening port.</strong><br />You may say obscurity is not security but I will not agree &#8211; any measure that makes attacking your system harder without much burden on you is valid. After all there is no such thing total security, only endless arms race. Checkpoint just being a Linux in disguise uses OPenSSH server so changing the port is done via :<br />NOTE before changing listening port don&#8217;t forget to allow incoming connection on this port in firewall rules.</p>
<div class="cmdout">/etc/ssh/sshd_config<br />#Port 22</div>
<p>You change the above line to (if say I want to change port to 5022):</p>
<div class="cmdout">Port 5022 </div>
<p>Then save , then restart the SSH daemon:</p>
<div class="cmd">[Expert@fireball]# service sshd restart</div>
<p>Now you connect to the firewall <strong>#ssh -p 5022 user@IP</strong><br />
<strong>Tip 2 Limit SSH access per user and per IP address</strong><br />
Openssh provides the possibility to restrict access for specific user to specific IP addresses. I will look here at few potential scenarios.<br />
<strong>Case 1 Limit all SSH users to access from specific IP </strong>, here from network 99.19.19.0/24:<br />
At the bottom of the same file /etc/ssh/sshd_config I add:</p>
<div class="cmdout">AllowUsers *@99.19.19.*</div>
<p>Save , restart SSH daemon and this will take effect &#8211; only users coming from network<br />
99.19.19.0/24  will be able to login by ssh , any other source IP will always get &#8220;Wrong username or password&#8221; <br />
<strong>Case 2  Limit some users to access from specific IPs but allow others from Any.</strong><br />
Checkpoint comes with default user admin that people often do not change, and I concluded over the years that changing people&#8217;s bad behavior  is much harder than changing firewalls. So I do this:<br />
When both me and client are managing the firewall, i create the username for me , here yurisk and restrict the username admin to internal nets (for emergency cases) and his specific IP.Here my user is yurisk, client&#8217;s user is admin and LAN is 10.88.88.0/24 and client&#8217;s WAN IP is 123.123.123.10</p>
<div class="cmdout">/etc/ssh/sshd_config <br />
AllowUsers  admin@123.123.123.10 admin@10.88.88.*  yurisk</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2011/04/05/two-tips-to-secure-ssh-access-from-specific-ips-to-specific-users-in-checkpoint-or-any-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You can be Nmap hacker too &#8211; contribute new signatures in few easy steps and feel proud of yourself</title>
		<link>http://yurisk.info/2011/03/24/you-can-be-nmap-hacker-too-contribute-new-signatures-in-few-easy-steps-and-feel-proud-of-yourself/</link>
		<comments>http://yurisk.info/2011/03/24/you-can-be-nmap-hacker-too-contribute-new-signatures-in-few-easy-steps-and-feel-proud-of-yourself/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 09:07:19 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scan of the week]]></category>
		<category><![CDATA[nmap]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1549</guid>
		<description><![CDATA[NMAP is probably the most known long standing and community involved security-related project in the Open Source universe ever. And it is quite naturally to think that there is nothing left to be done to improve it by end users like us, and of course the opposite is the case. If we forget for a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://insecure.org" target=_blank>NMAP</a> is probably the most known long standing and community involved security-related project in the Open Source universe ever. And it is quite naturally to think that there is nothing left to be done to improve it by end users like us, and of course the opposite is the case. If we forget for a second all the complex C/C++/Lua/etc coding involved to sharpen the algorithms and performance of the Nmap, after all it is a signature based network scanner that is as good as its signatures are. And here you can never get enough.<br />
Just find some over the shelf network equipment, run a scan on it , be surprised that it is not recognized by Nmap and contribute its signature back to the Nmap communa, then buy yourself a beer and put a sign in your cube &#8221; I contributed to Nmap&#8221; <img src='http://yurisk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
&#8211; So how do you do this? Piece of cake.<br />
When running scan with -sV option (version detection of the software) if the target is not known to the Nmap it will print out as the output the Nmap-style fingerprint of the scanned service. It is ok to just take copy and paste it here : <a href="http://insecure.org/cgi-bin/submit.cgi" target=_blank>http://insecure.org/cgi-bin/submit.cgi</a>, but then I wouldn&#8217;t write this article. So let&#8217;s do some practice.<br />
There is a nice anti-spam and anti-virus appliance called PineApp Mailsecure , produced by Israel company named (surprise ..) <a href="http://pineapp.com" target=_blank>Pineapp</a> and which is quite popular at least here in Israel. Unfortunately Nmap does not recognize it beyond having an opened port of 25.<br />
Here is the result of the Nmap scan.</p>
<div class="cmd">nmap -v -n -sV -P0 12.12.12.12</div>
<div class="cmdout">Starting Nmap 5.21 ( http://nmap.org ) at 2091-03-17 15:41 IST<br />
NSE: Loaded 4 scripts for scanning.<br />
Initiating SYN Stealth Scan at 15:41<br />
Scanning 12.12.12.12 [1000 ports]<br />
Discovered open port 25/tcp on 12.12.12.12<br />
Completed SYN Stealth Scan at 15:41, 4.88s elapsed (1000 total ports)<br />
Initiating Service scan at 15:41<br />
Scanning 2 services on 12.12.12.12<br />
Completed Service scan at 15:41, 13.88s elapsed (2 services on 1 host)<br />
NSE: Script scanning 12.12.12.12.<br />
NSE: Script Scanning completed.<br />
Nmap scan report for 12.12.12.12<br />
Host is up (0.015s latency).<br />
Not shown: 996 filtered ports</p>
<p>PORT STATE SERVICE VERSION<br />
25/tcp open smtp<br />
113/tcp closed auth</p>
<p>1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :<br />
SF-Port25-TCP:V=5.21%I=7%D=3/19%Time=4D14329D%P=i686-pc-linux-gnu%r(NULL,2<br />
SF:5,&#8221;220\x20Ready\x20to\x20receive\x20mail\x20-=-\x20ESMTP\r\n&#8221;)%r(Hello,<br />
SF:8E,&#8221;220\x20Ready\x20to\x20receive\x20mail\x20-=-\x20ESMTP\r\n250-Ready\<br />
SF:x20to\x20receive\x20mail\x20-=-\r\n250-AUTH\x20LOGIN\x20PLAIN\r\n250-AU<br />
SF:TH=LOGIN\x20PLAIN\r\n250-PIPELINING\r\n250\x208BITMIME\r\n&#8221;)%r(Help,28,<br />
SF:&#8221;451\x20Rejected\x20due\x20to\x20illegal\x20pipelining\r\n&#8221;)%r(GenericL<br />
SF:ines,28,&#8221;451\x20Rejected\x20due\x20to\x20illegal\x20pipelining\r\n&#8221;);</p>
<p>Read data files from: /usr/local/share/nmap</p></div>
<p>So let&#8217;s fix this,but first some preliminary knowledge of importance.<br />
All its service signatures Nmap keeps in the file <strong>nmap-service-probes</strong> that has some predefined keywords that are easy to remember and use :<br />
-First we want to create a probe to define what string to which port to send, it goes like this:<br />
In our case the target service is SMTP so no changes are due to the existing probe,</p>
<div class="cmdout">Probe TCP Hello q|EHLO\r\n|</div>
<p>The above means send word EHLO once connected.<br />
Next line starts with the word <strong>rarity</strong> and its value. The higher the number the less is the probability of running this service probe, leave it as is in our case, as it will be run if previous port scanning reports port 25 as open.<br />
<strong>rarity 8</strong><br />
The rarity line is followed by the list of ports for which this service probe will be triggered once they are reported as open. Again , in our case we leave it as is:<br />
<strong>ports 25,587,3025</strong><br />
Then goes <strong>sslports</strong> keyword to specify SSL enabled ports, finally followed by <strong>totalwaitms</strong> also of no interest here .<br />
Now we come to the good stuff &#8211; many lines doing matches of different vendors/equipment that all and each start with keyword <strong>match</strong>. let&#8217;s have a closer look at it:<br />
match m|matching regex pattern Perl style| [version/device/hardware optional info]<br />
The best way to get it is via an existing match in the file:</p>
<p>match smtp m|^220\s+(DP-\d+)\r\n250-Hello\r\n250-DSN\r\n| p/Panasonic smtpd/ v/$1/ i/Panasonic printer/ d/printer/</p>
<p>It basically says:<br />
Send EHLO command to the target,check output the output from the target and look for string that starts with 220 followed by printable string of variable length, followed<br />
by word DP- then decimal number, note &#8211; here () allow to later reference the matched part of the string inside (), followed by Return and New Line char (\r\n), followed by word &#8220;250-DSN&#8221; and finally followed by return + new line (\r\n). If such match is found then print to the terminal string &#8220;Panasonic smtpd&#8221; , in version field (v/$1/) print what was matched by (DP-\d+) and in device type field print printer (d/printer/).<br />
That is it to it. Now let&#8217;s create a signature for the PineApp.<br />
We have 2 options here &#8211; to actually run a scan against the PineApp target and decipher the output, or , what I do here, use the common sense.<br />
First I will try to do what Nmap Probe EHLo does &#8211; namely connect by telnet to port 25 and issue EHLO command. After that I will try to compile a regex expression matching the output.</p>
<div class="cmd">[root@darkstar ~]# telnet 12.12.12.12 25</div>
<div class="cmdout">Trying 12.12.12.12&#8230;<br />
Connected to earth.planet.co (12.12.12.12).</p>
<p>Escape character is &#8216;^]&#8217;.<br />
220 Ready to receive mail -=- ESMTP<br />
helo a<br />
250 Ready to receive mail -=-<br />
quit<br />
221 Ready to receive mail -=-<br />
Connection closed by foreign host.</p></div>
<p>Well, the regex is not that hard to do here:<br />
<strong>match smtp m|^220 Ready to receive mail -=- ESMTP\r\n| p/PineApp Mail-secure/ i/PineApp Av and Antispam mail gateway/ o/Linux/ </strong><br />
I edit /usr/local/share/nmap/nmap-service-probes and insert the above regex under Probe TCP Hello where the matches start, save it and run the Nmap on the same host not recognized before:</p>
<div class="cmd">nmap -n -sV -P0 12.12.12.12</div>
<div class="cmdout">Starting Nmap 5.21 ( http://nmap.org ) at 2091-03-17 15:46 IST<br />
Nmap scan report for 12.12.12.12<br />
Host is up (0.012s latency).</p>
<p>Not shown: 996 filtered ports<br />
PORT STATE SERVICE VERSION<br />
25/tcp open smtp PineApp Mail-secure (PineApp Av and Antispam mail gateway)<br />
113/tcp closed auth<br />
Service Info: OS: Linux</p></div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2011/03/24/you-can-be-nmap-hacker-too-contribute-new-signatures-in-few-easy-steps-and-feel-proud-of-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert mb4 to mp3 files in one run with ffmpeg</title>
		<link>http://yurisk.info/2010/10/23/convert-mb4-to-mp3-files-in-one-run-with-ffmpeg/</link>
		<comments>http://yurisk.info/2010/10/23/convert-mb4-to-mp3-files-in-one-run-with-ffmpeg/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 08:38:40 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1348</guid>
		<description><![CDATA[Folks at Defcon.org have been somewhat inconsistent in publishing their conference audio archives &#8211; once they do it in mb4 format, once in mp3 . As I listen to them on my mobile phone during my commuting to the work  and it doesn&#8217;t accept anything but mp3 I had to first convert all audio files [...]]]></description>
			<content:encoded><![CDATA[<p>Folks at <a href="http://Defcon.org" target="_blank">Defcon.org </a> have been somewhat inconsistent in publishing their conference audio archives &#8211; once they do it in mb4 format, once in mp3 . As I listen to them on my mobile phone during my commuting to the work  and it doesn&#8217;t accept anything but mp3 I had to first convert all audio files from mb4 to mp3 format. Not a problem though, the one-liner below will find all files ending with .mb4 in the current folder and convert them to .mp3 files preserving the filenames.</p>
<div class="cmd"> find . -iname &#34;*.m4b&#34; -exec ffmpeg -i {} -acodec libmp3lame {}.mp3 \;</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/10/23/convert-mb4-to-mp3-files-in-one-run-with-ffmpeg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List of valid domain names for load testing DNS</title>
		<link>http://yurisk.info/2010/08/14/list-of-valid-domain-names/</link>
		<comments>http://yurisk.info/2010/08/14/list-of-valid-domain-names/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 09:45:19 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scan of the week]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1032</guid>
		<description><![CDATA[I am currently running a bunch of tests on DNS resolver software called Unbound to see what it is worth and for that needed a list of valid domain names in different but controllable TLDs. The only resource to download such list I could find was 3 million records file from Nominum Sample query data [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently running a bunch of tests on DNS resolver software called  <a  target="_blank" href="http://www.unbound.net/"> Unbound </a> to see what it is worth and for that needed a list of valid domain names in different but controllable TLDs. The only resource to download such list I could find was 3 million records file from Nominum  <a  target="_blank" href="ftp://ftp.nominum.com/pub/nominum/dnsperf/data/queryfile-example-3million.gz">  Sample query data file for use with resperf </a> . Only that it contains all kinds of record types &#58; A, PTR, AAAA and  I want list of domain names where I can modify query type but also that it will be of a specific TLD sample.<br />
Say all domains in .ASIA only TLD . To compile such list I took a word list , added to each word specific extensions and then run against some DNS server. Then I filtered the answers to include only existing resolvable domains that return at least 1 answer to query ANY. So far I did it for extensions &#58; .ASIA .COM .CA .BIZ .EDU .EU .FR .INFO .MIL .NET .ORG .RU and it brought 831903 valid domains.<br />
You can download  the final list of those domains here &#58; <a href="http://yurisk.info/domain_list.txt.gz"> Domain list 831903 domains </a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/08/14/list-of-valid-domain-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query non-standard port of SNMP</title>
		<link>http://yurisk.info/2010/08/11/query-non-standard-port-of-snmp/</link>
		<comments>http://yurisk.info/2010/08/11/query-non-standard-port-of-snmp/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 06:14:45 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1024</guid>
		<description><![CDATA[Sometimes the simple things are the ones to perplex you the most . Today I needed to add an SNMP monitoring of the Radware Linkproof listening on the port 7777 .Not a big deal, I thought. But before doing it in the monitoring system I just wanted to be sure and tried to query the [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the simple things are the ones to perplex you the most . Today I needed to add an SNMP monitoring of the Radware Linkproof listening on the port 7777 .Not a big deal, I thought. But before doing it in the monitoring system I just wanted to be sure and tried to query the Linkproof using snmpwalk . To much of my surprise in its help there was no mention how to do it . Searching the Google brought me –p &lt;port&gt; that didn&#8217;t work though. The solution is actually quite simple – just immediately after the<br />
IP of the device put &#58;&lt;port&gt; e.g.</p>
<div class="cmd">root@darkstar# snmpwalk -v 2c -c notpublic 12.120.186.8&#58;7777</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/08/11/query-non-standard-port-of-snmp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MAC finder script</title>
		<link>http://yurisk.info/2010/07/02/mac-finder-script/</link>
		<comments>http://yurisk.info/2010/07/02/mac-finder-script/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 05:35:37 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Esafe]]></category>
		<category><![CDATA[Fortigate]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=959</guid>
		<description><![CDATA[While I don&#8217;t like going down to Layer 2 , recently I had to do it &#8211; I didn&#8217;t know IP address of the Cisco router I wanted to connect to but I had access to the Cisco router sitting in the same network. That would be pretty easy to do #show arp on this [...]]]></description>
			<content:encoded><![CDATA[<p>While I don&#8217;t like going down to Layer 2 , recently I had to do it &#8211; I didn&#8217;t know IP address of the Cisco router I wanted to connect to but I had access to the Cisco router sitting in the same network. That would be pretty easy to do #show arp on this router and then search on Google to whom belongs each MAC  if it wasn&#8217;t the subnet mask of /26. Copy pasting each entry of the ARP table into Google didn&#8217;t look like a lot of fun. So I wrote a python script that reads MAC addresses in bulk from command line and using downloaded beforehand database of MAC-vendor translations prints vendor for each MAC address. It works for &#35;show arp on CIsco,&#35;show mac-address-table on CIsco switches, &#35;arp -en  on Linux (means including Checkpoint), &#35;arp -a on Freebsd ,&#35;show arp of Junos from Juniper, &#35;get sys arp on Fortigate.<br />
Below is the script.<br />
Here&#58;<br />
<strong>mac-database.txt</strong> &#8211; file containing MAC-vendor translation in format &lt;MAC 6 hex digits as a sequence&gt; &lt;VENDOR&gt;, I used <a href="http://standards.ieee.org/regauth/oui/oui.txt"> standards.ieee.org/regauth/oui/oui.txt </a> as the source with a bit of sed, but if you want ready to use file I recommend <strong>nmap-mac-prefixes</strong> from nmap source-code distribution <a href="http://nmap.org/svn/nmap-mac-prefixes">http://nmap.org/svn/nmap-mac-prefixes</a><br />
Download script (to make sure formatting is preserved, an important thing for Python)<br />
<a href="http://yurisk.info/scripts/mac-finder.py">http://yurisk.info/scripts/mac-finder.py</a><br />Script AND mac database from nmap project &#8211; <a href="http://yurisk.info/scripts/mac.tar.gz"> http://yurisk.info/scripts/mac.tar.gz</a></p>
<div class="cmdout">
<pre>
&#35;!/usr/bin/python
&#35;This script accepts MAC addresses from the command line and
&#35;prints vendor for each mac address
&#35; Author&#58;Yuri, yurisk@yurisk.info,06.2010
import sys
import re
&#35;This function removes from MACs colon or dot and returns MAC as a sequence of HEX chars
def dotreplace(matchobj):
&nbsp;&nbsp;       if matchobj.group(0) == &#39;.&#39;&#58;
&nbsp;&nbsp;&nbsp;&nbsp;            return &#39;&#39;
&nbsp;&nbsp;       elif  matchobj.group(0) == &#39;&#58;&#39;&#58;
&nbsp;&nbsp;&nbsp;&nbsp;            return &#39;&#39;
&#35;open file with MAC addresses and vendors database,it has form xxxx &lt;Vendor&gt;
macs=open(&#39;mac-database.txt&#39;,&#39;r&#39;)
macs_lines=macs.readlines()
&#35;Read from stdinput
data = sys.stdin.readlines()
for ppp in data:
       popa=re.search(&#39;.*([a-f0-9]{4}\.[a-f0-9]{4}\.[a-f0-9]{4}).*&#39;,ppp,re.IGNORECASE)
       if popa:
             newpopa=re.sub(&#39;\.&#39;, dotreplace,popa.group(1))[0:6]
             newpopa_re=re.compile(newpopa,re.IGNORECASE)
             for mac_db in macs_lines:
                 vendor=re.search(newpopa_re,mac_db)
                 if vendor:
                    print ppp.strip(),mac_db[7:]
       popalinux = re.search(&#39;.*([a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}).*&#39;,ppp,re.IGNORECASE)
       if popalinux&#58;
             newpopalinux=re.sub(&#39;&#58;&#39;,dotreplace,popalinux.group(1))[0&#58;6]
             newpopalinux_re=re.compile(newpopalinux,re.IGNORECASE)
             for mac_db in macs_lines&#58;
                 vendor=re.search(newpopalinux_re,mac_db)
                 if vendor&#58;
                    print ppp.strip(),mac_db[7&#58;]

       popadash = re.search('.*([a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}).*',ppp,re.IGNORECASE)
       if popadash:
             newpopadash=re.sub('-',dotreplace,popadash.group(1))[0:6]
             newpopadash_re=re.compile(newpopadash,re.IGNORECASE)
             for mac_db in macs_lines:
                 vendor=re.search(newpopadash_re,mac_db)
                 if vendor:
                    print ppp.strip(),mac_db[7:]
</pre>
</div>
<p>Running it:</p>
<div class="cmd">
[root@darkstar ]# ./mac-finder.py</div>
<div class="cmdout">
&lt;now I copy paste output from arp -a in BSD&gt;<br />$ arp -a<br />
(10.99.99.150) at 00:50:56:95:74:72 on em0 [ethernet]<br />
 (10.99.99.254) at 00:09:0f:31:c8:24  on em0 [ethernet]<br /> &lt;Hit CTRL+D to signal the end of input&gt;<br />
 (10.99.99.150) at 00:50:56:95:74:72 on em0 [ethernet] VMware, Inc.<br />
 (10.99.99.254) at 00:09:0f:31:c8:24 on em0 [ethernet] Fortinet Inc.</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/07/02/mac-finder-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to choose the password that noone can guess and you cant remember</title>
		<link>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/</link>
		<comments>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 10:29:21 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=887</guid>
		<description><![CDATA[How to choose the password that noone can guess and you cant remember Of course you know what the good password should be &#8211; random letters including capitals, peppered with numbers and enhanced with printable control characters. The only small but important detail these recommendations seem to forget is that there are may be few [...]]]></description>
			<content:encoded><![CDATA[<p>How to choose the password that noone can guess and you cant remember Of course you know what the good password should be &#8211; random letters including capitals, peppered with numbers and enhanced with printable control characters.<br />
The only small but important detail these recommendations seem to forget is that there are may be few hundreds in the world that can memorize such incomprehensible sequence of chars. So if someone does decide to follow it such passwords end up being written on the paper and stuck to the monitor (on its back).<br />
I never followed such recommendations but nevertheless found the way to come up with hard to break passwords. Here it is &#8211;  I just take easily memorizeable sentence from some verse/prose , take first letters of each word, capitalize first letter and then add some predefined number that doesn&#8217;t chnage from password to password .Example follows.<br />
This is how the 1st sentence from e.e. cummings turns into password:<br />
<strong>Anyone lived in a pretty how town -&gt; Aliapht7722</strong><br />
As I said previously these are passwords I use also for SSH user access and for the last year brute force efforts went down the drains (so far).<br />
The topic of passwords is actually a big one , and more of human psychology kind rather than crypto-randomness sort of things.<br />
For more about that look for example here&#58;<br />
<a target="_blank" href="http://www.schneier.com/blog/archives/2007/01/choosing_secure.html">www.schneier.com</a><br />
Another way to come up with random but easy to pronounce words for  passwords can be done with scientific approach&#58;<br />
<a target="_blank"  href="http://www.multicians.org/thvv/gpw.html">www.multicians.org</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 usernames used in SSH brute force</title>
		<link>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/</link>
		<comments>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 09:08:23 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=874</guid>
		<description><![CDATA[In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my [...]]]></description>
			<content:encoded><![CDATA[<p>In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my server. The full list of usernames can be found at the end.<br />
The script:</p>
<div class="cmd">awk  &#39;/Failed password for/  &#39;  /var/log/secure*  | sed  &#39;s/.* \([[:print:]]\+\) from .*/  \1  /g &#39; | sort | uniq -c | sort -n -k1</div>
<p>And the winners are:</p>
<table summary="The table listing top 10 usernames used in real cracking attampts on SSH service">
<caption>The table listing top 10 usernames used in real cracking attampts on SSH service</caption>
<tbody>
<tr class="thcolor">
<th>Username</th>
<th>Number of times seen</th>
</tr>
<tr>
<td>mysql</td>
<td>232</td>
</tr>
<tr class="cellcolor">
<td>info</td>
<td>252</td>
</tr>
<tr>
<td>postgres</td>
<td>317</td>
</tr>
<tr class="cellcolor">
<td>guest</td>
<td>435</td>
</tr>
<tr>
<td>nagios</td>
<td>452</td>
</tr>
<tr class="cellcolor">
<td>user</td>
<td>459</td>
</tr>
<tr>
<td>oracle</td>
<td>598</td>
</tr>
<tr class="cellcolor">
<td>admin</td>
<td>884</td>
</tr>
<tr>
<td>test</td>
<td>1017</td>
</tr>
<tr class="cellcolor">
<td>root</td>
<td>22058</td>
</tr>
</tbody>
</table>
<p>Full list of the usernames <a href="http://yurisk.info/usernames.log">Usernames.log</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

