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

<channel>
	<title>Phine Solutions &#187; security</title>
	<atom:link href="http://www.phinesolutions.com/topics/server-setup/security/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phinesolutions.com</link>
	<description>A web log for web work</description>
	<lastBuildDate>Wed, 30 Jun 2010 16:23:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Authentication using .htaccess</title>
		<link>http://www.phinesolutions.com/create-authentication-using-htaccess.html</link>
		<comments>http://www.phinesolutions.com/create-authentication-using-htaccess.html#comments</comments>
		<pubDate>Mon, 15 Jan 2007 17:39:16 +0000</pubDate>
		<dc:creator>1.618</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.phinesolutions.com/create-authentication-using-htaccess.html</guid>
		<description><![CDATA[It is quite easy to create web server access restriction using the Cpanel. There is a configuration setting for &#34;Password Protect Directories&#34; in Cpanel for setting up a user name and password for directory access. What this really does is to create a password file and refer it in the .htaccess.
In stead of using Cpanel, [...]]]></description>
			<content:encoded><![CDATA[<p>It is quite easy to create web server access restriction using the Cpanel. There is a configuration setting for &quot;Password Protect Directories&quot; in Cpanel for setting up a user name and password for directory access. What this really does is to create a password file and refer it in the .htaccess.</p>
<p>In stead of using Cpanel, one can always run the process through the command line and it may actually be easier.</p>
<p><u><strong>Create the passwd file</strong></u></p>
<p>htpasswd is an Apache utility command to create and update the flat-files used to store usernames and password for basic authentication of HTTP users. Since it will create name and password pair(s) in a flat file, the password is encrypted either using a MD5 version from Apache or crypt() system call.</p>
<p>The following command line can be used to generate a file name passwdfile:</p>
<blockquote><p>htpasswd -c /home/user/etc/passwdfile admin</p></blockquote>
<p>his will create a NEW passwdfile and add user &quot;admin&quot; in it. The command will also prompt for the password that you wish to give to this user. </p>
<p>To add a new user, the &quot;-c&quot; option cannot be used.</p>
<p>To remove a user, simply open the htpasswd file and delete the line. </p>
<p><u><strong>Modify .htaccess </strong></u></p>
<p>To turn the password into effect, you can add&nbsp; the following lines in the .htacess file:</p>
<blockquote><p>AuthType Basic<br />AuthName &quot;Restricted Area&quot;<br />AuthUserFile &quot;/home/user/etc/passwdfile&quot;<br />require valid-user</p></blockquote>
<p>This will allow anyone in the .htpasswd file to have access.</p>
<p>Besides the flat text password file, one can also use alternate password storage such as DBM or DBD format according to Apache document.</p>
<p><u><strong>Group the users</strong></u></p>
<p>There maybe situations that there are a lot of users and they are granted access to different resources. It maybe easier to group the users instead of creating a bunch of .htpasswd files.</p>
<p>A group file is simply a flat file that contains some user names. An admin group file (let&#39;s call it admingroup) may look like this:</p>
<blockquote><p>Admin: admin jdoe mjones</p></blockquote>
<p>And the .htaccess should include the following: </p>
<blockquote><p>AuthType Basic<br />AuthName &quot;Admin Group Only&quot;<br />AuthUserFile &quot;/home/user/etc/htpasswd&quot; &quot;/home/user/etc/.dmingroup&quot;<br />Require group Admin</p></blockquote>
<p>&nbsp;</p>
<p>As specified in .htaccess, this is really just a &quot;basic&quot; way for authentication. It is most suitable for a small group of users to access some resource and there is no need to create more sophisticated authenticated method.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phinesolutions.com/create-authentication-using-htaccess.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup ssh access using public and private key authentication</title>
		<link>http://www.phinesolutions.com/ssh-using-publicprivate-key-authentication.html</link>
		<comments>http://www.phinesolutions.com/ssh-using-publicprivate-key-authentication.html#comments</comments>
		<pubDate>Sat, 13 Jan 2007 15:24:01 +0000</pubDate>
		<dc:creator>1.618</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.phinesolutions.com/ssh-using-publicprivate-key-authentication.html</guid>
		<description><![CDATA[If you own a Linux box and use ssh to access it over the internet, chances that it will be under unauthorized login attempt or even brute-force attack. Even you have a strong password for your account, the constant poking from people or evil-bot is some kind of a nuisance to say the least.
Messages like [...]]]></description>
			<content:encoded><![CDATA[<p>If you own a Linux box and use ssh to access it over the internet, chances that it will be under unauthorized login attempt or even brute-force attack. Even you have a strong password for your account, the constant poking from people or evil-bot is some kind of a nuisance to say the least.</p>
<p>Messages like below in /var/log/secure shows how annoying they can be:  </p>
<p>Nov 25 23:13:21 &#8212;- sshd[21529]: input_userauth_request: invalid user test7 </p>
<p>Nov 25 18:13:21 &#8212;- sshd[21523]: reverse mapping checking getaddrinfo for h63-210-66-233.seed.net.tw failed &#8211; POSSIBLE BREAKIN ATTEMPT!  </p>
<p>Nov 25 23:13:30 &#8212;- sshd[21607]: input_userauth_request: invalid user test8 </p>
<p>Nov 25 18:13:30 &#8212;- sshd[21602]: reverse mapping checking getaddrinfo for h63-210-66-233.seed.net.tw failed &#8211; POSSIBLE BREAKIN ATTEMPT! </p>
<p>To fully utilize the capability that ssh offers, we should always use public/private key access to a *nix box that is running OpenSSH. Below are some simple steps I used to implement this methodology.</p>
<p>Since I am using PuTTY, the setup and testing are done using putty.exe and puttygen.exe that are downloaded from <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">here</a>. </p>
<p><strong>1. Create public and private key pair.</strong>  </p>
<p>This can be accomplished using PuTTYgen. Once the program is started, click on the &quot;Generate&quot; button and keep moving your mouse. You can&#39;t be lazy here because the it will not proceed until you make your move.</p>
<p>  <img src="http://www.phinesolutions.com/wp-content/uploads/2006/11/screen-1.gif" border="0" alt="Generate public/private key" title="Generate public/private key" />  </p>
<p><strong>2. save the public and private keys</strong>  </p>
<p>Once the keys are generated, you need to create a key comment and your private passphrase. The passphrase is tied to your keys so without it your keys are useless. The public key is basically plain text that shows in the box. The private key is in binary form and should be stored with a .ppk extension.</p>
<p>  <img src="http://www.phinesolutions.com/wp-content/uploads/2006/11/screen-2.gif" border="0" />  </p>
<p><strong>3. place the public key</strong>  </p>
<p>The public key needs to be stored in the Linux server as $HOME/.ssh/authorized_key2. Since it is plain text you can copy the key from the previous screen and paste them in a Linux editor and save it.  An <strong>IMPORTANT</strong> step is to set the right permission on $HOME, $HOME/.ssh or $HOME/.ssh/authorized_keys so they aren&#39;t more permissive than sshd allows by default, which means they can only be read and write by the current account.</p>
<p> The following command can be used to achieve this:  <em>$ chmod go-w $HOME $HOME/.ssh $ chmod 600 $HOME/.ssh/authorized_keys</em>  </p>
<p><strong>4. place the private key</strong>  </p>
<p>In PuTTY, you will need to load the private key to your PuTTY session and save the session:</p>
<p>  <img src="http://www.phinesolutions.com/wp-content/uploads/2006/11/screen-3.gif" border="0" />  </p>
<p>After this step, yu should be able to try the newly configured ssh access. You should be asked to enter the passphase this time, instead of the password. Once this is verified, you can proceed to next step.  </p>
<p>&nbsp;<br /><strong>5. turn off the password authentication on OpenSSH</strong>  </p>
<p>In the /etc/ssh/sshd_config, there is an option called &quot;<strong>PasswordAuthentication</strong>&quot;, just set it to &quot;no&quot;.</p>
<p>Restart sshd and you should be running more secured ssh now.</p>
<p>Even you are running more securely after these measures, you still can&#39;t stop people from scanning port 22 and trying to get authenticated repeatedly using a list of user name and password. To reduce this kind of noise, you can also change the running port of sshd. The port configuration is the first parameter in the /etc/ssh/ssh_config file.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.phinesolutions.com/ssh-using-publicprivate-key-authentication.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>writing secure PHP code</title>
		<link>http://www.phinesolutions.com/writing-secure-php-code.html</link>
		<comments>http://www.phinesolutions.com/writing-secure-php-code.html#comments</comments>
		<pubDate>Wed, 27 Dec 2006 15:01:13 +0000</pubDate>
		<dc:creator>1.618</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.phinesolutions.com/writing-secure-php-code.html</guid>
		<description><![CDATA[This is a great post about writing secure PHP code and part 2. The articles pretty much cover all the points we need to look at to write secure PHP code.
Additionally this post talks about how hackers can use Google code search and a simple sitemap to gain access to your system. 
]]></description>
			<content:encoded><![CDATA[<p>This is a great post about <a href="http://www.ilovejackdaniels.com/php/writing-secure-php/1/">writing secure PHP code</a> and <a href="http://www.ilovejackdaniels.com/php/writing-secure-php-2/1/">part 2</a>. The articles pretty much cover all the points we need to look at to write secure PHP code.</p>
<p>Additionally this post talks about how hackers can <a href="http://www.shoemoney.com/2006/12/26/how-hackers-are-using-google-to-pwn-your-site">use Google code search and a simple sitemap to gain access to your system</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.phinesolutions.com/writing-secure-php-code.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
