Saturday, July 3, 2010

Freenas Transmission Tweaks

Blatantly liberated from http://code.google.com/p/freenas-rss-extension/wiki/MyTweaks.

** FOR THOSE SEARCHING FOR ERRORS RELATED TO "BLOCKLIST_UPDATE: Config directory not set"

The script below searches through FreeNAS' configurtion files to find the torrents 'Config' directory as per the below screenshot. This option is in the WebUI -> Services -> Torrents



You really really shouldnt need to, but if your still haveing huge problems you could try replacing the code:
config_dir=`/usr/local/bin/xml sel -t -m "//bittorrent" -v configdir /cf/conf/config.xml | /usr/local/bin/xml unesc`
With:
config_dir="/path/to/torrent/config/directory/"
Note: Make sure you put the torrent config directory in a location that allows write (i.e. dont put it willy nilly somewhere in the root filesystem - put it in your RAID or on the spare bit of your OS drive)

1) Fix for file permissions when using samba for windozer file sharing.
Why? Well, basically when you log in Anonymously in windows via SMB protocol, it forces your computer to work under FreeNAS's 'ftp' user. Which is fine, untill...
When Tranmission saves a file, it does so under the 'transmission' user. Also fine.
But when you browse to your NAS from windows (being forced to work as the 'ftp' user) and you try and move or whatnot a torrent file (which has been saved as the 'transmission' user) FreeNAS cracks a wobbly and tells you that you dont have permission to do that (as all it sees is one user trying to fiddle with anothers files)

So we can baindaid her up, with the below additions to the 'Auxiliary paramaters' section

This forces the windows client to pretend to be the 'transmission' user, not the 'ftp' user. So it all plays nice!

2) Blocklist updater.
By default, FreeNAS doesnt use a blocklist (in fact, it disables it quite semi-permantly). We can fixxer that up however.

The script below is also taken from the above wiki - I prefer this one because of the location it gets its blocklists from (Bluetack) and the felxibility of lists.

(Big note: If you copy this into notepad and save it onto the NAS, youll encounter one big problem: Windows uses CF+LF to dictate end of line (return). *NIX uses just LF. This confuses the bash interpreter and it will not run. Download and use Notepad2 and when you save the file select 'File->Line encoding-> Unix (LF)' to avoid those problems)

First off: youll have to stop FreeNAS from diabling blocklist. Do so by editing the rc.conf variables via System -> Advanced -> RC.CONF in the WebUI


Either way, before running the file, youll have to log into the NAS via SSH (Enable the SSH service, setup a user in the webUI with 'bash' as its shell, and point Putty to your NAS) and run some commands on the file.


Bonus geek points if you noticed the nethack.alt.org telnet settings!

First, use the SU command (and enter admin password to NAS) to gain 'superuser' privelages, browse to the direcrory using the CD command, and CHMOD +x the file. Then you can run it directly to ensure it works. Like ive done below.

(Note the LS -Gl [this lists the directory in colour mode] - the permissions list to the far left of blocklist.sh is -rwxrwxrwx. The x's mean its eXecutable, which is what we need to run the script (this is what CHMOD +x has done to the file - CHange MODe eXecute)



CODE: blocklist.sh
#! /bin/bash

###
# Select the blacklists you would like to download & use, all available lists
# (except exemptions) are listed below
#LISTS="ads-trackers-and-bad-pr0n bogon dshield edu fornonlancomputers hijacked iana-multicast iana-private iana-reserved level1 level2 Microsoft proxy spider spyware"
#
LISTS
="bogon dshield hijacked iana-multicast iana-private iana-reserved level1 level2 Microsoft"

###
# YOU SHOULD NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
#
url
="http://www.bluetack.co.uk/config/"
config_dir
=`/usr/local/bin/xml sel -t -m "//bittorrent" -v configdir /cf/conf/config.xml | /usr/local/bin/xml unesc`
updated
=0

if [ "$config_dir" == "" ]; then
logger
-t blocklist_update -- Config directory not set
exit 1
fi

if [ ! -d "$config_dir/gzblocklists" ]; then
mkdir
"$config_dir/gzblocklists"
fi

for list in $LISTS; do
file
="$config_dir/gzblocklists/$list.gz"
lsize
=`stat -qf %z "$file" || echo 0`
rsize
=`fetch -apsw 5 $url$list.gz || exit 1`
if [ "$lsize" -ne "$rsize" ]; then
logger
-t blocklist_update -- Updated $list

# need to download to different folder than $config_dir/blocklists
# transmission seems to have trouble at times starting possibly by trying to parse
# gz'd files
fetch
-qapw 5 -o "$file" $url$list.gz
gunzip
-kqf "$file"
mv
"$config_dir/gzblocklists/$list" "$config_dir/blocklists/"
updated
=1
fi
done

if [ "$updated" -eq "1" ]; then
/etc/rc.d/transmission restart &> /dev/null
else
logger
-t blocklist_updater -- All lists up-to-date
fi

Then its a simple matter of setting up a cron job to run it on a schedule. Below is my settings for midnight every Wednesday.

Note: Your path to the script will differ.

Friday, July 2, 2010

Freenas extras

So after trials in a virtual machine, and three installs on ol' Frankenputer, FrankenNAS lives! Insert demoic laughter and all that.

I was going to do a big walkthrough to installing FreeNAS, but my apathy knows no bounds. Plus, google can tell you how to install it. I think you can install it falling over, actually.

  • Download FreeNAS from http://sourceforge.net/projects/freenas/
  • Burn CD - imgBurn or the like will be a-ok
  • Pop into CD drive, set BIOS to boot from CD and reboot
  • FreeNAS will boot, and run off the CD
  • Youll want to install it to a HDD or CF card (you can get IDE -> CF card adaptors)
  • I went for a Full install + swap. Swap is always fun. Keep in mind that booting the OS off your RAID (if you have a hardware RAID card) is a terrible idea. Grab either the IDE->CF card or a 40/80GB HDD and boot it off that.
  • Once its installed (all what, 15 seconds?) remove the CD and reboot. This time it will be off the HDD
  • Youll end up back at the same menu now. (It runs off the CD exactly the same, however you dont want it to run off the CD permantly - it wont perform all that well)
  • Now press 1. and setup the network (It's likely it guessed all that for you, but configuring it cant hurt) Youll have to select which network device to use (you may well only have 1 so go nuts) Im not sure how its wireless support goes here - I would advise against it anyway.
  • Once thats configured, press 2. Here you should select DHCP (unless you want to manually enter a IP address) and select no for IPv6. It will now give you a funky IP address.
  • FIN
You can now browse to that IP address in your webbrowser! As shown below, it will tell you the IP address you can log in with below.


The steam special is insanity. Oh, and also FreeNAS is shown.

Youll want to set up your hard drives first before hand, obviously.

This post will leave you to play with the webui. Google is your friend here.

Stay tuned for:
  • Transmission (Torrent client) blocklist
  • Transmission RSS auto-downloader
  • Transmission RSS auto-downloader email hack
  • Custom script ive used for email status reports
  • PS3 Media server setup (The pre-installed uPNP server is shite, sorry)
  • Performance Tweaks?

Thursday, July 1, 2010

Conroy

Exert from a email response I sent in regards to our illustrious Governments filter. Posted here for posterity. Hopefully we can look back and laugh and go 'Conroy? Wasn't he the guy that campaigned to save us against spams and scams coming through the portal? Wasn't he the guy that was so stupid that the 2010 elections ballots had to be kiln-dried before talling because people laughed so hard as his name on the ballots they cried?'
Of course, if we get Gillard for another couple of years, you likely wont be reading this as it will be blacklisted as anti-government propaganda.

Quote: Me, in response to a discussion on the filter via email, 29 June 2010. Names omitted to protect the innocent

Its funny, because until this email I’ve never even looked at it that way. You two argue for and against a filter, I argue against the technical implementation of the filter.

I don’t even oppose A FILTER.

I liked the previous plan installing filters on parents PC’s as they:

· Moved responsibility to the household, and ultimately the parents

· Provided some level of security

· Bypassable unfortunately (Which any solution is. ANY)

I don’t like the proposed filter because:

· It WONT WORK

· It wont stop child pron at all

· It gives your wife a false sense of security in thinking your kids protected

· It will impede our broadband development and speeds which are already behind – This directly impacts economy too

· Extra cost at ISP level – either they pass on the expense to us or what, the GVT will pay – which is us again

· It wont stop torrents, FTP, IRC, what not where the actual harmful stuff is shared

· It should be AT LEAST opt in (As a young bachelor, why do I need content filtering?)

· Its extremely EXTREMLY bypassable (And legal to do so, so duuuh?!?)

· Christ, it will cost people like me even more for internets because ill likely pay for a encrypted proxy connection – internets expensive enough!

· Massive breech of privacy. They will be inspecting each and every packet of information to and from your PC

· Private blacklist means abuse. I think it’s a guarantee it will be abused in some way if its there – power corrupts and all that.

Closing points:

This makes me so angry, only because were being sold a square peg for a round hole!

Ive got a secret for your wife. Don’t tell anyone – the GVT doesn’t want you to know!

You have a filter at home. Its cheap, easy to install, failproof, doesn’t require government funding, sponsorship, and whatnot. It wont impede your privacy, internet speeds. It will also help you grow a true bond with your children and will allow you to explore the wonders of the internets with safety and ease together.

It’s a chair. Move the PC out into the living room (kids shouldn't need more crap in their rooms to give them even more reasons to sit in them all day) and install a chair next to the PC. Install parental ass into said char. Your new filter is set up and ready to go. Even set up free software on your PC to lock the internet out on the kids accounts at certain times, and have designated internets time.