<?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>diginc &#187; linux</title>
	<atom:link href="http://diginc.us/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://diginc.us</link>
	<description>\'dij-iŋk\</description>
	<lastBuildDate>Fri, 18 Jun 2010 20:17:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using fail2ban to open back door ports in your iptables</title>
		<link>http://diginc.us/2009/09/using-fail2ban-to-open-back-doors-ports-in-your-iptables/</link>
		<comments>http://diginc.us/2009/09/using-fail2ban-to-open-back-doors-ports-in-your-iptables/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 21:38:26 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[auth2accept]]></category>
		<category><![CDATA[auth2allow]]></category>
		<category><![CDATA[fail2accept]]></category>
		<category><![CDATA[fail2allow]]></category>
		<category><![CDATA[fail2ban]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=108</guid>
		<description><![CDATA[The opposite of fail2ban would probably be called auth2allow (authenticate to allow) or fail2allow &#8211; but that&#8217;s not necessary because fail2ban&#8217;s configs can be customized to do exactly what I&#8217;m talking about. What am I talking about you ask? Basically &#8230; <a href="http://diginc.us/2009/09/using-fail2ban-to-open-back-doors-ports-in-your-iptables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The opposite of <a href="http://www.fail2ban.org">fail2ban</a> would probably be called auth2allow (authenticate to allow) or fail2allow &#8211; but that&#8217;s not necessary because fail2ban&#8217;s configs can be customized to do exactly what I&#8217;m talking about.  What am I talking about you ask?  Basically what I&#8217;ve done and am about to explain how to do is setup fail2ban to look for a successful login on a FTP to allow the authenticated IP to get access to another port that isn&#8217;t as secure as FTP so is usually 100% black listed in IPTables.  It&#8217;s just a hack of a security mechanism to allow your self or others into places securely through obscure means.  Like most security it&#8217;s not perfect but it seems pretty solid in my mind.  </p>
<p>If someone can authenticate on the FTP (could even be anonymous ftp, but I&#8217;d recommend using a special username you want to specifically grant access) then fail2ban triggers an ALLOW command for their IP on some port (or all ports), for example SSH (22) or apache https (443) with a private site on it that you want to keep private and totally hidden from the internet at large.  This concept could really apply to anything.  Any command IPTables can run can be triggered through something fail2ban sees in a log file basically, the possibilities are endless.  In my example I&#8217;ll use https, port 443, but in real life I&#8217;m using an obscure port number and the program running on it that is not very secure by default.</p>
<p>So here are my slightly modified configuration files for setting up a custom fail2ban service that does the opposite of what fail2ban typically does.</p>
<p><span id="more-108"></span></p>
<p>In /etc/fail2bain/jail.conf I added:</p>
<pre>
 [vsftpd2allow443]

 enabled  = true
 port     = 443
 filter   = vsftpd-2-https
 banaction = iptables-accept-https
 logpath  = /var/log/vsftpd.log
 maxretry = 1
 bantime  = -1
</pre>
<p>filter has to match the name of the corresponding file in the <code>/etc/fail2ban/filter.d</code> folder.  banaction has to match the corresponding file in the <code>/etc/fail2ban/action.d</code> folder.  Max retry is 1 so the person doesn&#8217;t need to successfully login to the FTP more than once to get access to our secret port back door.  Bantime -1 should add the person for ever.  For added security try <code>bantime = 86400</code> for 1 days access (bantime uses seconds).</p>
<p>Next make a copy of a default action for a template:</p>
<pre>
 cp -vip /etc/fail2ban/action.d/iptables.conf /etc/fail2ban/action.d/iptables-accept-https.conf
</pre>
<p>Then modify all the DENYs to ACCEPT and change the port:</p>
<pre>
 actionban = iptables -I fail2ban-<name> 1 -s <ip> -j DROP
 # Becomes
 actionban = iptables -I fail2ban-<name> 1 -s <ip> -j ACCEPT

 actionunban = iptables -D fail2ban-<name> -s <ip> -j DROP
 # Becomes
 actionunban = iptables -D fail2ban-<name> -s <ip> -j ACCEPT

 port = ssh
 # Becomes
 port = 443
</pre>
<p>And lastly you need your fail2ban filter that watches vsftpd for successful authenticions of our special user who gets special ports opened up for them.  Since I&#8217;m using vsftpd as my FTP I just copied it&#8217;s current filter and modified it to look for good auths instead of bad auths. </p>
<pre>
 cp -vip /etc/fail2ban/filter.d/vsftpd.conf /etc/fail2ban/filter.d/vsftpd-2-accept-https.conf
</pre>
<p>Change &#8216;<code>specialuser</code>&#8216; to whatever FTP user you want to gain special access to your server.</p>
<pre>
 failregex = vsftpd(?:\(pam_unix\))?(?:\[\d+\])?:.* authentication failure; .* rhost=<HOST>(?:\s+user=\S*)?\s*$
     \[.+\] FAIL LOGIN: Client "<HOST>"\s*$
 # Becomes
 failregex = vsftpd(?:\(pam_unix\))?(?:\[\d+\])?:.* authentication failure; .* rhost=<HOST>(?:\s+user=\S*)?\s*$
     \[specialuser\] OK LOGIN: Client "<HOST>"\s*$
</pre>
<p>If you&#8217;re not using VFTPd then fail2ban has many other popular linux FTP client&#8217;s setup in the filter.d folder.  You should also look in your log file (<code>ls /var/log/*ftp*</code> should find it) to find out what syntax it uses to denote a successful FTP login because it will most likely be different than what VSFTPd uses.</p>
<p>Now you just need to remember the password for your <code>specialuser</code> and you just FTP to your server with that login from any computer in the world to open your hidden port to access your secret content.  This idea is mostly for personal use and I recommend against trying to have any beginner users use this as a mechanism for accessing content or even using it in a serious This slight modification isn&#8217;t revolutionary or anything and I may not be the first to come up with it but it definitely isn&#8217;t a well search indexed idea so I thought I&#8217;d throw this out there for others.</p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/2009/09/using-fail2ban-to-open-back-doors-ports-in-your-iptables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GNUmp3d init.d with PIDs for running multiple instances of GNUmp3d</title>
		<link>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/</link>
		<comments>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 05:07:15 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[gnump3d]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[invoke-rc.d]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=73</guid>
		<description><![CDATA[I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated). I still haven&#8217;t quite figured out how to get the tag database to work for &#8230; <a href="http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated).  I still haven&#8217;t quite figured out how to get the tag database to work for my second GNUmp3d instance, if anyone can help please leave a comment.  Here&#8217;s the script and some brief instructions:</p>
<p><span id="more-73"></span></p>
<p>/etc/init.d/gnump3d :</p>
<pre>
#!/bin/bash

gmconfig="/etc/gnump3d/gnump3d.conf"
gmport="54321"
gmpidfile="/var/run/gnump3d_$gmport.pid"

case "$1" in
start)
  if [ -f $gmpidfile ] ; then
    echo "GNUmp3d already running on port $gmport"
  else
    echo "Starting GNUmp3d."
    /usr/bin/gnump3d --background -config $gmconfig --port $gmport
    sleep 1
    ps -ef | grep -v "grep" | grep "config $gmconfig" | cut -c10-15 > $gmpidfile
  fi
;;
stop)
  if [ -f $gmpidfile ] ; then
    echo "Shutting down GNUmp3d."
    /bin/kill -9 $(cat $gmpidfile)
    rm $gmpidfile
  else
    echo "GNUmp3d isn't running on port $gmport yet"
  fi

;;
restart)
  $0 stop
  $0 start
;;
status)
  if [ -f $gmpidfile ] ; then
    echo "GNUmp3d running on port $gmport with config $gmconfig and pid $(cat $gmpidfile)"
    echo $(ps -ef | grep -v "grep" | grep "config $gmconfig")
    #echo
    # code to display the other instance of gnump3d here...
  else
    echo "GNUmp3d isn't running yet"
  fi
;;
*)
  echo "Usage: $0 {start|stop|restart|status}"
  exit 1
esac

exit 0
</pre>
<p>To run more than one copy of gnump3d with this simply make a copy of this script and call it something like gnump3d_2.</p>
<pre>sudo cp -vip /etc/init.d/gnump3d /etc/init.d/gnump3d_2</pre>
<p>Then change the new init.d script to point to your new config and port (pid file auto updates by port #).</p>
<pre>
gmconfig="/etc/gnump3d/gnump3d_2.conf"
gmport="54322"
</pre>
<p>Make a copy of the stock gnump3d config and modify the necessary lines.</p>
<pre>sudo cp -vip /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d_2.conf</pre>
<p>In my config I modified these lines:</p>
<pre>
port = 54322
root = /home/gnump3d_2
user = gnump3d_2
logfile = /var/log/gnump3d/access_2.log
errorlog = /var/log/gnump3d/error_2.log
now_playing_path = /var/cache/gnump3d_2/serving
tag_cache = /var/cache/gnump3d_2/song.tags
</pre>
<p>And lastly we&#8217;ll need to make the cache drectories:</p>
<pre>mkdir /var/cache/gnump3d_2/
mkdir /var/cache/gnump3d_2/serving
chmod -R 777 /var/cache/gnump3d_2
touch /var/cache/gnump3d_2/song.tags
</pre>
<p>And then you&#8217;re set to startup the second gnump3d instance.</p>
<pre>/etc/init.d/gnump3d_2 start</pre>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up my HDTV HTPC with xUbuntu 8.10</title>
		<link>http://diginc.us/2009/01/setting-up-my-hdtv-htpc-with-xubuntu-810/</link>
		<comments>http://diginc.us/2009/01/setting-up-my-hdtv-htpc-with-xubuntu-810/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 23:36:26 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[hdtv]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=3</guid>
		<description><![CDATA[Here my chronicle of fixes and tasks I had to go through while setting up my HDTV HTPC / home server. I upgraded from an older xUbuntu to xUbuntu 8.10 64-bit and the first thing I had to do is &#8230; <a href="http://diginc.us/2009/01/setting-up-my-hdtv-htpc-with-xubuntu-810/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here my chronicle of fixes and tasks I had to go through while setting up my HDTV HTPC / home server.</p>
<p>I upgraded from an older xUbuntu to xUbuntu 8.10 64-bit and the first thing I had to do is restore the windows file share where I backed up configurations, samba shares, and my Adaptec SATA Raid 1210SA.  Then I had to conquer ATI&#8217;s proprietary drivers and restore my previous install&#8217;s server functionality.  Next time I&#8217;ll be finishing up the HTPC portion by configuring my TV Tuner with mythTV and installing Boxee as well &#8211; and maybe integrating the two together if possible.<br />
<span id="more-3"></span></p>
<p>Note: you can copy paste the code commands with the &#8220;<code># comments</code>&#8221; at the end because Linux will ignore everything after the #</p>
<p><b>Network Shares and Raid</b><br />
<code><br />
apt-get install samba # for sharing my raid storage across the network<br />
apt-get install smbfs # for mount.cifs to mount windows file shares<br />
apt-get install nfs-common # for the other mount types<br />
apt-get install dmraid # for my Adaptec SATA 1210SA Raid card (x2 320GB drives)<br />
apt-get install vim # because vi drives you insane after using vim<br />
</code></p>
<p>With the right programs installed I could reach my backups, test/setup my mounts permanently, and setup samba so I can start listening to my music right away again.<br />
<code><br />
mkdir /media/a-computer; mkdir /media/a-computer/backup # make a folder to mount to<br />
mount.cifs //192.168.0.51/backup /media/a-computer/backup -o guest,rw # mount my windows backups share<br />
tail -3 /media/a-computer/backup/fstab  >> /etc/fstab  # copy old fstab permanent mounts to new fstab<br />
</code><code><br />
tail -3 /media/a-computer/backup/fstab # outputs<br />
/dev/mapper/asr_1 /media/windows ntfs rw        0 0<br />
//192.168.0.51/usenet /media/a-computer/usenet cifs guest,rw,mand 0 0<br />
</code></p>
<p><b>Video Setup</b></p>
<p>I&#8217;m plugged into my Panasonic Viera 42&#8243; HDTV through an ATI HD2600XT and DVI-I to HDMI cable (from <a href="http://www.monoprice.com">monoprice</a>).  After installing xUbuntu 8.10 on a CRT Monitor (so I could read the text) I switched video cables and plugged in my HDTV only.  It booted into X with VESA drivers on &#8220;Default&#8221; resolution (not sure what res.,it wasn&#8217;t HD, but it worked on my TV somehow) and first thing that was obviously needing fixed is the text was too small to read.  </p>
<p>I quickly remembered you can&#8217;t fix the font size problems high resolutions in the XFCE menus.  You have to make a config change for X:<br />
<code>echo "Xft.dpi: 96" >> ~/.config/xfce4/Xft.xrdb</code></p>
<p>To install the video drivers I decided to just go through the menus instead of attempting it through command line (if you need to use apt-get I believe you need to manually add the proprietary apt-get rep source).  I went to Applications > System > Hardware Drivers > And There were ATI/AMD Proprietary drivers &#8211; after one click it launched the package manager and installed fglrx for me, very painless.  I also ran updates and rebooted at this time.</p>
<p>I had some issues with the fglrx video driver at first but to make a long story short, here&#8217;s how I finally got a good xorg.conf for it.<br />
<code><br />
dpkg-reconfigure xserver-xorg # This helped the next step make a more complete config<br />
aticonfig --initial # Before I ran the above step, this generated a very minimual xorg.conf<br />
aticonfig --resolution=0,1920x1080,1280x720 # Set my HDTV resolutions<br />
service gdm restart # Restart X and test new xorg.conf - booted into 1920x1080 for me<br />
</code></p>
<p>Being in 1080p resolution caused fonts to look a lot smaller, even with the xfce font DPI fix, so I increased font sizes in the menus: Applications > Settings > Settings Manager > User Interface &#038; Windows Manager.  I also increased the Panel sizes to 41 to make Icons bigger.  </p>
<p>Switching to fglrx enabled HD resolutions but it also gave me black bars around my screen.  To fix this at first I was trying to utilize the aticonfig&#8217;s overscan tv functions since I&#8217;m using a TV.  however my display isn&#8217;t detected as a &#8220;TV&#8221; type for whatever reason, as this shows:<br />
<code># aticonfig --query-monitor<br />
Connected monitors: tmds1<br />
Enabled monitors: tmds1</code><code><br />
aticonfig --tv-info<br />
The TV is not connected<br />
The TV geometry is "0x0+0+0"<br />
</code></p>
<p>After a lot of Googling and experimenting with various aticonfig commands I came to this solution: <code>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</code> &#8211; This fixed my underscan black bars but isntead created an overscan problem (screen was bigger than TV borders).  I managed to fix this by tweaking the resolution (not sure if this causes pixel stretching but it doesn&#8217;t look bad &#8211; may just be a work around).  Here&#8217;s my overscan fix autostart script which lowers my resolution and bump the screen into center position:<br />
<code>#!/bin/bash<br />
# Add this script to autostarting apps, these commands don't seem to save<br />
aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0<br />
# X was over by 28 pixels on each side (1920 normal)<br />
aticonfig --set-dispattrib=tmds1,sizeX:1866<br />
aticonfig --set-dispattrib=tmds1,positionX:+28<br />
# Y was over by 16 pixels on each side (1080 normal)<br />
aticonfig --set-dispattrib=tmds1,sizeY:1048<br />
aticonfig --set-dispattrib=tmds1,positionY:+16<br />
</code><br />
X/Y overscan values needing adjustment may be different for you</p>
<p><b>Diversion 001</b><br />
With my video completely setup I needed to test it out:<br />
<code>sudo apt-get install vlc</code><br />
I checked out some videos, normal video started skipping, HDVideos were artifacting, skipping, and top showed them taking over 50% of my CPU most of the time&#8230;that&#8217;s not right, never had this problem on my previous installs (windows XP or xubuntu 8.04).  Investigation revealed my CPU frequency is set to the minimum of 1000mhz of 2200mhz max.  Google revealed an application I hadn&#8217;t heard of before that was quite easy to use and fixed this problem:<br />
<code>apt-get install cpufrequtils<br />
cpufreq-set -g performance # Sets frequency to max</code></p>
<p>I thought that was very odd, maybe a bug with Intrepid Ibex?</p>
<p><b>Torrents, usenet/Sabnzbd, and GNUMp3D</b></p>
<p>Next I setup my uTorrent webui to act as a central torrent server for my home.  If you need instructions on setting up webui see <a href="http://forum.utorrent.com/viewtopic.php?id=14565">uTorrent&#8217;s webui post</a>.  I already set it up in wine previously so I&#8217;m just restoring from a backup here: </p>
<p><code>sudo apt-get isntall wine # We need wine to run uTorrent<br />
cp -vip /media/a-computer/backup/uTorrent.exe .~/wine/drive_c/Program\ Files/uTorrent/  # Get the exe<br />
rsync -aP /media/a-computer/backup/adam/.wine/drive_c/windows/profiles/adam/Application\ Data/uTorrent/ ~/.wine/drive_c/windows/profiles/adam/Application\ Data/uTorrent/ # I need the app data folder where webui is saved<br />
cp -vip root/startup-uTorrent.sh /home/adam # Copy my startup script<br />
cat /home/adam/startup-uTorrent.sh # It's a simple script needed for auto start on boot<br />
#!/bin/sh<br />
wine /home/adam/.wine/drive_c/Program\ Files/uTorrent/uTorrent.exe &#038;<br />
</code></p>
<p>Then I add the script to the startup applications list through Applications > Settings > Settings Managed > Autostarted apps > Add > Then Enter a description and the path /home/adam/startup-uTorrent.sh</p>
<p>References:</p>
<p>http://ubuntuforums.org/showthread.php?t=225721</p>
<p>http://www.phoronix.com/forums/showthread.php?p=36734#post36734</p>
<p>http://ubuntuforums.org/showthread.php?p=5842624</p>
<p>http://www.thinkwiki.org/wiki/How_to_use_cpufrequtils</p>
<p>Brain</p>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/2009/01/setting-up-my-hdtv-htpc-with-xubuntu-810/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
