Dec 15 2008

The Administrator’s Creed

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

This is my server.

There are many like it, but this one is MINE.

My server is my best friend. It is my life.

I must master it as I must master my life.

My server without me is useless. Without my server, I am useless.

I must maintain my server true.

I must secure better than my enemy who is trying to hack me.

My server and myself know that what counts in security is not the ports we close,
the logs of our daemons, nor the firewall rules we make.

We know it is the uptime that counts.

My server is human, even as I, because it is my life.

Thus, I will learn it as a brother.

I will learn its weaknesses, its strengths, its parts, its accessories,
its shell, and its uplink.

I will ever guard it against the ravages of spam and crackers.

I will keep my server clean and ready, even as I am clean and ready.

We will become part of each other. We will…

Before Theo I swear this creed.

My server and myself are the defenders of my department.

We are the masters of our enemy.

So be it, until there is no Windows, but UNIX.


Apr 24 2008

Storage Prices (HTPC Project)

After some research via Zap, I’ve arrived at this spreadsheet. It appears that getting 2 500GB drives will be the optimal choice with regard to price per TB. Even though the NIS/GB ratio is rather high, the final price is the lowest one.

Comments?


Apr 23 2008

HTPC Project, Part I

I’ve decided to build an HTPC for my parents (and myself). The idea is to have around 2TB of storage readily available over the network and have the box hooked up to the LCD TV in the living room. The following components are required:

  • Case — I’ve purchased a Coolermaster CM-282 from SLG Computer Systems
  • PSU — I’m considering an Enermax Liberty 400.
  • Motherboard — I’ve decided to upgrade my own motherboard and use the old one for the HTPC. The new mobo will be a Gigabyte GA-P35C-DS3R.
  • GPU — I’ll probably get a Sparkle 512MB passively-cooled 8600GT from SkyPC.
  • TV Card — A Hauppauge WinTV-PVR-150 seems the best choice (multiple price choices here).
  • Hard drives — probably four 500GB Seagate drives (price comparison here).

Feb 23 2008

Spontaneous Nikon Advert

Spontaneous Nikon Advert

During a photography session, I took the picture featured in this post — only to realize later that it came out as a subtle ad for Nikon cameras. The image in it’s natural habitat can be found here.


Feb 19 2008

Balls of Steel

Balls of Steel

I’ve recently started getting into photography. The attached image is just one of a small set I’ve posted on the media page here.


Feb 9 2008

Path Traversal via DOM Injection Vulnerability in Firefox 2.0.0.12

This is obviously no longer an issue. Please see the comments for more information.

As posted on 0×00000, Mozilla Firefox 2.0.0.12 is vulnerable by default to a directory traversal trick, via the view-source mechanism. Although mitigated by the NoScript plug-in, this is quite a serious bug — the default installation is vulnerable from the get-go.

After a slew of point releases and similar vulnerabilities, this comes rather surprisingly — the Firefox team are usually rather thorough in their bug cleansing; hopefully, this will be fixed as promptly as usual.

POC code mirror.


Feb 4 2008

Absolutely Essential Windows Mobile Software

So, I bought an iPaq 6915 a couple of weeks ago. After scouring hundreds of random spam-filled websites, newsgroups and forums, I have settled on the following list of absolutely essential software for the Windows Mobile 2005 OS:

1. Everything by SPB Software — these guys rock. Give them your money. Their backup solution WORKS.
2. Shape Services’ IM+ — probably the best IM client for WM.
3. Pocket Mechanic — seriously useful.
4. Opera Mini — no further explanation needed.

Oh, and if you’re planning on purchasing a GPS solution for the iPaq, wait until Destinator adjusts their software to account for 240×240 screens (unless you feel like twiddling .inf files for a couple of hours).


Jan 13 2008

Emulating Ruby’s “super” in PHP

The code presented here is meant as a proof of concept and therefore does not have any error checking. Also, this is not meant to be used in production — it is merely a neat hack and should only be treated as such.

Following a discussion on FreeNode #php, where someone asked whether it was possible for a method M of class B, a subclass of class A to invoke something along the lines of Ruby’s super and call parent::M() — automagically.

It is, in fact, possible, but requires using an ugly hack — debug_backtrace().

So, here it is:


<?php
error_reporting
(E_ALL);

class A {
public function
super()
{
$bd = debug_backtrace();

$rc = new ReflectionClass($bd[1]['class']);
$pc = $rc->getParentClass()->newInstance();

call_user_func(array($pc, $bd[1]['function']));
}

public function foo() { printf(“omg, foo.\r\n”); }
}

class B extends A
{
public function
foo()
{
printf(“zomg, B-foo.\r\n”);
self::super();
}
}

$b = new B();
$b->foo();
?>

Another version, without modifying classes can be done like this:


<?php
error_reporting
(E_ALL);

function super()
{
$bd = debug_backtrace();

if (isset($bd[1]) && (isset($bd[1]['class']) || isset($bd[1]['object'])))
{
$cls = get_parent_class(isset($bd[1]['object'])?$bd[1]['object']:$bd[1]['class']);
$rm = new ReflectionMethod($cls, $bd[1]['function']);

if ($rm->isStatic())
$rm->invoke(NULL);
else {
$rc = new ReflectionClass($cls);
if (
$rc->isInstantiable())
{
$rm->invoke($rc->newInstance());
}
}
}
}

class A
{
public static function
foo() { printf(“zomg, a-foo.\r\n”); }
public function
bar() { printf(“a-bar!\r\n”); }
}

class B extends A
{
public static function
foo()
{
printf(“zomg, b-foo\r\n”);
super();
}

public function bar() { printf(“b-bar!~\r\n”); super(); }
}

$b = new B();
$b->foo();
$b->bar();
?>


Jan 4 2008

012 Transparently Proxying Torrents?

While downloading a torrent file, I noticed something strange — I was receiving over 300KB/s from a single peer, whose IP address seemed to belong to 012 Golden Lines (an Israeli ISP).

The strange thing is that is currently no package or price plan that provides similar upload rates. The fastest package currently available from any provider is 10 down, 1 up. Also, this kind of speed cannot be explained by compression, since I wasn’t downloading easily compressible content.

Are 012 engaging in torrent proxying? This certainly seems to be case.


Jan 3 2008

Converting PostgreSQL INTERVAL to seconds

This one had me stumped for a few minutes — the solution is EXTRACT(epoch FROM i), i being an interval.