<?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>UNIXy &#187; rar</title>
	<atom:link href="http://blog.unixy.net/tag/rar/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unixy.net</link>
	<description>Fully Managed Dedicated Servers</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:37:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Ban File Extensions Using Pure-ftpd</title>
		<link>http://blog.unixy.net/2009/07/ban-file-extensions-using-pure-ftpd/</link>
		<comments>http://blog.unixy.net/2009/07/ban-file-extensions-using-pure-ftpd/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 02:21:28 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[ban extensions]]></category>
		<category><![CDATA[ban files]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[pure-ftpd]]></category>
		<category><![CDATA[rar]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=16</guid>
		<description><![CDATA[Pure-ftpd has no direct support to prevent files with certain extensions from being uploaded. But it&#8217;s possible to accomplish this goal using a pure-ftp feature. pure-ftpd has a post-upload program that runs after each file is successfully uploaded and can run an external program. Here&#8217;s the excerpt from the pure-ftpd manual: NAME pure-uploadscript &#8211; Automatically [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F07%2Fban-file-extensions-using-pure-ftpd%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F07%2Fban-file-extensions-using-pure-ftpd%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Pure-ftpd has no direct support to prevent files with certain extensions from being uploaded. But it&#8217;s possible to accomplish this goal using a pure-ftp feature. pure-ftpd has a post-upload program that runs after each file is successfully uploaded and can run an external program. Here&#8217;s the excerpt from the pure-ftpd manual:</p>
<blockquote><p>
NAME<br />
pure-uploadscript &#8211; Automatically run an external program after a successful upload</p>
<p>SYNTAX<br />
pure-uploadscript [-p </path/to/pidfile>] [-B] [-g <gid>] [-h] -r
<program to run> [-u <uid>]
</p></blockquote>
<p>So the program to run in our case can be a simple Bash script I&#8217;m going to call ban.sh</p>
<blockquote><p><code>#!/bin/bash</p>
<p>uploaded_file=${1};<br />
banned_extensions="zip tar rar";</p>
<p>for ext in ${banned_extensions};<br />
do<br />
 count=$(echo ${uploaded_file}|grep -i ${ext}$|wc -l);<br />
 if [ "${count}" -gt "0" ];<br />
 then<br />
  rm -f ${uploaded_file}; # File with banned extension detected. Delete it.<br />
  break;<br />
 fi;<br />
done<br />
</code></p></blockquote>
<p>So you start the program in the background like this:</p>
<blockquote><p>pure-uploadscript -p /var/run/pure-ftpd.pid -B -r /root/ban.sh</p></blockquote>
<p>That&#8217;s all folks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2009/07/ban-file-extensions-using-pure-ftpd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

