<?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>Derek Neely &#187; Unix</title>
	<atom:link href="http://derekneely.com/category/unix-references-and-resources/feed/" rel="self" type="application/rss+xml" />
	<link>http://derekneely.com</link>
	<description>...what I care to share...</description>
	<lastBuildDate>Thu, 06 Oct 2011 15:10:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Nginx (Mini How-to)</title>
		<link>http://derekneely.com/2009/10/nginx-mini-how-to/</link>
		<comments>http://derekneely.com/2009/10/nginx-mini-how-to/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 19:40:02 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[How-to]]></category>
		<category><![CDATA[Load balancer]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=440</guid>
		<description><![CDATA[Nginx (Engine-X) is a very light-weight powerful web proxy server and load balancer. This is a quick how-to on configuring a weighted load balancer using Nginx. I&#8217;ll skip past the installation on your system. Mine is currently running on an OpenBSD firewall using Packet Filter, and is how I will be covering the configuration. Nginx [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Nginx Home Page" href="http://wiki.nginx.org/Main" target="_blank"><img class="alignright size-full wp-image-311" title="Nginx" src="http://derekneely.com/wp-content/uploads/2009/06/nginx-logo.png" alt="Nginx" width="245" height="63" />Nginx</a> (Engine-X) is a very light-weight powerful web proxy server and load balancer. This is a quick how-to on configuring a weighted load balancer using Nginx. I&#8217;ll skip past the installation on your system. Mine is currently running on an OpenBSD firewall using Packet Filter, and is how I will be covering the configuration. Nginx is available and work on both Unix and Linux.</p>
<p>Configuring Nginx to start on system boot:</p>
<blockquote><p># vi /etc/rc.local</p>
<pre># start nginx
if [ -x /usr/local/sbin/nginx ]; then
   echo -n ' nginx'; /usr/local/sbin/nginx
fi</pre>
</blockquote>
<p>Load balance configuration (one public ip -&gt; 3 private servers):</p>
<blockquote><p># vi /etc/nginx/nginx.conf</p>
<pre>user  nobody;
worker_processes  2;
worker_rlimit_nofile 10240;

error_log  /var/log/nginx/error.log;

events {
   worker_connections  8192;
}

http {

   upstream  site {
        server 192.168.1.100:80 max_fails=2 fail_timeout=15 weight=3;
        server 192.168.1.101:80 max_fails=2 fail_timeout=15 weight=3;
        server 192.168.1.102:80 max_fails=2 fail_timeout=15 weight=1;
   }

   upstream  site_ssl {
        server 192.168.1.100:443 max_fails=2 fail_timeout=15 weight=3;
        server 192.168.1.101:443 max_fails=2 fail_timeout=15 weight=3;
        server 192.168.1.102:443 max_fails=2 fail_timeout=15 weight=1;
   }

   server {
        listen  AAA.BBB.CCC.DDD:80;

        location / {
             access_log off;
             proxy_connect_timeout 15;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_pass http://site;
        }
   }

   server {
        listen  AAA.BBB.CCC.DDD:443;

        ssl on;
        ssl_certificate /etc/ssl/ssl.cert/site.com.crt;
        ssl_certificate_key /etc/ssl/ssl.key/site.com.key;

        server_name site.com;

        location / {
             access_log off;
             proxy_connect_timeout 15;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X_FORWARDED_PROTO https;
             proxy_pass http://site_ssl;
        }
   }
}</pre>
</blockquote>
<p>Should you have a chain file you need to add it to the end of the certificate file as such:</p>
<blockquote><p># cat /path/to/chain.file &gt;&gt; /etc/ssl/ssl.cert/site.com.crt</p></blockquote>
<p>Packet Filter Firewall Rules:</p>
<blockquote><p># vi /etc/pf.conf</p>
<pre>site_ext="AAA.BBB.CCC.DDD"
site_int1="192.168.1.100"
site_int2="192.168.1.101"
site_int3="192.168.1.102"

pass in quick log on $ext_if inet proto tcp from any to $site_ext port 80 keep state
pass in quick log on $ext_if inet proto tcp from any to $corp_ext port 443 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int1 port 80 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int1 port 443 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int2 port 80 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int2 port 443 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int3 port 80 keep state
pass out quick log on $int_if inet proto tcp from any to $site_int3 port 443 keep state</pre>
</blockquote>
<p>Helpful Nginx server management commands:</p>
<p>Test Nginx Config file:</p>
<blockquote><p># nginx -t -c /etc/nginx/nginx.conf</p></blockquote>
<p>Restart Nginx server:</p>
<blockquote><p># kill -HUP `cat /var/run/nginx.pid`</p></blockquote>
<p>Stop Nginx server:</p>
<blockquote><p># kill -QUIT `cat /var/run/nginx.pid`</p></blockquote>
<p>If your like me and want to keep tabs on the load balancing (as in ipvsadm for Linux ldirectord) you can add a label to the end of each of your firewall rules:</p>
<blockquote><p>label &#8220;[some unique label for this rule]&#8221; (i.e. label &#8220;site-ext&#8221;)</p></blockquote>
<p>Then using pftop -v label you will see:</p>
<blockquote>
<pre>RULE LABEL           PKTS     BYTES     STATES MAX  ACTION   DIR
....
16   site-ext        867991   630495K   11833       Pass     In  ...
17   site-ext-ssl    29427    13315230  847         Pass     In  ...
18   site-int-1      13761450 6842062   813483      Pass     Out ...
19   site-int-1-ssl  234678   12345     12344       Pass     Out ...
....</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/10/nginx-mini-how-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun With Active/Passive FTP and a PF Firewall</title>
		<link>http://derekneely.com/2009/09/fun-with-activepassive-ftp-and-a-pf-firewall/</link>
		<comments>http://derekneely.com/2009/09/fun-with-activepassive-ftp-and-a-pf-firewall/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 17:58:22 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Active FTP]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Packet Filter]]></category>
		<category><![CDATA[Passive FTP]]></category>
		<category><![CDATA[PF]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=399</guid>
		<description><![CDATA[Here at work we&#8217;ve recently been moving off of a Linux/IPTables firewall setup to an OpenBSD/PF firewall. Well, anyone who has worked with firewalls knows the fun time you have with getting FTP to work through them. This includes client and server side. Well, this is my little &#8216;how-to&#8217; on doing just that with PF [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-281" title="OpenBSD" src="http://derekneely.com/wp-content/uploads/2009/06/openbsd.gif" alt="OpenBSD" width="168" height="140" />Here at work we&#8217;ve recently been moving off of a Linux/IPTables firewall setup to an OpenBSD/PF firewall. Well, anyone who has worked with firewalls knows the fun time you have with getting FTP to work through them. This includes client and server side. Well, this is my little &#8216;how-to&#8217; on doing just that with PF and PureFTP.</p>
<p>I originally started with <a title="PF: Issues with FTP" href="http://www.openbsd.org/faq/pf/ftp.html" target="_blank">this tutorial from OpenBSD</a> and was a good starting point but I felt it left out a few things.</p>
<p>First off. The tutorial above uses the ftp-proxy server on the box to allow proxying down to the ftp server. However, I didn&#8217;t exactly see any benefit of using it and didn&#8217;t seem to make anything easier. If I&#8217;m completely misunderstanding the usage of it please contact me and help me out. I DO want to do things right.</p>
<p>Here&#8217;s the overall layout of what is to happen:</p>
<blockquote><p>[Client] &lt;&#8212;&gt; [PF Firewall] &lt;&#8212;&gt; [FTP Server]</p></blockquote>
<p>Now, a few observations I&#8217;ve made while working with the firewall and maybe a bit clearer for others.</p>
<p>Here&#8217;s a great explanation of the overall FTP process from <a title="FTP Explained - Tech Republic" href="http://articles.techrepublic.com.com/5100-10878_11-5031026.html" target="_blank">Tech Republic</a>. Here&#8217;s the overall communication ports for the 2 different modes (as the PF firewall sees it &#8211; at least in my experience).</p>
<blockquote><p><strong>Active FTP:</strong><br />
-Inbound-<br />
&#8212; Authentication/Commands &#8212;<br />
Incoming:  21 (External interface &#8211; FW)<br />
Outgoing: 21 (Internal interface &#8211; FW)<br />
Incoming: 21 (FTP Server Interface)</p>
<p>-Outbound-<br />
&#8212; Data Transfer &#8212;<br />
Outgoing: &gt; 30000 (FTP Server Interface)<br />
Outgoing: &gt; 30000 (External interface &#8211; FW)</p>
<p><strong>Passive FTP:</strong><br />
-Inbound-<br />
&#8212; Authentication/Commands &#8212;<br />
Incoming:  21 (External interface &#8211; FW)<br />
Outgoing: 21 (Internal interface &#8211; FW)<br />
Incoming: 21 (FTP Server Interface)<br />
&#8212; Data Transfer &#8212;<br />
Incoming:  49000-51000 (External interface &#8211; FW)<br />
Outgoing: 49000-50000 (Internal interface &#8211; FW)<br />
Incoming: 49000-50000 (FTP Server Interface)</p>
<p>-Outbound-<br />
Outgoing: 49000-50000 (FTP Server Interface)<br />
Outgoing: 49000-50000 (External interface &#8211; FW)</p></blockquote>
<p>Alright enough chat and on to the code. First we need to configure the ftp server. In the  below examples I&#8217;ll cover PureFTP and ProFTPd for just the primary pieces of passive port configuration (I&#8217;ll give a nice ProFTP advanced configuration in a post to come). We&#8217;ll also assume the default &#8216;listening&#8217; port 21 of any standard FTP install/configuration. This is also on a Gentoo server so modify accordingly for your given distro.</p>
<p><strong>PureFTPd:</strong></p>
<blockquote><p>MISC_OTHER=&#8221;[various options/flags] -p 49000:51000 -P [Public IP]&#8220;</p></blockquote>
<p><strong>ProFTPd:</strong></p>
<blockquote><p>PassivePorts 49000 51000<br />
MasqueradeAddress [Public IP]</p></blockquote>
<p><strong>PF Firewall Rules:</strong> (Just the FTP Rules)</p>
<blockquote><p># Interface Definitions:<br />
ftp_ext=&#8221;[Public IP]&#8221;<br />
ftp_int=&#8221;[Private IP]&#8221;</p>
<p># NAT Rules<br />
nat on $ext_if from { $ftp_int } to any -&gt; $ftp_ext</p>
<p># Redirect Rules<br />
rdr pass on $ext_if inet proto tcp from any to $ftp_ext port 21 -&gt; $ftp_int port 21<br />
rdr pass on $ext_if inet proto tcp from any to $ftp_ext port 49000:51000 -&gt; $ftp_int</p>
<p># Firewall Rules<br />
pass out quick on $ext_if inet proto tcp from $ftp_ext to any port &gt; 1024 keep state</p>
<p>pass out quick log on $int_if inet proto tcp from any to $ftp_int port 21 keep state tag FTP label &#8220;ftp&#8221;<br />
pass out quick log on $int_if inet proto tcp from any to $ftp_int port 49000:51000 keep state tag FTP_PASV label &#8220;ftp-passive&#8221;</p></blockquote>
<p>That should be all you need for the PF rules and configuration on the FTP servers to get everything working and passing through. Feel free to contact me should you have any additional fixes or have a good explanation of how the ftp-proxy works and benefits of. I&#8217;ve just gotta find the time to do some experimenting.</p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/09/fun-with-activepassive-ftp-and-a-pf-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pure-FTP with Database Authentication</title>
		<link>http://derekneely.com/2009/07/pure-ftp-with-database-authentication/</link>
		<comments>http://derekneely.com/2009/07/pure-ftp-with-database-authentication/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 12:35:18 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Pure-FTP]]></category>
		<category><![CDATA[User Accounts]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=374</guid>
		<description><![CDATA[Pure-FTP is  a powerful ftp server. If you are like me however, you don&#8217;t like to create system accounts for each individual user. Well, this is where we are in luck! Pure-FTP has the ability to tie into both PostgreSQL and MySQL.  In this example I have tied it into a PostgreSQL database. I will [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-284" title="Linux" src="http://derekneely.com/wp-content/uploads/2009/06/linux.jpg" alt="Linux" width="113" height="142" />Pure-FTP is  a powerful ftp server. If you are like me however, you don&#8217;t like to create system accounts for each individual user. Well, this is where we are in luck! Pure-FTP has the ability to tie into both PostgreSQL and MySQL.  In this example I have tied it into a PostgreSQL database. I will also include the MySQL snippet of the configuration but it hasn&#8217;t been tested by me. Also note that this is a Gentoo based installation but the general configuration should be the same.</p>
<p>Install Pure-FTP with MySQL and/or PostgreSQL support:</p>
<blockquote><p># &gt; vi /etc/make.conf<br />
&#8211; add &#8216;postgres&#8217; and/or &#8216;mysql&#8217; to the USE flag or:</p>
<p>#&gt; USE=&#8221;mysql postgres&#8221; emerge -av net-ftp/pure-ftpd</p></blockquote>
<p>Now that Pure-FTP is installed with the various database support, we can configure Pure-FTP to authenticate off of a database. You may need to tailor the SQL queries to match the schema of your database.</p>
<p>PostgreSQL:</p>
<blockquote><p>#&gt;  vi /etc/pureftpd-pgsql.conf</p>
<p># If PostgreSQL listens to a TCP socket<br />
PGSQLServer localhost<br />
PGSQLPort 5432<br />
# *or* if PostgreSQL can only be reached through a local Unix socket<br />
# PGSQLServer /tmp<br />
# PGSQLPort .s.PGSQL.5432<br />
# Mandatory : user to bind the server as.<br />
PGSQLUser [pureftpd]<br />
# Mandatory : user password. You *must* have a password.<br />
PGSQLPassword [pureftpd_password]<br />
# Mandatory : database to open.<br />
PGSQLDatabase [pureftpd_database]<br />
# Mandatory : how passwords are stored<br />
# Valid values are : &#8220;cleartext&#8221;, &#8220;crypt&#8221;, &#8220;md5&#8243; and &#8220;any&#8221;<br />
#PGSQLCrypt cleartext<br />
PGSQLCrypt crypt</p>
<p># In the following directives, parts of the strings are replaced at<br />
# run-time before performing queries :<br />
#<br />
# \L is replaced by the login of the user trying to authenticate.<br />
# \I is replaced by the IP address the user connected to.<br />
# \P is replaced by the port number the user connected to.<br />
# \R is replaced by the IP address the user connected from.<br />
# \D is replaced by the remote IP address, as a long decimal number.<br />
#<br />
# Very complex queries can be performed using these substitution strings,<br />
# especially for virtual hosting.<br />
# Query to execute in order to fetch the password<br />
PGSQLGetPW SELECT password FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
# Query to execute in order to fetch the system user name or uid<br />
PGSQLGetUID SELECT uid FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
# Optional : default UID &#8211; if set this overrides PGSQLGetUID<br />
#PGSQLDefaultUID 1000<br />
# Query to execute in order to fetch the system user group or gid<br />
PGSQLGetGID SELECT gid FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
# Optional : default GID &#8211; if set this overrides PGSQLGetGID<br />
#PGSQLDefaultGID 1000<br />
# Query to execute in order to fetch the home directory<br />
PGSQLGetDir SELECT dir FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
#########OPTIONAL SETTINGS#############<br />
# Optional : query to get the maximal number of files<br />
# Pure-FTPd must have been compiled with virtual quotas support.<br />
# PGSQLGetQTAFS SELECT QuotaFiles FROM users WHERE User=&#8217;\L&#8217;<br />
# Optional : query to get the maximal disk usage (virtual quotas)<br />
# The number should be in Megabytes.<br />
# Pure-FTPd must have been compiled with virtual quotas support.<br />
# PGSQLGetQTASZ SELECT QuotaSize FROM users WHERE User=&#8217;\L&#8217;<br />
# Optional : ratios. The server has to be compiled with ratio support.<br />
PGSQLGetRatioUL SELECT ul_ratio FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
PGSQLGetRatioDL SELECT dl_ratio FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
# Optional : bandwidth throttling.<br />
# The server has to be compiled with throttling support.<br />
# Values are in KB/s .<br />
PGSQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;<br />
PGSQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;</p></blockquote>
<p>Now we need to modify the pure-ftpd config file (keep in mind this is Gentoo)</p>
<blockquote><p>#&gt; vi /etc/conf.d/pure-ftpd</p>
<p>Look for the line: AUTH=&#8221;-l unix&#8221; and change to:</p>
<p>AUTH=&#8221;-l pgsql:/etc/pureftpd-pgsql.conf</p>
<p>#&gt; /etc/init.d/pure-ftpd restart</p></blockquote>
<p>This should conclude your intstallation of Pure-FTP with Postgres database support.</p>
<p>MySQL Config File:</p>
<blockquote><p>Coming Soon!</p></blockquote>
<p>A couple of little tweaks that I&#8217;ve had to use for some of the configurations.</p>
<p>If you want all users to go to the same directory and don&#8217;t have or want to store the directory information in the database you can change this line in the pureftpd-pgsql.conf:</p>
<blockquote><p>PGSQLGetDir SELECT &#8216;/home/ftpdir&#8217; FROM ftp_users WHERE ftp_user=&#8217;\L&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/07/pure-ftp-with-database-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx &#8211; failed (13: Permission denied) while reading upstream</title>
		<link>http://derekneely.com/2009/06/nginx-failed-13-permission-denied-while-reading-upstream/</link>
		<comments>http://derekneely.com/2009/06/nginx-failed-13-permission-denied-while-reading-upstream/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 11:03:12 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Permission denied]]></category>
		<category><![CDATA[Upstream fail]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=367</guid>
		<description><![CDATA[At my job we are moving to Nginx for the load balancing of our sites. Nginx is a very powerful load balancing/proxy server tool. It allows weighting, ssl acceleration, among other functionality while remaining light weight and easy to configure. In preperation for a large web services launch, I began to analyze some logs and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-311" title="Nginx" src="http://derekneely.com/wp-content/uploads/2009/06/nginx-logo.png" alt="Nginx" width="210" height="54" />At my job we are moving to Nginx for the load balancing of our sites. Nginx is a very powerful load balancing/proxy server tool. It allows weighting, ssl acceleration, among other functionality while remaining light weight and easy to configure.</p>
<p>In preperation for a large web services launch, I began to analyze some logs and keep an eye on the system. I noticed one of the sites that we&#8217;ve already deployed was hammering our error messages in /var/log/nginx/error.log reading:</p>
<blockquote><p>2009/06/23 12:38:22 [crit] 808#0: *724154 open() &#8220;/var/nginx/tmp/proxy_temp/4/83/0000002834&#8243; failed (13: Permission denied) while reading upstream, client: XXX.XXX.XXX.XXX, server: xxx.host.com, request: &#8220;GET /dir/page.php&#8221;, upstream: &#8220;http://backendserverip/dir/page.php&#8221;, host: &#8220;host.com&#8221;, referrer: &#8220;http://referrer.com/apage.php&#8221;</p></blockquote>
<p>Upon reviewing the site I noticed some (not all) of the pages were only partially loading. The issue is exactly what the log says. Permission denied = Permission issue.</p>
<p>Check your /etc/nginx/nginx.conf (OpenBSD) file for the user nginx processes will run as:</p>
<blockquote><p>user  nobody;</p></blockquote>
<p>Or, do:</p>
<blockquote><p># ps aux | grep &#8220;nginx: worker process&#8221; | awk &#8216;{print $1}&#8217;<br />
nobody</p></blockquote>
<p>In both cases you see that I&#8217;m running the nginx worker process as user nobody. Now we need to check our permissions on: /var/nginx/tmp/proxy_temp</p>
<blockquote><p># ls -l /var/nginx/tmp/ | grep proxy_temp<br />
drwxrwx&#8212;  12 nobody  _nginx  512 Jun 23 13:10 proxy_temp</p></blockquote>
<p>Looks good. The directory is owned by nobody and is writeable by both nobody and the group _nginx. What could the issue be? Lets move up a level and check the permissions.</p>
<blockquote><p># ls -l /var/nginx | grep tmp<br />
drwx&#8212;&#8212;  5 _nginx  _nginx  512 May  7 11:54 tmp</p></blockquote>
<p>Ah ha! The parent directory is owned my _nginx:_nginx and is only writeable for that user. Our user &#8216;nobody&#8217; therefore does not have the permissions to write in here. So, we can do a few things. Either make the entire directory writeable by everyone or change the ownership.</p>
<blockquote><p># chmod 777 /var/nginx/tmp</p>
<p>or</p>
<p># chown nobody:_nginx /var/nginx/tmp</p></blockquote>
<p>This should cure your permissions issues and all pages should load completely (at least mine do!)</p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/06/nginx-failed-13-permission-denied-while-reading-upstream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project: OpenBSD Network Appliance (Hardware Build)</title>
		<link>http://derekneely.com/2009/06/project-openbsd-network-appliance-hardware-build/</link>
		<comments>http://derekneely.com/2009/06/project-openbsd-network-appliance-hardware-build/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 03:56:56 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Load balancer]]></category>
		<category><![CDATA[Network Appliance]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Router]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=291</guid>
		<description><![CDATA[Part one of the OpenBSD Network Appliance is done. I&#8217;ve got all the hardware put together, everything is posting. RAM was seen. My biggest worry. A buddy of mine at work gave me 4 DIMMS of PC133 512MB. I was a little worried it wasn&#8217;t going to work. I thought the mo-bo used only PC100. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-281" title="OpenBSD" src="http://derekneely.com/wp-content/uploads/2009/06/openbsd.gif" alt="OpenBSD" width="144" height="120" />Part one of the OpenBSD Network Appliance is done. I&#8217;ve got all the hardware put together, everything is posting. RAM was seen. My biggest worry. A buddy of mine at work gave me 4 DIMMS of PC133 512MB. I was a little worried it wasn&#8217;t going to work. I thought the mo-bo used only PC100. Good news for me though! 2GB of RAM for this bad boy will be plenty!</p>
<p>Hardware Specs:</p>
<blockquote><p>ASUS P3V4X Motherboard<br />
Pentium Celeron 533MHz<br />
2GB PC133 RAM (4 x 512MB)<br />
6 NICs (3 x 100Mb 3COM &#8211; 3 x 100Mb Intel)<br />
2 x 30GB Hard drives (RAID 1 intended)</p></blockquote>
<p>Check out the <a title="OpenBSD Network Appliance Build" href="http://gallery.derekneely.com/?level=album&amp;id=9" target="_blank">gallery</a>! <a title="Projects Home Page" href="http://derekneely.com/projects/" target="_self">Projects Home Page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/06/project-openbsd-network-appliance-hardware-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Carp Interfaces on VMWare (OpenBSD)</title>
		<link>http://derekneely.com/2009/06/carp-interfaces-on-vmware-openbsd/</link>
		<comments>http://derekneely.com/2009/06/carp-interfaces-on-vmware-openbsd/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 18:16:54 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=246</guid>
		<description><![CDATA[Here at work we&#8217;ve setup a testing environment of our production systems. That is, we&#8217;re using this environment to setup a perfect world that we will migrate production into&#8230;eventually. We&#8217;re using OpenBSD for our firewalls and I was having a heck of a time getting the carp interfaces to work. The failover worked fine between [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-281" title="OpenBSD" src="http://derekneely.com/wp-content/uploads/2009/06/openbsd.gif" alt="OpenBSD" width="144" height="120" />Here at work we&#8217;ve setup a testing environment of our production systems. That is, we&#8217;re using this environment to setup a perfect world that we will migrate production into&#8230;eventually.</p>
<p>We&#8217;re using OpenBSD for our firewalls and I was having a heck of a time getting the carp interfaces to work. The failover worked fine between the 2 VM load balancer/firewalls but the IPs on the carp interfaces were unreachable. This is apparently because VMs don&#8217;t support arbitrary MAC addresses and carp doesn&#8217;t support manually setting the MAC address. Long story short, the interfaces that are using carp, enable that network in &#8216;Promiscuous Mode&#8217; in the VM management. Works like a charm now!</p>
<p>[Host Name] &#8211;&gt; Configuration Tab &#8211;&gt; Networking &#8211;&gt; Properties &#8211;&gt; [Network Name] &#8211;&gt; Edit&#8230; &#8211;&gt; Security</p>
<p><img class="alignnone" title="VMWare Promiscuous Mode" src="http://gallery.derekneely.com/images/screen_shots/vmware/screenshot.png" alt="" width="426" height="472" /></p>
<p><a title="VMWare Forums" href="http://communities.vmware.com/thread/72521" target="_blank">Original Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/06/carp-interfaces-on-vmware-openbsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Proxy (how-to)</title>
		<link>http://derekneely.com/2009/05/ssh-proxy-how-to/</link>
		<comments>http://derekneely.com/2009/05/ssh-proxy-how-to/#comments</comments>
		<pubDate>Sat, 23 May 2009 20:57:32 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=83</guid>
		<description><![CDATA[SSH Proxying is one of my every day tools. Sitting at work with a Barracuda firewall looking, snooping, and possibly blocking everything that I do. Hanging at a coffee shop when you see a suspicious person most likely snooping your information out of the air. In the first case I&#8217;m primarily just trying to get [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-286" title="Terminal" src="http://derekneely.com/wp-content/uploads/2009/06/terminal.png" alt="Terminal" width="117" height="103" />SSH Proxying is one of my every day tools. Sitting at work with a Barracuda firewall looking, snooping, and possibly blocking everything that I do. Hanging at a coffee shop when you see a suspicious <a title="Huggs" href="#" target="_blank">person</a> most likely snooping your information out of the air. In the first case I&#8217;m primarily just trying to get around a hurdle. In both cases I want my traffic encrypted and hidden from 3rd parties.</p>
<p>What is SSH Proxying?<br />
This is a means of setting up a Secure Shell (SSH) and then piping your various web requests across this pipe or tunnel.</p>
<p>I&#8217;ve got 2 different SSH Proxies that I use daily.</p>
<p><strong>Web Traffic &#8211; SSH Tunnel/Proxy:</strong></p>
<blockquote><p>ssh -CqN -D 8080 [username]@[hostname]</p></blockquote>
<p>For above tunnel I&#8217;m using the following:</p>
<blockquote><p>-D: bind port &#8211; in this case 8080 locally<br />
-C: enables compression<br />
-q: quiet mode (suppresses any warnings)<br />
-N: don&#8217;t execute any remote commands</p></blockquote>
<p>The -CqN are just some bells and whistles I use for the connection but not required. Please see below on configuring your browser to use the newly established SSH Tunnel.</p>
<p><strong>Various other traffic (IRC, VNC, Torrent, etc&#8230;) &#8211; SSH Port Forwarding</strong></p>
<blockquote><p>ssh -L 6667:irc.[hostname]:6667 [username]@[hostname]</p></blockquote>
<p>In this example, I&#8217;m binding a local port (-L 6667) to a remote boxes port (6667) through the server I have SSH&#8217;ed into. You can also add some of the bells and whistles from the web proxy to this one as well. Please see below for using this port forward with and IRC client.</p>
<p><strong>Configuring the Browser:<br />
</strong>The general idea (for Firefox) is to go to: Preferences &#8211;&gt; Advanced &#8211;&gt; Network &#8211;&gt; Connection &#8211;&gt; Settings. Select &#8216;Manual proxy configuration&#8217;. Set SOCKS Host: localhost Port: 8080. Click OK/Save and you should be good to go.</p>
<p>Here&#8217;s a screen shot of my settings:</p>
<p><img title="Firefox SSH Proxy Config" src="http://derekneely.com/MyImages/SSH_Proxy/Firefox_SSH_Proxy_Config.png" alt="Firefox SSH Proxy Config" width="450" height="376" /></p>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/05/ssh-proxy-how-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bwm-ng (command line bandwidth monitor)</title>
		<link>http://derekneely.com/2009/05/bwm-ng/</link>
		<comments>http://derekneely.com/2009/05/bwm-ng/#comments</comments>
		<pubDate>Fri, 22 May 2009 02:47:54 +0000</pubDate>
		<dc:creator>derek</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[bwm-ng]]></category>
		<category><![CDATA[System Tools]]></category>

		<guid isPermaLink="false">http://derekneely.com/?p=67</guid>
		<description><![CDATA[bwm-ng is a great little command line bandwidth monitor. HUGE fan. Its available with most all distros so use your favorite package manager to add it. Works on all *nix distributions including the Mac too. bwm-ng home page: http://www.gropp.org/?id=projects&#38;sub=bwm-ng On the Mac it works great with a little application called GeekTool (will cover more later) [...]]]></description>
			<content:encoded><![CDATA[<p><a title="bwm-ng" href="http://www.gropp.org/?id=projects&amp;sub=bwm-ng" target="_blank">bwm-ng</a> is a great little command line bandwidth monitor. HUGE fan. Its available with <img class="alignright" title="Terminal" src="http://derekneely.com/MyImages/Icons/terminal.png" alt="" width="131" height="116" />most all distros so use your favorite package manager to add it. Works on all *nix distributions including the Mac too.</p>
<p>bwm-ng home page: <a title="bwm-ng" href="http://www.gropp.org/?id=projects&amp;sub=bwm-ng" target="_blank">http://www.gropp.org/?id=projects&amp;sub=bwm-ng</a></p>
<p>On the Mac it works great with a little application called <a title="GeekTool" href="http://projects.tynsoe.org/en/geektool/" target="_blank">GeekTool</a> (will cover more later) with the following options:</p>
<blockquote><p>/Users/derek/Applications/bwm-ng/bin/bwm-ng -o plain -c 1</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://derekneely.com/2009/05/bwm-ng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

