<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Colocation to Virtualization &#187; Security</title>
	<atom:link href="http://blog.colovirt.com/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.colovirt.com</link>
	<description>and linux between</description>
	<lastBuildDate>Thu, 05 Jan 2012 08:00:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.colovirt.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/afd0d00d02b5abc67acf29066e3d1e3b?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Colocation to Virtualization &#187; Security</title>
		<link>http://blog.colovirt.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.colovirt.com/osd.xml" title="Colocation to Virtualization" />
	<atom:link rel='hub' href='http://blog.colovirt.com/?pushpress=hub'/>
		<item>
		<title>Linux, Networking, Security: Get Remote SSL Certificate From Command Line</title>
		<link>http://blog.colovirt.com/2010/03/03/linux-networking-security-get-remote-ssl-certificate-from-command-line/</link>
		<comments>http://blog.colovirt.com/2010/03/03/linux-networking-security-get-remote-ssl-certificate-from-command-line/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 20:31:00 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Middle Ware]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[443]]></category>
		<category><![CDATA[ca]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[certificate authority]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[s_client]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=676</guid>
		<description><![CDATA[Linux, Networking, Security: Get Remote SSL Certificate From Command Line<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=676&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Easy way to get the SSL certificate of a server from the command line in Linux.  The nice thing about it is that you get the full certificate chain.  Nice for troubleshooting issues.  After the &#8220;-connect&#8221;, specify the host and port you want to connect to.  TCP port 443 is the default https port. </strong></p>
<pre>[user1@testserver ~]$ openssl s_client -connect mail.google.com:443
<span id="more-676"></span>
CONNECTED(00000003)
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com
   i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
   i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDIjCCAougAwIBAgIQHxn23jXdY6FCkYrVLMCrEjANBgkqhkiG9w0BAQUFADBM
MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg
THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wOTEyMTgwMDAwMDBaFw0x
MTEyMTgyMzU5NTlaMGkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHFA1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKFApHb29nbGUgSW5jMRgw
FgYDVQQDFA9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBANknyBHye+RFyUa2Y3WDsXd+F0GJgDjxRSegPNnoqABL2QfQut7t9CymrNwn
E+wMwaaZF0LmjSfSgRSwS4L6ssXQuyBZYiijlrVh9nbBbUbS/brGDz3RyXeaWDP2
BnYyrVFfKV9u+BKLrebFCDmzQ0OpW5Ed1+PPUd91WY6NgKtTAgMBAAGjgecwgeQw
DAYDVR0TAQH/BAIwADA2BgNVHR8ELzAtMCugKaAnhiVodHRwOi8vY3JsLnRoYXd0
ZS5jb20vVGhhd3RlU0dDQ0EuY3JsMCgGA1UdJQQhMB8GCCsGAQUFBwMBBggrBgEF
BQcDAgYJYIZIAYb4QgQBMHIGCCsGAQUFBwEBBGYwZDAiBggrBgEFBQcwAYYWaHR0
cDovL29jc3AudGhhd3RlLmNvbTA+BggrBgEFBQcwAoYyaHR0cDovL3d3dy50aGF3
dGUuY29tL3JlcG9zaXRvcnkvVGhhd3RlX1NHQ19DQS5jcnQwDQYJKoZIhvcNAQEF
BQADgYEAicju7fexy+yRP2drx57Tcqo+BElR1CiHNZ1nhPmS9QSZaudDA8jy25IP
VWvjEgaq13Hro0Hg32ZNVK53qcXwjWtnCAReojvNwj6/x1Ciq5B6D7E6eiYDSfXJ
8/a2vR5IbgY89nq+wuHaA6vspH6vNR848xO3z1PQ7BrIjnYQ1A0=
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com issuer=/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
---
No client certificate CA names sent
---
SSL handshake has read 1778 bytes and written 316 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : AES256-SHA
    Session-ID: DEB23CF699255054E08F69181B2342E9F6D6DF0D02B399C36034E0D8BE18AC0C
    Session-ID-ctx:
    Master-Key: D696A99CEC2FDD9535FE2EC936531AD129FD97E56441E37AE7A143C40304E395EA7DA039797B948B009B42DA5377E668
    Key-Arg   : None
    Krb5 Principal: None
    Start Time: 1267560715
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 1350
Date: Tue, 02 Mar 2010 20:11:57 GMT
Server: GFE/2.0
X-XSS-Protection: 0
</pre>
<br />Filed under: <a href='http://blog.colovirt.com/category/linux/'>Linux</a>, <a href='http://blog.colovirt.com/category/middle-ware/'>Middle Ware</a>, <a href='http://blog.colovirt.com/category/networking/'>Networking</a>, <a href='http://blog.colovirt.com/category/security/'>Security</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/676/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/676/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/676/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=676&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2010/03/03/linux-networking-security-get-remote-ssl-certificate-from-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux, Security, LDAP: Local Authentication Fallback</title>
		<link>http://blog.colovirt.com/2009/12/16/linux-security-ldap-local-authentication-fallback/</link>
		<comments>http://blog.colovirt.com/2009/12/16/linux-security-ldap-local-authentication-fallback/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 17:49:33 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[failed to bind to LDA]]></category>
		<category><![CDATA[fallback]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[ldap.conf]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[local authentication]]></category>
		<category><![CDATA[nss_ldap]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rh]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=658</guid>
		<description><![CDATA[Linux, Security, LDAP: Local Authentication Fallback When LDAP Is Unavailable<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=658&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been setting up and integrating an LDAP authentication system into our infrastructure over the past few days.  This is just one small &#8220;got-cha&#8221; that I ran into.  The default setting in the OpenLDAP configuration (/etc/ldap.conf) is to continuously try reconnecting to the LDAP server on failure.  This is definitely not what I want to happen if we loose LDAP.  In this scenario, when connecting to the server via SSH, the session will hang and eventually timeout.  This even removes the ability to login with a local system account.<br />
<span id="more-658"></span><strong>Example of the timeout when LDAP server is down:</strong></p>
<pre>testuser@workstation4-l:~$ ssh test123@ldapclientsrv
Connection closed by 172.16.0.192</pre>
<p><strong>To begin, lets look at a typical error that you would get on the system if LDAP communication was down.</strong></p>
<pre>Dec 13 12:52:58 ldapServer sshd[15965]: nss_ldap: failed to bind to LDAP server ldap://127.0.0.16: Can't contact LDAP server
Dec 13 12:52:58 ldapServer sshd[15965]: nss_ldap: reconnecting to LDAP server (sleeping 4 seconds)...
Dec 13 12:53:02 ldapServer sshd[15965]: nss_ldap: failed to bind to LDAP server ldap://127.0.0.16: Can't contact LDAP server
Dec 13 12:53:02 ldapServer sshd[15965]: nss_ldap: reconnecting to LDAP server (sleeping 8 seconds)...
Dec 13 12:53:10 ldapServer sshd[15965]: nss_ldap: failed to bind to LDAP server ldap://127.0.0.16: Can't contact LDAP server
Dec 13 12:53:10 ldapServer sshd[15965]: nss_ldap: reconnecting to LDAP server (sleeping 16 seconds)...</pre>
<p><strong>As noted before, I was unable to login with a local account.  Turns out that the problem was with the default &#8220;bind_policy&#8221; in /etc/ldap.conf.  Per the document:</strong></p>
<pre># Reconnect policy: hard (default) will retry connecting to
# the software with exponential backoff, soft will fail
# immediately.
#bind_policy hard</pre>
<p><strong>This was changed to:</strong></p>
<pre>bind_policy soft</pre>
<p><strong>Once this was changed, I brought up the firewall on the LDAP server and refused connections.  Ability to login via LDAP was gone, but the server did fail back to local system authentication</strong></p>
<p><strong>Note(s)</strong>: When failing back to local authentication, there is no error sent back to the client trying to login, only errors go to /var/log/secure file.  The server will just keep rejecting the users login until LDAP is back up.  At least this gives you the ability to get in with a local system account in an emergency.</p>
<p><strong>Example error to /var/log/secure when LDAP server is down and local authentication is rejecting the LDAP user received from the client:</strong></p>
<pre>Dec 13 12:59:59 ldapServer sshd[2588]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=172.16.0.22</pre>
<br />Posted in Linux, Networking, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/658/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/658/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/658/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=658&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/12/16/linux-security-ldap-local-authentication-fallback/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux / Security: User Account Expiration Management</title>
		<link>http://blog.colovirt.com/2009/10/20/linux-security-user-account-expiration-management/</link>
		<comments>http://blog.colovirt.com/2009/10/20/linux-security-user-account-expiration-management/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 09:00:33 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[account]]></category>
		<category><![CDATA[account expiration]]></category>
		<category><![CDATA[accounts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[chage]]></category>
		<category><![CDATA[expiration]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[password expires]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=625</guid>
		<description><![CDATA[Linux / Security: User Account Expiration Management<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=625&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am a firm believer in regular password rotation/change and Linux has a built in mechanism that makes it easy.  The following is a brief overview of password and account ageing for Linux based systems.</p>
<p><strong>The program that enables listing and modification on the expiration parameters is &#8216;chage&#8217;.  Each individual user can view their account settings as shown below.<br />
<span id="more-625"></span></strong>testuser@testServer:~$ chage -l testuser</p>
<pre>Last password change					: Aug 07, 2009
Password expires					: Nov 05, 2009
Password inactive					: never
Account expires						: Aug 05, 1992
Minimum number of days between password change		: 90
Maximum number of days between password change		: 90
Number of days of warning before password expires	: 7</pre>
<p><strong>As you can see above, the last password change date is listed, as well as the expiration date for the current password.  When executed from a non-privileged account, the user can only view their own account.</strong></p>
<pre>testuser@testServer:~$ chage -l root
chage: <strong>Permission denied</strong>.</pre>
<p><strong>Also, the non-privileged account can not change their settings either.</strong></p>
<pre>testuser@testServer:~$ chage -M 99 testuser
chage: Permission denied.</pre>
<p><strong>From the root account, you have to ability to modify all the settings for individual users.</strong></p>
<pre>root@testServer:~# chage
Usage: chage [options] [LOGIN]

Options:
  -d, --lastday LAST_DAY        set last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximim number of days before password
                                change to MAX_DAYS
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS</pre>
<p><strong>Before modification, I am going to turn off all expiration settings on the &#8216;testuser&#8217; account.  This is disabling password expiration on that individual account.</strong></p>
<pre>root@testServer:~# chage -E -1 -I -1 -m 0 -M 99999 testuser</pre>
<p><strong>No lets configure password aging for the test user.  The first example below runs change in interactive mode.</strong></p>
<pre>root@testServer:~# chage testuser
Changing the aging information for testuser
Enter the new value, or press ENTER for the default

	Minimum Password Age [0]:
	Maximum Password Age [99999]: 90
	Last Password Change (YYYY-MM-DD) [2009-10-16]:
	Password Expiration Warning [7]:
	Password Inactive [-1]:
	Account Expiration Date (YYYY-MM-DD) [1969-12-31]: 2012-12-31</pre>
<p><strong>Verify that the settings took.</strong></p>
<pre>root@testServer:~# chage -l testuser
Last password change					: Oct 16, 2009
Password expires					: Jan 14, 2010
Password inactive					: never
Account expires						: Dec 31, 2012
Minimum number of days between password change		: 0
Maximum number of days between password change		: 90
Number of days of warning before password expires	: 7</pre>
<p><strong>The same can be accomplished using the command line, non-interactively.</strong></p>
<pre>root@testServer:~# chage -E 2012-12-31 -I -1 -m 0 -M 90 -W 7 testuser</pre>
<p>With the above settings in place, the user should be warned 7 days before the password expires on their account.  If the password is not changed before expiration day, on the next login the user will be forced to change their password.</p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/625/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/625/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=625&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/10/20/linux-security-user-account-expiration-management/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux / Security: Encrypted External Drive Part 1 – Urandom</title>
		<link>http://blog.colovirt.com/2009/09/04/linux-security-encrypted-external-drive-part-1-urandom/</link>
		<comments>http://blog.colovirt.com/2009/09/04/linux-security-encrypted-external-drive-part-1-urandom/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 08:34:40 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[data protection]]></category>
		<category><![CDATA[encrypt]]></category>
		<category><![CDATA[encrypted filesystem]]></category>
		<category><![CDATA[external drive]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[raid 1]]></category>
		<category><![CDATA[raid1]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[urandom]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=613</guid>
		<description><![CDATA[Linux / Security: Encrypted External Drive Part 1 - Urandom<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=613&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So I am re-doing my external RAID 1 drive enclosure.  I love this little thing.  It has two 2.5 inch 160gig SATA drives in it.  The enclosure is connected via USB 2.0 but it does have an eSATA interface as well.  I will be configuring this to have a 10 gig non-encrypted partition. The remaining ~150 gigs will be an encrypted (LUKS) filesystem to be used on my linux machine.</p>
<p>All of this will not be detailed here but will be split up in 3 blogs.  Below just shows the time it takes to use Linux to overwrite the disk device using /dev/urandom.  This is done to make it just that much harder for a would be hacker to try and brute force the key on the encrypted partition.  If this is not done, the un-used space would just show up as empty, allowing for a more targeted attack against the pseudo random filesystem.  Being pseudo-random means that it is not truly random.  This being the case, with a lot of time and computing power, an attacker might be able to either brute force or find a pattern in the encryption.</p>
<p>So why not use /dev/random?  For me, this would take forever!  I do not have any special hardware or scripts pulling information from the environment and adding to the entropy pool.  The data on this drive not being national security grade, /dev/random will do the job.</p>
<p><strong>I know that the drive is under /dev/sdb.  With that information, it is as simple as using &#8220;dd&#8221; (built in Linux utility) to overwrite all blocks on the drive with pseudo-random data.</strong></p>
<pre>root@tstbox:~# dd if=/dev/urandom of=/dev/sdb
dd: writing to `/dev/sdb': No space left on device
312581810+0 records in
312581809+0 records out
160041886208 bytes (160 GB) copied, 40284.5 s, 4.0 MB/s</pre>
<p>From above, it tool 40,284.5 seconds to overwrite the drive with urandom data.  This equals ~11 hours and 19 minutes.  Definitely still a long time, but a lot faster than if /dev/random was used.</p>
<p><strong>This workstation is not an impressive computer.  It is a single CPU dual core machine with 2 gigs of ram.  Below is the info on one of the cores.</strong></p>
<pre>root@tstbox:~# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 15
model name	: Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz
stepping	: 2
cpu MHz		: 1867.000
cache size	: 2048 KB
physical id	: 0
siblings	: 2</pre>
<p><strong>Notes: I wish I could use /dev/random and probably will eventually when I can sit a drive out for a week.  Setting up external drives in this fashion is really geared towards data protection.  Not only are the drives in a mirrored RAID (one can fail and everything would still run fine), important data is encrypted using a strong key.  So who cares is the external enclosure walks away at a conference?  I would be out ~190$ but the data will be safe.</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/613/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/613/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/613/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=613&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/09/04/linux-security-encrypted-external-drive-part-1-urandom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux / Security: Sudo ‘sudo su -’ vs ‘sudo -s’</title>
		<link>http://blog.colovirt.com/2009/08/18/linux-security-sudo-sudo-su-vs-sudo-s/</link>
		<comments>http://blog.colovirt.com/2009/08/18/linux-security-sudo-sudo-su-vs-sudo-s/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 19:34:18 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[root access]]></category>
		<category><![CDATA[su]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[sudo -s]]></category>
		<category><![CDATA[sudo su -]]></category>
		<category><![CDATA[sudoers]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=607</guid>
		<description><![CDATA[Linux / Security: Sudo 'sudo su -' vs 'sudo -s'<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=607&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I always use &#8216;sudo su -&#8217; when I need to get to a root shell.  I have seen a few people before, and a new co-worker recently use &#8216;sudo -s&#8217;.  Since I could not remember off hand the actual differences between the two, I had to check.  The following will run through the actual limitations.</p>
<p><strong>The big difference when using &#8216;-s&#8217; are listed below<br />
<span id="more-607"></span><br />
</strong></p>
<li>This option reads the environment or password file for the shell to be executed.  Does not execute root shell!</li>
<li>All environment variables are passed over from the current account to the root account<strong>Per the Linux man page for sudo</strong><br />
-s  The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified inpasswd(5).</p>
<p><strong>Below is the typical sudo command when going to root</strong><br />
$ sudo su -</p>
<p><strong>Now that we are root, check the current environment variables.  Here we see that we are in the bash shell, which is different from the Korn (ksh) shell that the user was in.  Also note, the home directory is &#8216;/root&#8217;, and the &#8216;PATH&#8217; locations.</strong></p>
<pre>[root@testServ01 ~]# printenv
HOSTNAME=testServ01.testDomain.com
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
USER=root
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
INPUTRC=/etc/inputrc
PWD=/root
LANG=en_US.UTF-8
SHLVL=1
HOME=/root
LOGNAME=root
CVS_RSH=ssh
LESSOPEN=|/usr/bin/lesspipe.sh %s
DISPLAY=localhost:10.0
G_BROKEN_FILENAMES=1
_=/usr/bin/printenv</pre>
<p><strong>When &#8216;sudo su -&#8217; was executed, we were in the testuser01 home directory (/home/testuser01).  After execution, we are now in the root user home directory (/root)<br />
</strong>[root@testServ01 ~]# pwd<br />
/root</p>
<p><strong>Now that we have seen what &#8216;sudo su -&#8217; does, lets check out &#8216;sudo -s&#8217;.</strong><br />
$ sudo -s</p>
<p><strong>Time to check the current environment variables again.  Main things to note here are the home directory, PATH definition, and the SUDO_* variables.  This is definitely different then what was listed before.<br />
</strong># printenv<br />
_=/usr/bin/printenv</p>
<pre>DISPLAY=localhost:10.0
HISTSIZE=1000
HOME=/home/testuser01
HOSTNAME=testServ01.testDomain.com
INPUTRC=/etc/inputrc
LANG=en_US.UTF-8
LOGNAME=root
MAIL=/var/spool/mail/testuser01
PATH=/usr/bin:/bin
PWD=/home/testuser01
SHELL=/bin/ksh
SUDO_COMMAND=/bin/ksh
SUDO_GID=500
SUDO_UID=500
SUDO_USER=testuser01
TERM=xterm
USER=root
USERNAME=root</pre>
<p><strong>When &#8216;sudo -s&#8217; was executed, we were in the testuser01 home directory (/home/testuser01).  After execution, you can see that we are still in the same directory.<br />
</strong># pwd<br />
/home/testact</p>
<p><strong>Since the &#8216;PATH&#8217; variable was passed from the testuers01 shell to the sudo environment, the administrative tools directories (/sbin, /usr/sbin) are not listed.  This is not a huge issue, just more of a hassle if there were not passed from the user account.</strong></p>
<p><strong>Since this was the case for the test, I tried to issue &#8216;iptables&#8217; without the absolute path.  Per below, it failed. </strong></p>
<pre># iptables -L
/bin/ksh: iptables: not found [No such file or directory]</pre>
<p><strong>Since I do actually have root level access, when I issue the command with the absolute path it works fine</strong></p>
<pre># /sbin/iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination</pre>
<p><strong>To conclude &#8216;sudo -s&#8217;:</strong></li>
<li>does NOT change the shell</li>
<li>&#8216;PATH&#8217; does not change since root shell is not executed</li>
<li>carries over all environment variables from the non-privileged user<strong>
<p>Notes: So to be safe, I will still use &#8216;sudo su -&#8217; when needing root level access.  Seems that the &#8216;sudo -s&#8217; option would be a little more safe for some users.  Mainly due to the sbin locations not being in the &#8216;PATH&#8217;.  This would make the user execute most administrative commands using the full path to the executable, unless sbin(s) were exported.</strong></li>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:171px;width:1px;height:1px;">I always use &#8216;sudo su -&#8217; when I need to get to a root shell.  I have seen a few people before, and a new co-worker recently use &#8216;sudo -s&#8217;.  Since I could not remember off hand the actual differences between the two, I had to check.  The following will run through the actual limitations.</p>
<p>The big difference when using &#8216;-s&#8217; are listed below<br />
&lt;li&gt;This option reads the environment or password file for the shell to be executed.  Does not execute root shell!<br />
&lt;li&gt;All environment variables are passed over from the current account to the root account</p>
<p>Per the Linux man page for sudo<br />
&lt;pre&gt;-s  The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in<br />
passwd(5).&lt;/pre&gt;</p>
<p>Below is the typical sudo command when going to root<br />
&lt;pre&gt;$ sudo su -&lt;/pre&gt;</p>
<p>Now that we are root, check the current environment variables.  Here we see that we are in the bash shell, which is different from the Korn (ksh) shell that the user was in.  Also note, the home directory is &#8216;/root&#8217;, and the &#8216;PATH&#8217; locations.<br />
&lt;pre&gt;[root@testServ01 ~]# printenv<br />
HOSTNAME=testServ01.testDomain.com<br />
SHELL=/bin/bash<br />
TERM=xterm<br />
HISTSIZE=1000<br />
USER=root<br />
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin<br />
INPUTRC=/etc/inputrc<br />
PWD=/root<br />
LANG=en_US.UTF-8<br />
SHLVL=1<br />
HOME=/root<br />
LOGNAME=root<br />
CVS_RSH=ssh<br />
LESSOPEN=|/usr/bin/lesspipe.sh %s<br />
DISPLAY=localhost:10.0<br />
G_BROKEN_FILENAMES=1<br />
_=/usr/bin/printenv&lt;/pre&gt;</p>
<p>When &#8216;sudo su -&#8217; was executed, we were in the testuser01 home directory (/home/testuser01).  After execution, we are now in the root user home directory (/root)<br />
&lt;pre&gt;[root@testServ01 ~]# pwd<br />
/root&lt;/pre&gt;</p>
<p>Now that we have seen what &#8216;sudo su -&#8217; does, lets check out &#8216;sudo -s&#8217;.<br />
&lt;pre&gt;$ sudo -s&lt;/pre&gt;</p>
<p>Time to check the current environment variables again.  Main things to note here are the home directory, PATH definition, and the SUDO_* variables.  This is definitely different then what was listed before.<br />
&lt;pre&gt;# printenv<br />
_=/usr/bin/printenv<br />
DISPLAY=localhost:10.0<br />
HISTSIZE=1000<br />
HOME=/home/testuser01<br />
HOSTNAME=testServ01.testDomain.com<br />
INPUTRC=/etc/inputrc<br />
LANG=en_US.UTF-8<br />
LOGNAME=root<br />
MAIL=/var/spool/mail/testuser01<br />
PATH=/usr/bin:/bin<br />
PWD=/home/testuser01<br />
SHELL=/bin/ksh<br />
SUDO_COMMAND=/bin/ksh<br />
SUDO_GID=500<br />
SUDO_UID=500<br />
SUDO_USER=testuser01<br />
TERM=xterm<br />
USER=root<br />
USERNAME=root&lt;/pre&gt;</p>
<p>When &#8216;sudo -s&#8217; was executed, we were in the testuser01 home directory (/home/testuser01).  After execution, you can see that we are still in the same directory.<br />
&lt;pre&gt;# pwd<br />
/home/testact&lt;/pre&gt;</p>
<p>Since the &#8216;PATH&#8217; variable was passed from the testuers01 shell to the sudo environment, the administrative tools directories (/sbin, /usr/sbin) are not listed.  This is not a huge issue, just more of a hassle if there were not passed from the user account.</p>
<p>Since this was the case for the test, I tried to issue &#8216;iptables&#8217; without the absolute path.  Per below, it failed.<br />
&lt;pre&gt;# iptables -L<br />
/bin/ksh: iptables: not found [No such file or directory]&lt;/pre&gt;</p>
<p>Since I do actually have root level access, when I issue the command with the absolute path it works fine<br />
&lt;pre&gt;# /sbin/iptables -L<br />
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
RH-Firewall-1-INPUT  all  &#8211;  anywhere             anywhere</p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination<br />
RH-Firewall-1-INPUT  all  &#8211;  anywhere             anywhere</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination&lt;/pre&gt;</p>
<p>To conclude &#8216;sudo -s&#8217;:<br />
&lt;li&gt;does NOT change the shell<br />
&lt;li&gt;&#8217;PATH&#8217; does not change since root shell is not executed<br />
&lt;li&gt;carries over all environment variables from the non-privileged user</p>
<p>Notes: So to be safe, I will still use &#8216;sudo su -&#8217; when needing root level access.  Seems that the &#8216;sudo -s&#8217; option would be a little more safe for some users.  Mainly due to the sbin locations not being in the &#8216;PATH&#8217;.  This would make the user execute most administrative commands using the full path to the executable, unless sbin(s) were exported.</p></div>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/607/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/607/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/607/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=607&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/08/18/linux-security-sudo-sudo-su-vs-sudo-s/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux / Security: Iptables CLI &#8211; List Rules Without DNS Resolution</title>
		<link>http://blog.colovirt.com/2009/06/02/linux-security-iptables-cli-list-rules-without-dns-resolution/</link>
		<comments>http://blog.colovirt.com/2009/06/02/linux-security-iptables-cli-list-rules-without-dns-resolution/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 13:13:12 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[chain]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[dns resolution]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[iptables -L -n]]></category>
		<category><![CDATA[iptales -L]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[reverse dns]]></category>
		<category><![CDATA[rule]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=565</guid>
		<description><![CDATA[Linux / Security: Iptables CLI - List Rules Without DNS Resolution<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=565&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is quick and a little basic, but most people do not actually read the &#8220;man pages&#8221; or documentation.  The majority of the time, requests for access comes in specifying IP address instead of hostnames (FQDN).  I actually prefer this, but when doing a typical &#8220;iptables -L&#8221;, the reverse DNS is automatically checked for all IPs.<br />
<strong><br />
Most of the time I do not actually know the hostname that is associated and makes it hard to confirm the rule without doing a dns lookup on my own.  Below is the typical output of the command.<br />
<span id="more-565"></span></strong>[root@testserver ~]# iptables -L</p>
<pre>Chain Firewall-INPUT
(2 references)
target     prot opt source               destination
ACCEPT     tcp  --  mail.asdf.com        anywhere            tcp dpt:ssh
ACCEPT     tcp  --  static.123.net       anywhere            tcp dpt:ssh
ACCEPT     tcp  --  private.9z.com       anywhere            tcp dpts:ftp-data:ftp
ACCEPT     tcp  --  nto.ntpgr.com        anywhere            tcp dpts:ftp-data:ftp</pre>
<p>Iptables has a built in option to disable DNS resolution.  This is done by passing &#8220;-n&#8221; in conjunction with &#8220;-L&#8221; and shown below.</p>
<pre>[root@testserver ~]# iptables -L -n
Chain Firewall-INPUT
(2 references)
target     prot opt source               destination
ACCEPT     tcp  --  10.1.129.119         0.0.0.0/0           tcp dpt:22
ACCEPT     tcp  --  172.168.22.87        0.0.0.0/0           tcp dpt:22
ACCEPT     tcp  --  172.33.100.2         0.0.0.0/0           tcp dpts:ftp-data:ftp
ACCEPT     tcp  --  10.90.15.104         0.0.0.0/0           tcp dpts:ftp-data:ftp</pre>
<p>Above you can see how easy it would be to verify the rules now without knowing the hostname or performing a lookup on your own.</p>
<p><strong>Notes:  The iptables output was edited to remove non-relevant information and all IPs/hostnames were changed.</strong></p>
<br />Posted in Linux, Networking, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/565/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=565&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/06/02/linux-security-iptables-cli-list-rules-without-dns-resolution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux/Networking/Security: TFTP Deamon Setup and Cisco Configuration Backup</title>
		<link>http://blog.colovirt.com/2009/03/31/linuxnetworkingsecurity-tftp-deamon-setup-and-cisco-configuration-backup/</link>
		<comments>http://blog.colovirt.com/2009/03/31/linuxnetworkingsecurity-tftp-deamon-setup-and-cisco-configuration-backup/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 13:50:13 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[SAN (Storage Area Network)]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[9124]]></category>
		<category><![CDATA[access list]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[cisco 9124]]></category>
		<category><![CDATA[cisco backup]]></category>
		<category><![CDATA[cisco tftp]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[fefora]]></category>
		<category><![CDATA[insert]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[mds]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[put]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[running-config]]></category>
		<category><![CDATA[tftp]]></category>
		<category><![CDATA[tftp rule]]></category>
		<category><![CDATA[tftp server]]></category>
		<category><![CDATA[tftpd]]></category>
		<category><![CDATA[xinetd]]></category>
		<category><![CDATA[xinetd.d]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=472</guid>
		<description><![CDATA[Linux/Networking/Security: TFTP Deamon Setup and Cisco Configuration Backup<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=472&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is just a quick walk-through on setting up TFTP service on a RedHat, Centos, or Fedora system.  In general, this process should transfer over to other Linux (<strong>not BSD!</strong>) derived distributions.</p>
<pre>[root@tftpsrv ~]# yum install tftp
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package tftp-server.i386 0:0.42-3.1.el5.centos set to be updated
--&gt; Processing Dependency: xinetd for package: tftp-server
--&gt; Running transaction check
---&gt; Package xinetd.i386 2:2.3.14-10.el5 set to be updated
--&gt; Finished Dependency Resolution

Dependencies Resolved</pre>
<p><span id="more-472"></span></p>
<pre>
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 tftp-server             i386       0.42-3.1.el5.centos  base               27 k
Installing for dependencies:
 xinetd                  i386       2:2.3.14-10.el5  base              124 k

Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)         

Total download size: 151 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): tftp-server-0.42-3 100% |=========================|  27 kB    00:00
(2/2): xinetd-2.3.14-10.e 100% |=========================| 124 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: xinetd                       ######################### [1/2]
  Installing: tftp-server                  ######################### [2/2]

Installed: tftp-server.i386 0:0.42-3.1.el5.centos
Dependency Installed: xinetd.i386 2:2.3.14-10.el5
Complete!</pre>
<p><strong>Edit configuration to enable tftp</strong></p>
<pre>[root@tftpsrv ~]# vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot        -&gt; some directory (/tftpfiles)
        disable                 = yes            -&gt; no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}</pre>
<p><strong>Create directory specified in tftp configuration file</strong></p>
<pre>[root@tftpsrv xinetd.d]# mkdir /tftpfiles</pre>
<p><strong>Start up xinetd.  This is used to call tftp</strong></p>
<pre>[root@tftpsrv ~]# /etc/init.d/xinetd start
Starting xinetd:                                           [  OK  ]

[root@tftpsrv xinetd.d]# iptables-save &gt; /etc/init.d/iptables
[root@tftpsrv xinetd.d]# iptables -F</pre>
<p><strong>Below, the tftp put will fail.  This is due to the file needing to be created on the TFTP server before the client can write to it.  This is the only real security there is to TFTP.  You at least need to know the filename before the file can be written or read.</strong></p>
<pre>C9124SW5# copy running-config tftp:CISCSCOCFG1
Enter hostname for the tftp server: 172.16.100.6
Trying to connect to tftp server......

TFTP put operation failed:Undefined error code (2)</pre>
<p><strong>Create the file to be saved from switch and change the permissions</strong></p>
<pre>[root@tftpsrv ~]# touch /tftpfiles/CISCSCOCFG1
[root@tftpsrv ~]# chmod 777 /tftpfiles/CISCSCOCFG1</pre>
<p><strong>Tell the switch to save the file</strong></p>
<pre>C9124SW5# copy running-config tftp:CISCSCOCFG1
Enter hostname for the tftp server: 172.16.100.6
Trying to connect to tftp server......
|
TFTP put operation was successful</pre>
<p><strong>Check the services file to find the TFTP port and protocol information</strong></p>
<pre>[root@tftpsrv]# cat /etc/services | grep tftp
tftp        69/tcp
tftp        69/udp</pre>
<p><strong>Bring the firewall back up so we can insert rules to allow TFTP in</strong></p>
<pre>[root@tftpsrv]# /etc/init.d/iptables restart</pre>
<p><strong>On my test server, the firewall chain is &#8220;RH-Firewall-1-INPUT&#8221;.  I always prefer inserting new firewall rules as the first rule.  Most servers keep a few custom reject rules and most are explicit allow with the default deny at the end.  Inserting the new rule as the first will normally bypass those that might reject before it ever gets to the tftp rule.</strong></p>
<pre>[root@tftpsrv]# iptables -I RH-Firewall-1-INPUT 1 -s 172.16.100.98 -p tcp --dport 69 -j ACCEPT
[root@tftpsrv]# iptables -I RH-Firewall-1-INPUT 1 -s 172.16.100.98 -p udp --dport 69 -j ACCEPT</pre>
<p><strong>The above statements tell iptables to insert &#8220;-I&#8221; the new rule into the chain &#8220;RH-Firewall-1-INPUT&#8221; as rule number &#8220;1&#8243;.  The -s is specifying the source, -p the protocol &#8211;dport the destination port and -j allows the connection to establish by jumping over to ACCEPT.</strong></p>
<p><strong>Verify the rules are there</strong></p>
<pre>[root@tftpsrv]# iptables -L
Chain RH-Firewall-1-INPUT
target     prot opt source               destination
ACCEPT     udp  --  172.16.100.98        anywhere            udp dpt:tftp
ACCEPT     tcp  --  172.16.100.98        anywhere            tcp dpt:tftp</pre>
<p><strong>Save the rules in sysconfig so they will be persistent through reboots</strong></p>
<pre>[root@tftpsrv]# iptables-save &gt; /etc/sysconfig/iptables</pre>
<p><strong>Notes:</strong> Never flush your iptables rules &#8220;iptables -F&#8221; on production systems that are not protected by a firewall or are on are public IP.  Always be sure to backup/save your iptables configuration when testing.  Also, if you are not familiar with security, or there is someone else responsible for security in the company, as them before or have them modify the local iptables rules.  Another good rule for servers running TFTP, FTP, Telnet, DNS, and mail is to have servers dedicated for each.  These are some of the most exploited servers out there.</p>
<br />Posted in Linux, Networking, SAN (Storage Area Network), Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/472/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=472&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/03/31/linuxnetworkingsecurity-tftp-deamon-setup-and-cisco-configuration-backup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux/Security: Scponly SFTP Fix For RedHat and Centos 5.x (and possibly Fedora)</title>
		<link>http://blog.colovirt.com/2009/03/17/linuxsecurity-scponly-sftp-fix-for-redhat-and-centos-5x-and-possibly-fedora/</link>
		<comments>http://blog.colovirt.com/2009/03/17/linuxsecurity-scponly-sftp-fix-for-redhat-and-centos-5x-and-possibly-fedora/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 14:50:12 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[/dev/null]]></category>
		<category><![CDATA[5.x]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[jail]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[make jail]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[scponly]]></category>
		<category><![CDATA[scponly fails]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[subsystem]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=464</guid>
		<description><![CDATA[Linux/Security: Scponly SFTP Fix For RedHat and Centos 5.x (and possibly Fedora)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=464&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The current scponly release does not function correctly out of the box for 5.x Redhat and Centos distributions.  I was unable to test Fedora, but I expect the same problems there.  Accounts created with scponly will fail to connect via scp or sftp without a /dev/null device inside the users chroot (jail).  The bad thing  is that enabling debugging and checking the logs will show now issue.  The logs showed ssh authenticate the username and password and drop the session to the sftp subsystem.  After that, it would just show a disconnect.  Below is the fixed I used to get scponly working.</p>
<p><strong>Using scponly &#8220;make jail&#8221; command to setup the initial user.  I removed most of the generic output from the command.</strong></p>
<pre>[root@testserver01 scponly-4.8]# make jail
/usr/bin/install -c -d /usr/local/bin
/usr/bin/install -c -d /usr/local/man/man8
/usr/bin/install -c -d /usr/local/etc/scponly
/usr/bin/install -c -o 0 -g 0 scponly /usr/local/bin/scponly
/usr/bin/install -c -o 0 -g 0 -m 0644 scponly.8 /usr/local/man/man8/scponly.8
/usr/bin/install -c -o 0 -g 0 -m 0644 debuglevel /usr/local/etc/scponly/debuglevel
if test "xscponlyc" != "x"; then
		/usr/bin/install -c -d /usr/local/sbin;
		rm -f /usr/local/sbin/scponlyc;
		cp scponly scponlyc;
		/usr/bin/install -c -o 0 -g 0 -m 4755 scponlyc /usr/local/sbin/scponlyc;
	fi
chmod u+x ./setup_chroot.sh
./setup_chroot.sh

Username to install [scponly]newact
home directory you wish to set for this user [/home/newact]
name of the writeable subdirectory [incoming]

creating  /home/newact/incoming directory for uploading files

Your platform (Linux) does not have a platform specific setup script.
This install script will attempt a best guess.
If you perform customizations, please consider sending me your changes.
Look to the templates in build_extras/arch.
 - joe at sublimation dot org

please set the password for newact:
Changing password for user newact.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.</pre>
<p><strong><span id="more-464"></span>Now that the user is created, lets test the sftp session from a different system</strong></p>
<pre>user1@workstation03:~/.ssh$ sftp newact@10.1.3.43
Connecting to 10.1.3.43...
newact@10.1.3.43's password:
Connection closed</pre>
<p><strong>So we see that the connection failed.  The reason here is that there is no /dev/null device within the users chrooted home (jail).  Scponly does not auto-create this needed device.</strong></p>
<pre>[root@testserver01 scponly-4.8]# mkdir -p /home/newact/dev/
[root@testserver01 scponly-4.8]# cp -a /dev/null /home/newact/dev/</pre>
<p><strong>After re-testing the connection, you can see that everything is now functioning fine.  I was able to push a file to the incoming folder in the working chrooted (jailed) environment.</strong></p>
<pre>user1@workstation03:~/.ssh$ sftp newact@10.1.3.43
Connecting to 10.1.3.43...
newact@10.1.3.43's password:
sftp&gt; ls
dev       etc       incoming  lib       usr
sftp&gt; cd incoming
sftp&gt; put testfile
Uploading testfile to /incoming/testfile
testfile                                                                                                100%  885     0.9KB/s   00:00
sftp&gt; exit</pre>
<p><strong>Notes: For each user account that you create with scponly chrooting scripts, you will need to create the dev directory, as well as the null device under the users home directory.  This is definitely something that can be manually added to the setup_chroot.sh easily.<br />
</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/464/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=464&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/03/17/linuxsecurity-scponly-sftp-fix-for-redhat-and-centos-5x-and-possibly-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux/Security: Gathering Filesystem,Device, and Port Process Details With fuser</title>
		<link>http://blog.colovirt.com/2009/03/05/linuxsecurity-gathering-filesystemdevice-and-port-process-details-with-fuser/</link>
		<comments>http://blog.colovirt.com/2009/03/05/linuxsecurity-gathering-filesystemdevice-and-port-process-details-with-fuser/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 15:13:10 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[file in use]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[fuser]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[muv]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ps]]></category>
		<category><![CDATA[secuirty]]></category>
		<category><![CDATA[term]]></category>
		<category><![CDATA[troubleshoot]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=446</guid>
		<description><![CDATA[Linux/Security: Gathering Filesystem,Device, and Port Process Details With fuser.  This is an overview on how fuser can locate process and user details.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=446&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When troubleshooting a *nix box, working knowledge of file system, network, and process utilities are a necessity.  The main ones for me are mount, lsof, dd, ps, fsck, netstat, tcpdump, and fuser.  All of these tools are very basic, but most admins seem to not know about or utilise fuser.  All of fusers functionality can be accomplished by using any of the above commands together.  In the below examples, the same end results can be archived by using kill and lsof together, but why not just use one tool?</p>
<p><strong>To begin, we will be passing fuser the -m switch to specify both a device and file(system).</strong></p>
<pre>       -m     name specifies a file on a mounted file system or a block device
              that is mounted. All processes accessing files on that file sys-
              tem  are  listed.  If a directory file is specified, it is auto-
              matically changed to name/. to use any file system that might be
              mounted on that directory</pre>
<p><strong>In it&#8217;s basic form, fuser will provide only the process id(s) (PID) that are currently utilising the specified file/device</strong></p>
<pre>root@testbox:~# fuser -m /media/disk/
/dev/sdb1:            5535c  5589c</pre>
<p><strong>The above example showed that process 5355 is currently utilizing something on the /media/disk file system.  Below is the same example, but specifying the actual device that is mounted on /media/disk.</strong></p>
<pre>root@testbox:~# fuser -m /dev/sdb1
/dev/sdb1:            5535c  5589c
<span id="more-446"></span><strong>From there, we can use 'ps' to reveal what's going on</strong></pre>
<pre>root@testbox:~# ps -axc | grep 5589
 5589 pts/1    S+     0:00 vi
root@testbox:~# ps -axc | grep 5535
 5535 pts/1    Ss     0:00 bash</pre>
<p><strong>Fuser also gives us the ability to terminate the any processes that are utilizing the filesystem/device.  The following commands utilises -k to initiate the kill, -m to set the target, -i to prompt the user for verification, and -TERM to send the term signal to the process(es).</strong></p>
<pre>root@testbox:~# fuser -kmi -TERM /dev/sdb1
/dev/sdb1:            5535c  5589c
Kill process 5535 ? (y/N) y
Kill process 5589 ? (y/N) y</pre>
<p><strong>This is what it looks like from there users end when the process is killed</strong></p>
<pre>user01@testbox:/media/disk$
vi File.txt
Vim: Caught deadly signal TERM
Vim: Finished.
Terminated</pre>
<p><strong>Here we will be adding the -u and -v options to obtain more details from fuser.</strong><br />
<strong> Direct from the help output:</strong></p>
<pre>    -u        display user IDs
    -v        verbose output</pre>
<p><strong>Doing so displays the username, process id (PID), type of access, and the running command.  In this case, we are looking at the actual device.</strong></p>
<pre>root@testbox:~# fuser -muv /dev/sdb1
                     USER        PID ACCESS COMMAND
/dev/sdb1:           user01   6457 F.... (user01)vi</pre>
<p><strong>When trying to unmount a device while a process is currently utilizing a file, the unmount will fail.</strong></p>
<p><strong>Below will kill all the processes running on the sdb1 device and allow it to be unmounted.</strong></p>
<pre>root@testbox:~# fuser -km -TERM /dev/sdb1
/dev/sdb1:            6403</pre>
<p><strong>Passing the -TERM parameter causes fuser to perform the same as doing &#8220;kill -9 6403&#8243;.  Below is the list of signals that fuser can send when -k is used</strong></p>
<pre>root@testbox:~# fuser -l
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM
STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS
UNUSED</pre>
<p><strong>For the last examples, fuser will be used to see what command is bound to TCP port 22.</strong></p>
<pre>root@testbox:~# fuser -uv 22/tcp
                     USER        PID ACCESS COMMAND
22/tcp:              user01   7288 F.... (root)sshd</pre>
<p><strong>The same can be accomplished as follows</strong></p>
<pre>root@testbox:~# fuser -nuv tcp 22
                     USER        PID ACCESS COMMAND
22/tcp:              root       2267 F.... (root)sshd</pre>
<p><strong>Full help output</strong></p>
<pre>Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
             [ - ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
       fuser -l
       fuser -V
Show which processes use the named files, sockets, or filesystems.

    -a        display unused files too
    -c        mounted FS
    -f        silently ignored (for POSIX compatibility)
    -i        ask before killing (ignored without -k)
    -k        kill processes accessing the named file
    -l        list available signal names
    -m        show all processes using the named filesystems
    -n SPACE  search in this name space (file, udp, or tcp)
    -s        silent operation
    -SIGNAL   send this signal instead of SIGKILL
    -u        display user IDs
    -v        verbose output
    -V        display version information
    -4        search IPv4 sockets only
    -6        search IPv6 sockets only
    -         reset options

  udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]</pre>
<p><strong>Notes: As you can see, fuser can be used in many different ways and features overlap in some areas with &#8216;ps&#8217; and &#8216;lsof&#8217;.  The main use for me is the ability to look in on what is currently running on filesystems and devices.</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=446&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/03/05/linuxsecurity-gathering-filesystemdevice-and-port-process-details-with-fuser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux: Generating Strong Passwords Using random/urandom</title>
		<link>http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/</link>
		<comments>http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 22:36:06 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[/dev/urandom]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[commaind line]]></category>
		<category><![CDATA[fold]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[random number]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[tr]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[urandom]]></category>

		<guid isPermaLink="false">http://blog.colovirt.com/?p=362</guid>
		<description><![CDATA[Generating Strong Passwords Using random/urandom<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=362&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Occasionally, I find myself logged into a system that does not have a random password application installed and do not want to go to the trouble of downloading one.  Below is the easiest processes that I have found to generate a pretty random password from any Linux variant.</p>
<p><strong>To begin, strait from the Linux man page:</strong></p>
<p>/dev/random<br />
When  read,  the /dev/random device will only return random bytes within the estimated number of bits of noise in the entropy pool.  /dev/random should be suitable for uses that need very high quality randomness  such  as  one-time  pad  or key generation.  When the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered.</p>
<p>/dev/urandom<br />
A read from the /dev/urandom device will not block waiting for more entropy.  As a result, if there is not sufficient  entropy in the entropy pool, the returned values are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver.  Knowledge of how to do this is not available in  the  current  non-classified literature,  but it is theoretically possible that such an attack may exist.  If this is a concern in your appli‐cation, use /dev/random instead.</p>
<p>So basically, using /dev/random results in the <strong>strongest</strong> and most random characters.  Only downfall is the wait needed unless you have a lot of noise or specific hardware to accelerate the process.</p>
<p><strong>* I tested a cut and paste from this page and some of the lines did not work correctly due to either the CSS or WordPress doing something weird with the &#8216; and ` symbols.  So if one of the strings do not work for you, try deleting the &#8216; and adding it back in.</strong></p>
<p><strong>Creating random passwords which contains no special characters, is 10 characters long and displays 4</strong></p>
<pre>$ cat /dev/urandom| tr -dc 'a-zA-Z0-9' | fold -w 10| head -n 4
z4w7RENNIn
ZOYg80cuQx
Kgm6IrS5wc
F741uiEXl6<strong></strong></pre>
<p><strong>Creating passwords which DO contain special characters, and is 12 characters long.  The grep at the end might seem a little redundant, but depending on how short your character length is (using fold), urandom will result in stings with no special characters.  Grep keeps that from happening here.</strong></p>
<pre>$ cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&amp;*()_+{}|:&lt;&gt;?='|fold -w 12| head -n 4| grep -i '[!@#$%^&amp;*()_+{}|:&lt;&gt;?=]'
a(PYY5oid#2Z
&gt;s#e)C5Kl=kc
63r)WBt9Y)^J
2_a5RLJV&lt;CZH</pre>
<p><span id="more-362"></span></p>
<p><strong>Below shows just how quick it is to use &#8216;urandom&#8217;</strong></p>
<pre>$ time cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&amp;*()_+{}|:&lt;&gt;?='|fold -w 12| head -n 4| grep -i '[!@#$%^&amp;*()_+{}|:&lt;&gt;?=]'
GiTG=JUu?OEN
UOAzoyQ:p&gt;TQ
fQVa8@&amp;wytnQ
$PaMT*70z|fh

real    <strong>0m0.158s</strong>
user    0m0.028s
sys    0m0.048s</pre>
<p><strong>Now for better randomness we will use /dev/random.  This takes a lot longer on anything thats not server grade, or has special hardware.</strong></p>
<pre>$ time cat /dev/random| tr -dc 'a-zA-Z0-9-_!@#$%^&amp;*()_+{}|:&lt;&gt;?=' |fold -w 10| head -n 1| grep -i '[!@#$%^&amp;*()_+{}|:&lt;&gt;?=]'

}&gt;71Bw_DjN

real    <strong>25m47.473s</strong>
user    0m0.032s
sys    0m0.172s</pre>
<p>I tested this with /dev/random while writing the blog.  On this old laptop hardware, I was able to generate <strong>one 10 character string</strong> about every <strong>20-30 minute</strong>s.<br />
<strong><br />
Now these stats were collected from a crappy laptop running Ubuntu.  Specs as follows:</strong></p>
<pre># cat /proc/cpuinfo
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 9
model name    : Intel(R) Pentium(R) M processor 1500MHz</pre>
<p>and 2 gigs of ram.</p>
<p><strong>If you haven&#8217;t caught on to the command string, the following can be modified to meet your standards:</strong></p>
<p><strong></strong>- &#8220;<strong>tr -dc &#8216;a-zA-Z0-9-_!@#$%^&amp;*()_+{}|:&lt;&gt;?=&#8217;</strong>&#8221; any range or character can be removed.  I know some auth systems are not compatible with some characters<br />
- &#8220;<strong>fold -w 10</strong>&#8221; this is the length cut off point of the string to be generated.  Increase or decrease for more or less characters.<br />
- &#8220;<strong>head -n 4</strong>&#8221; just pulls four results.  If more or less is needed, modify this number.<br />
<strong>Notes:    Yes, I know this is pseudo-random.  For the majority of people, using urandom will work just fine.  If not, /dev/random is a lot better.  To reach the best level, you can try using feeds from external sources.  People have used anything from external antennas, webcams, to nuclear decay<br />
</strong><br />
<a title="Wikipedia Article" href="http://en.wikipedia.org/wiki/Hardware_random_number_generator" target="_blank">Wikipedia article</a></p>
<p><a title="Random number service" href="http://random.org/" target="_blank">random.org</a></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/362/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=362&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Splunk: Port is already bound</title>
		<link>http://blog.colovirt.com/2008/11/18/splunk-port-is-already-bound/</link>
		<comments>http://blog.colovirt.com/2008/11/18/splunk-port-is-already-bound/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 15:55:16 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[-9]]></category>
		<category><![CDATA[8000]]></category>
		<category><![CDATA[8089]]></category>
		<category><![CDATA[already bound]]></category>
		<category><![CDATA[bound]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[license]]></category>
		<category><![CDATA[LinedIn]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[lsof -i]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[splunk]]></category>
		<category><![CDATA[splunkd]]></category>
		<category><![CDATA[splunkweb]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=274</guid>
		<description><![CDATA[Splunk: Port is already bound<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=274&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After installing a new license key for Splunk, the next step is to restart the Splunk service.  I did so from the web interface for Splunk and it eventually timed out.</p>
<p><strong>I tried to stop the service via splunk command line, but that failed.</strong><br />
[user@splunk ~]# /opt/splunk/bin/splunk stop<br />
splunkweb is not running.                                <strong> [FAILED]</strong><br />
Stopping splunkd. This can take a few minutes.  Please be patient&#8230;<br />
&#8230; still shutting down &#8230;<br />
&#8230; still shutting down &#8230;</p>
<p><strong>I used ctrl+c to cancel the &#8220;splunk stop&#8221; since it was not getting anywhere.  A ps reveals that splunk is still currently running</strong><br />
[user@splunk ~]# ps -auxc | grep splunk<br />
user      9409 75.9 30.0 386256 154812 ?       Sl   10:09   0:55 splunkd<br />
user      9410  0.3  0.2  15172  1464 ?        Ss   10:09   0:00 splunkd<br />
user      9429  0.0  0.1  15172   576 ?        S    10:09   0:00 splunkd<br />
user      9604 13.2  3.1  63188 16184 ?        RNs  10:09   0:06 splunk-optimize<br />
user      9873 11.0  4.9  30552 25668 ?        RNs  10:10   0:03 splunk-optimize<br />
user      9963  9.3  5.9  56124 30804 ?        RNs  10:10   0:00 splunk-optimize</p>
<p><span id="more-274"></span><strong>Killed the process using -9</strong><br />
[user@splunk ~]# kill -9 9409</p>
<p><strong>Went to restart Splunk and it failed</strong><br />
[user@splunk ~]# /opt/splunk/bin/splunk start<br />
splunkd 9409 was not running.<br />
Stopping splunk helpers. This can take a few minutes.  Plea[  OK  ]tient&#8230;<br />
Stopped helpers.<br />
Removing stale pid file&#8230; done.<br />
Checking prerequisites&#8230;<br />
Checking <strong>http port [8000]: already bound</strong><br />
ERROR: <strong>The http port [8000] is already bound</strong>.  Splunk needs to use this port.<br />
Would you like to change ports? [y/n]:</p>
<p><strong>Ok, so something still currently has the port bound.  Lets find out.  I used lsof to do so</strong><br />
[user@splunk ~]# lsof -i TCP:8000<br />
COMMAND  PID USER   FD   TYPE  DEVICE SIZE NODE NAME<br />
python  <strong>9521</strong> user   15u  IPv4 1867658       TCP *:irdmi (LISTEN)</p>
<p><strong>So it looks like splunk stats a python listener to grab the incoming HTTP requests.  Time to kill that also</strong><br />
[user@splunk ~]# kill -9 9521</p>
<p><strong>This time the restart works and the system is back online with the new license.</strong><br />
[user@splunk ~]# /opt/splunk/bin/splunk start<br />
Checking prerequisites&#8230;<br />
Checking http port [8000]: <strong>open</strong><br />
Checking mgmt port [8089]: <strong>open</strong><br />
Verifying configuration.  This may take a while&#8230;<br />
Finished verifying configuration.<br />
Checking index directory&#8230;<br />
Verifying databases&#8230;<br />
Verified databases: _audit, _blocksignature, _internal, _thefishbucket, history, mail, main, sampledata, splunklogger, summary</p>
<p>Checking for SELinux.<br />
Checking index files<br />
All index checks passed.<br />
All preliminary checks passed.<br />
Starting splunkd&#8230;                                        [  OK  ]<br />
PID <strong>9521 was not running.  removing stale pid file&#8230; done.</strong><br />
Starting splunkweb&#8230;                                      [  OK  ]<br />
Splunk Server started.</p>
<p>The Splunk web interface is at https://splunk.x.com:8000<br />
If you get stuck, we&#8217;re here to help.  Feel free to email us at &#8216;support@splunk.com&#8217;.<strong><br />
</strong></p>
<p><strong>Note:  I love lsof to locate what process is bound to a port.  I will be doing a blog just on troubleshooting with lsof soon.</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/274/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=274&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2008/11/18/splunk-port-is-already-bound/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux/NetApp: NFS (NetApp) Fstab Mount</title>
		<link>http://blog.colovirt.com/2008/11/12/nfs-netapp-fstab-mount/</link>
		<comments>http://blog.colovirt.com/2008/11/12/nfs-netapp-fstab-mount/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 11:13:43 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[chgrp]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[fstab]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[netapp]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=207</guid>
		<description><![CDATA[The following details how to map an NFS point, this case to a Netapp, using fstab<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=207&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>The following details how to map an NFS point, this case to a Netapp, using fstab</strong></p>
<p><strong>Edit the fstab file.  In this example, 192.168.1.100 is the NFS, the NFS export to be mounted is /vol/dir1, and local directory to be mapped to is /dir1.  Next is the mount point type.  For details on the rest of the options, use &#8216;man nfs&#8217; from the command line.</strong><br />
# vi /etc/fstab<br />
192.1.1.100:/vol/dir1  /dir1                   nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,nfsvers=3,timeo=600,actimeo=0 0 0</p>
<p><strong>Create the local directory</strong><br />
# mkdir /dir1/</p>
<p><strong>Mount always searches /etc/fstab if just a label (/dir1) is passed to it.  Here, it found the entry in fstab and mounted it.</strong><br />
# mount /dir1/</p>
<p><strong>Using df to verify that mount did connect the NFS point</strong><br />
# df -h | grep dir<br />
192.1.1.100:/vol/dir1<br />
32G   96K   32G   1% /dir1</p>
<p><strong>Move into the mount point</strong><br />
# cd /dir1</p>
<p><strong>In this example, the local group luser needs to have full access to the share.  Below shows the changing of ownership from root to luser.</strong><br />
# chgrp luser .</p>
<p><strong>Switch to the user luser1, who is also in the luser group</strong><br />
# su &#8211; luser1</p>
<p><strong>Move into the new NFS mount point</strong><br />
[luser1@x ~]$ cd /dir1/</p>
<p><strong>Create an empty file to test write access</strong><br />
[luser1@x dir1]$ touch asdf</p>
<p><strong>Use ls to make sure the file exists.</strong><br />
[luser1@x dir1]$ ls<br />
asdf</p>
<p><strong>Logout of luser since testing is done.</strong><br />
[luser1@x  /]$ exit<br />
logout</p>
<p><strong>Note: The title of this is NFS (NetApp) Fstab Mount because technically this should work for any NFS mount point, not just a NetApp one.</strong></p>
<br />Posted in Linux, NAS, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=207&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2008/11/12/nfs-netapp-fstab-mount/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux Awk, Sort, and Uniq Log Searching</title>
		<link>http://blog.colovirt.com/2008/11/11/linux-awk-sort-and-uniq-log-searching/</link>
		<comments>http://blog.colovirt.com/2008/11/11/linux-awk-sort-and-uniq-log-searching/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 19:03:29 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[hit count]]></category>
		<category><![CDATA[hits]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[searching]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[top talkers]]></category>
		<category><![CDATA[uniq]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=223</guid>
		<description><![CDATA[Linux Awk, Sort, and Uniq Log Searching<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=223&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have used awk to aide in log parsing for a few years now.  A few years back, I managed HIGH traffic DNS and mail spooling servers at a telecom.  This made it very difficult for a home grown network IDS box to keep track of everything, due to high throughput.  Occasionally, something would get through that would cause latency on the cluster.  Normally this was someones DNS forwarding server that hung and blasted 5k queries a second to the DNS pool.  So, this meant command line troubleshooting.  The following is just an example of using the command strings to check an Apache log.</p>
<p><strong>Move to the log directory</strong><br />
# cd /IBM/HTTPServer/logs/</p>
<p><strong>This server does a decent amount of traffic.  The following pulls out all the hits from Nov 11 (about 4 hours worth from system clock) and dumps them to novaccess file.</strong><br />
# cat access_log | grep &#8220;11/Nov/2008&#8243; &gt; novacces</p>
<p><strong>Now we look into novaccess.  The following views the file using cat, passes the data over to awk.</strong> Awk prints off only the first data of the file using &#8220;print $1&#8243;, which is the connecting IP address.  From there, its handed over to uniq to count the number of occurrences for each IP and prefix the resulting number to each IP address.  That information is handed over to sort using -g to compare according to general numerical value, and &#8220;r&#8221; to reverse the order.  Reversing is used to display the IPs with the highest count first, as not to scroll 100 pages.  Besides, who cares about the one hitters?</p>
<p># cat novacces| awk &#8216;{print $1}&#8217; | uniq -c | sort -gr | more<br />
170 217.x.x.90<br />
142 172.x.x.124<br />
120 172.x.x.124<br />
92 172.x.x.124<br />
89 172.x.x.124<br />
88 172.x.x.124<br />
87 172.x.x.124<br />
85 217.x.x.90<br />
85 172.x.x.124<br />
82 172.x.x.124<br />
81 51.x.x.186</p>
<p><strong>I clipped off after this since I am only concerned with the higher numbers.  This query actually resulted in about 700  uniq lines.</strong></p>
<p><strong>Here is an example of what the file actually contained</strong><br />
# more novacces<br />
127.x.x.92 &#8211; - [11/Nov/2008:00:00:03 +0000] &#8220;POST /servlet/heartbeat HTTP/1.1&#8243; 200 76<br />
255.x.x.109 &#8211; - [11/Nov/2008:00:00:05 +0000] &#8220;POST /servlet/heartbeat HTTP/1.1&#8243; 200 76<br />
255.x.x.189 &#8211; - [11/Nov/2008:00:00:15 +0000] &#8220;POST /servlet/heartbeat HTTP/1.1&#8243; 200 76</p>
<p><strong>Note: In awk, print $ can be incremented up to see other fields from the file.  Also, remember all IPs are always changed/modified in my posts.  So this means I do know that 255.x.x.x is not a valid IP address.  Awk,uniq,more, and sort are all standard utilities provided by most *nix installations.</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=223&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2008/11/11/linux-awk-sort-and-uniq-log-searching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>VMWare and Sudo</title>
		<link>http://blog.colovirt.com/2008/11/03/vmware-and-sudo/</link>
		<comments>http://blog.colovirt.com/2008/11/03/vmware-and-sudo/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 17:23:06 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[esx]]></category>
		<category><![CDATA[nopasswd]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[root privileges]]></category>
		<category><![CDATA[su]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[sudoers]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=180</guid>
		<description><![CDATA[Setting up sudo access for command line users in VMWare ESX<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=180&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Below is how to setup sudo access for users on VMWare ESX servers.  This is standard for any Linux distribution.  Just for reference, VMWare ESX v* runs on top of Redhat Linux.</p>
<p>[___ @vm]# cat /etc/redhat-release<br />
<strong>Red Hat Enterprise Linux ES release 3 (Taroon)</strong></p>
<p><strong>First, su to root</strong><br />
[user@vm03 user]$ su -<br />
Password:</p>
<p><strong>Next, edit /etc/sudoers</strong><br />
[___ @vm]# vi /etc/sudoers</p>
<p><strong>For an individual user, add the following</strong><br />
user ALL=(ALL) ALL</p>
<p><strong>Or you can setup a group and all users within will inherit sudo rights</strong><br />
%admins        ALL=(ALL)       ALL</p>
<p>Save the configuration with vi hit escape then type &#8220;:wq!&#8221; and enter.</p>
<p><strong>Test</strong><br />
[user@vm03 user]$ sudo su -<br />
Password:<br />
[vm]# whoami<br />
root</p>
<p><strong>Note: This will allow the user to become or execute commands as root without needing to know the root password.  Still, the user will be prompted for their password when they use sudo.  More granular access is possible allowing users to execute only specific commands.  If you want to bypass all password authentication (not a good idea) for sudo access, you can use NOPASSWD.</strong></p>
<p>user  ALL=(ALL)       NOPASSWD: ALL</p>
<br />Posted in Linux, Security, VMWare  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=180&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2008/11/03/vmware-and-sudo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
		<item>
		<title>Restricting SFTP (jail/chroot)</title>
		<link>http://blog.colovirt.com/2008/10/24/restricting-sftp-jailchroot/</link>
		<comments>http://blog.colovirt.com/2008/10/24/restricting-sftp-jailchroot/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 05:19:14 +0000</pubDate>
		<dc:creator>Kevin Goodman</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[jail]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[make jail]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[scponly]]></category>
		<category><![CDATA[setup chroot]]></category>
		<category><![CDATA[setup_chroot.sh]]></category>
		<category><![CDATA[sftp jail]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://colovirt.wordpress.com/?p=119</guid>
		<description><![CDATA[This is an installation reference for setting up jailed (chroot) sftp accounts.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=119&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>This is an installation reference for setting up jailed (chroot) sftp accounts.</strong></p>
<p>Two common options exist for creating a chrooted environment to restrict SFTP users from traversing outside of their home directories. The first is compiling Open ssh from scratch and replacing the SFTP and one other executable with third party software. This would be a nightmare for patching/upgrading the ssh distribution. The second method, and the one this will be referencing from now on is Scponly. This script acts as a replacement shell that is executed after the standard SSH daemon authenticates the users account, avoiding any custom scripting of the OpenSSH distribution. Since scponly is a replacement shell, it is not a global change to all accounts. This allows the system administrator to pick and choose what with be chrooted.</p>
<p><strong>Installation</strong><br />
Log into the system as root and follow these directions:</p>
<pre>
# mkdir /build
# cd /build
# wget http://internap.dl.sourceforge.net/sourceforge/scponly/scponly-4.8.tgz
# gunzip -d scponly-4.8.tgz
# tar -xvf scponly-4.8.tar
# cd cd scponly-4.8
# ./configure --enable-chrooted-binary --disable-scp-compat --disable-winscp-compat --disable-wildcards
# make ; make install
# echo /usr/local/sbin/scponlyc &gt;&gt; /etc/shells
# either type 'make jail' or execute './setup_chroot.sh'</strong>
</pre>
<p>The two commands &#8216;make jail&#8217; and &#8216;./setup_chroot.sh&#8217; with walk you through creating a jailed user account. The script will automatically create the users home directory and copy over all required libraries. After the script finishes, the following directories will be present:</p>
<pre>
/usr
/lib
/incoming
/etc
</pre>
<p>The only writable (where users will put data) directory is the /incoming folder (by default). The other directories including the chrooted ‘/’ (root) directory are all in the users chroot environment and are not writable by the individual user. Incoming directory will not show up if the &#8220;writable sub directory&#8221; option was changed from the default when running &#8216;make jail&#8217; or &#8216;./setup_chroot.sh&#8217;</p>
<p><strong>Note:  Again, this is done in a way that ssh can be upgraded and or patched without affecting the sftp jail.  Definitely want to avoid the headache of manual patching of systems and keeping track of the &#8220;one off&#8221; configurations.</strong></p>
<br />Posted in Linux, Security  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/colovirt.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/colovirt.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/colovirt.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.colovirt.com&amp;blog=5256186&amp;post=119&amp;subd=colovirt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.colovirt.com/2008/10/24/restricting-sftp-jailchroot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Kevin Goodman</media:title>
		</media:content>
	</item>
	</channel>
</rss>
