September 28, 2012

Planet Side 2 Beta

I loved the original PlanetSide. Every evening I’d get home from work and run around the fake world of Auraxis and help my fellow faction members defend various generic looking bases from the evil machinations of one of the other factions. Well, technically my faction was probably the evil faction but that’s by-the-by. What mattered was that there were three factions, with hundreds of players in each per server, all scrapping on the same map. It was glorious fun. Jumping into tanks, dropping shells on the enemy hordes as they pored out of their barracks then rushing off for tea and biscuits. Occasionally we’d jump out of a dropship onto the top of one of their bases and scurry inside, everybody checking the corners like they do in the movies before capturing it for the glory of the Terran Republic.

Like in most FPS’s I was terrible, dying frequently and mostly embarrassingly. Though some were noble deaths — running alongside a tank that needed to be repaired mid battle — they were just as equally due to me falling of a cliff face or being run over by another tank. But in an MMO like PlanetSide it didn’t matter. There was no score to keep track of other than how many bases your faction controlled. So I played as an engineer, died as many times as I wanted and still ran around healing tanks, fixing up turrets and laying mines. Generally being helpful like some sort of conscientious objector lemming.

University killed all this off with its hateful firewall and supposed learning and so I had to say goodbye to the zerg rushes and the big stompy robots and turn my hand to studying. Much to my family’s dismay, my studying was about as good as my FPS skillz.

Years later, after somehow persuading examiners I was just about good enough to award a degree, PlanetSide 2 is showing its face. I couldn’t resist the chance to try my hand again and so pestered the PS2 twitter account for a beta key. Either they could tell that I was a seasoned PS1 vet and deserving of a beta key from my carefully constructed 140 character tweet, or they were desperate to get people onto the servers. Regardless I gleefully downloaded the “launchpad” app and jumped into the game waited for the servers to wake up from their well deserved kip at 2pm.

I was overjoyed when I finally got a chance to see the initial spawn room. I ran around, shot at a few other of the players hanging around (who were probably not pleased with one of their team mates gunning them down) and headed outside to the nearest vehicle terminal to grab myself a flying Mosquito gunship (the better to gun down my enemies with).

I was elated. I am much older and wiser compared to when I last played Planet Side and have honed my skills on various incarnations of Halo and CoD; I even became kind of good at them both (“good” being a relative term) almost coming top of matches on numerous occasions. And now there were enemy somewhere in the world who desperately needed to give me XP for their premature and rather sudden demise.

I could almost hear the praise of my comrades in arms as I stood victorious in the middle of a newly captured base, the cooling corpses of the enemy strewn about in a scene reminiscent of a zombie film. They would gape at the smoking, empty shells of tanks that guarded the entrance, dispatched with some well placed grenades. Empty bullet cases crushed underfoot where I charged the final barricade. My left gauntlet, bloodied and hanging limp at my side where I wrestled, mano-e-mano, with their final defender.

Unfortunately I still suck at flying the gunship things and soon plunged into the nearest cliff. My first suicide. There wasn’t even anyone shooting at me; I simply flew into a cliff. Oh well, I’ll use the instant action button and simply drop into the action. THWACK I’m sitting in the middle of a base ready to do my best against the ravaging horde except…where is everybody? After a swift reconnoitre I notice a single body of one of the enemy who must have lead to this base being classed as “under attack”. Someone on my side must have beaten me to it. Well I’ll just instant action again to the next hot spot and try my luck there.

But you can’t as there’s a cool down timer. In fact, I can’t get a new flying thingy either as there’s a cool down timer on that. In many ways I don’t mind that too much as I remember in the good old days it was infuriating being spammed by flying things all the time. However, at this instant I was now stuck in a base miles away from the action.

I spent some time wondering around, trying to get into a proper scrap and eventually I found one. A large-ish affair involving about 50 people each side (at a rough guess) and it all flooded back and reminded me why I loved PlanetSide before. When you have a massed battle, with a to and fro-ing front, PlanetSide feels like an epic battle where everybody is working towards the same goal. Troops are constantly running into the fray, taking damage and running back calling for medics. Tanks come poring back to base, firing frantically with smoke leaking from their turrets looking for repairs. It all feels like it should.

But after a few hours, and a few more battles, I was getting worried. I kept dying, which I’m used to, but it can take a long time to get from spawn points to battles and death is so quick that I was worried that PlanetSide’s style of combat was too alien to new players and couldn’t be revived. The large battles often rely on people grabbing mobile spawn point trucks and dropships to help push forward an advance. But many people on my side were only purchasing one person trucks and aircraft then zooming off. There was often a dearth of medics to heal you up or resuscitate you when you fall meaning a long trek from a spawn point. Team work is so necessary that without it the game can be infuriating and it could be hard for SOE to get people to play properly as a self organised team when so many of the current multiplayer FPS’s have ruined us all into being on the front line. PS needs people to run around resussing their dead comrades, to fly the bombers but shoot nothing, to fly paratroopers to the front and then fly back for the next wave. I hope that this is just due to the sudden influx of people finding the novelty of the game too much fun and the lack of the outfit support at the moment in the beta.

I spent an entire evening with my faction losing repeatedly and it just isn’t fun when that happens because everyone is playing on their own. Defending can be great but not if people are running around trying to get kills rather than defending a capture point. And on their own, the separate parts aren’t good enough to stop the game being trying. The guns are more fun than in PS1 — a lot closer to modern day shooters — but they’re not CoD so as a straight-up shooter it won’t be satisfying. You might as well play CoD. The vehicles are fine, even if I find the handling a bit awkward, but for a lot of the larger vehicles you need compadres to man the turrets (and you’re relegated to a relatively boring driver position). The large maps are great but when you’re a lone soldier miles from the action, there’s not much to do but watch the grass sway as you trudge to the next base, hoping there’s a bona fide battle occurring. Many of these problems could probably be laid at the feet of PS1 as well but nowadays, with the proliferation of so many FPS’s and MMO’s I was concerned that only my nostalgia would keep me playing.

I was concerned. But then something amazing happened. The convergence of many small things to create something wonderful. I had finally arrived at a massive scuffle between our faction and another over one of the larger bases. It had taken some time — and a lot of re-spawns — but we had finally got them on the back foot, pushing them out of the base. Tanks in the courtyard exchanging rounds with their fleeing counterparts, infantry belonging to both sides weaving inbetween crates and buildings trading bursts of fire. Then, before I realised, I was shooting less at things I could see, but rather at the source of their missile contrails, their tracers or the flashes from muzzles. Blindly firing at the vicinity hoping for a lucky hit. It had become night without me even noticing and all of a sudden a relatively normal FPS battle had turned into frantic pandemonium. The same tanks were firing salvoes into the hills but they were no longer as sure where they needed to fire until fired upon. Troops on either side fired on sneaking shadows not entirely sure who it belonged to. Engineers were dashing from their hiding places to repair trucks hoping that the darkness would cover them while they were crouching exposed alongside.

This was AWESOME. Soon the base was ours and the only way we managed it was with what can only be described as an army. We had fighters, protecting bombers and troop transports. APCs intermingled with tanks of various descriptions and infantry scurrying between them like ants. Ants with guns. Soon the general mass of everyone started heading towards the nearest enemy controlled tower. We hadn’t bandied into a team using some sort of “create army” button, instead it just seemed like the right thing to do. That tower was where the enemy had been coming from and because of the map design, the tower was both visible from our line of sight and an obvious target. So someone at the front of the line decided to head that way and the rest followed.

Before I knew it I was in the middle of a tank column as a second gunner. We were travelling on a road following the headlights (yes, the headlights) of those in front. As we started to climb towards our objective, following a road sunk into the hillside, the incoming fire started to intensify and become more accurate seeking out individual targets. Rockets flashed from enemy aircraft, flowing out in a deadly stream, lighting up the trucks in front of me as the explosions washed over them. Retaliatory fire started up from ahead of us in the column, tracers arcing across the sky tracking their fleeing antagonist. I couldn’t see exactly what he was shooting at but I joined in hoping it would at least drive away our common assailant. Instead it earned our truck a volley of tank shells from a nearby hill. We all bailed out of the APC before it burst into flames taking us with it. Weaving inbetween the vehicles of the stalled column I was useful again. Stopping to fix up a battered tank while it blanketed a nearby incline with rounds, dropping ammunition for a sniper hiding in the lee of a tree, legging it behind a rock when the enemies’ defence turrets started targeting me.

Visually the game is a massive leap forward. Light glares around spotlights as you pan around darkened courtyards, casting pools of glow on the textures of buidlings. High tech plasma guns have a purple flowing energy effect casting shadows as they pass and missiles have billowing cloud streaming along their flight path.

And the map itself is great. The bases and towers that you are vying for control of are no longer the same cookie cutter types but are greatly varied. There’s the massive bio dome, raised on pillars that has a couple of exterior capture points and then a series inside the dome itself. To get at the inner ones, you have to make it up onto the landing pads which typically requires capturing the two external bases as they have jump pads (or to make use of a drop ship to let you off). Once atop the landing pads, you can start trying to grab the inner areas which resemble a more deathmatch style of gameplay; vehicles can’t get into here so it is up to infantry to capture the base. This sort of smaller scale battle was what the previous game’s battle isles were supposed to provide but didn’t quite work as they seemed disjointed and not part of the overall campaign. But here the interior of the bio dome is as necessary as any of the external bases and as readily available. There’s no loading screen as you transition from outside to inside, it is just there on the map. Then there’s a walled base, where force fields block the entrances. For an attacker to get in, they need to get over the walls and take down generators to drop the shields to allow their tanks to roll in. Another base looks reminiscent of something from Halo with floating platforms high above the rest of the structure.

So is PlanetSide 2 as good as PS1. Yes. It is on a par with the original and is ready as far as I’m concerned. I’ve experienced no crashes yet and the performance has been fine (though I do have a relatively beefy PC). As long as population counts can be kept high enough (and with that, enough team minded players) this is going to be a great game. And I personally welcome the micro payment model SOE are going for. I am a grown-up nowadays, with a grown-up job and grown-up pubs to go to so my play time is extremely limited but valuable. I may need to make the odd use of a purchase to keep my character in line with others and allow me to make the most of my play rather than having to grind into the small hours just to keep up with everybody else.

I just hope they don’t mess something up before it is released.

June 1, 2012

Extending a Logical Volume to give it more space

This can be done while the machine is running (and supposedly while people are using it).

Finding out what needs extending and how

First, use the vgdisplay command to see how much free unallocated space there is in the volume group that hasn’t been allocated yet:

[root@macbookpro ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_macbookpro
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               37.79 GiB
  PE Size               4.00 MiB
 Total PE              9673
  Alloc PE / Size       8810 / 34.41 GiB
  Free  PE / Size       863 / 3.37 GiB
  VG UUID               8qPjBN-Iu6v-43i2-PjmO-Fzra-h4Mv-xO8jd7

The Free PE / Size section shows how much space there is available. So here we can see that the Free PE / Size states there are 863 extents which equal 3.37GiB (an extent is a logical unit in LVM. You can see in the PE Size field that each extent equals a 4.00MiB block).

Armed with this information we know that we can up a volume by this amount. Next use lvdisplay -m command to show the logical volumes on a running system. This will produce output such as the following:

--- Logical volume ---
LV Name                /dev/vg_macbookpro/LogVolSamba
VG Name                vg_macbookpro
LV UUID                vqxqAS-S3yB-Ac3v-14rQ-szgY-nLpi-JAAny1
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                4.88 GiB
Current LE             1250
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:1

--- Segments ---
Logical extent 0 to 1249:
  Type                linear
  Physical volume     /dev/sda3
  Physical extents    2500 to 3749


--- Logical volume ---
LV Name                /dev/vg_macbookpro/LogVolUniverse
VG Name                vg_macbookpro
LV UUID                LcUjYF-bD7k-4f19-K60w-Ifx7-CtUz-sk50xK
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                23.14 GiB
Current LE             5923
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:2

--- Segments ---
Logical extent 0 to 5922:
  Type                linear
  Physical volume     /dev/sda3
  Physical extents    3750 to 9672

The -m switch shows some info on the physical device underneath which we need to know to ensure we attempt to extend our volume with disk space from the same drive (you can extend it using space on another drive if, for example, you’ve installed a new drive and you are using this to increase the space of a partition).

We can also see the name of the volume that we want to extend.

Extending the Volume

Use the lvextend command to add extents/space to the volume. This can be specified either in size units of extents.

This is specifying the amount of additional size we want to add on:

lvextend -L +3.37GB /dev/vg_macbookpro/LogVolUniverse /dev/sda3

This is specifying the number of extents to add on:

lvextend -l +100%FREE /dev/vg_macbookpro/LogVolUniverse /dev/sda3

You’ll see something like the following:

Extending logical volume LogVolUniverse to 23.14 GiB
Logical volume LogVolUniverse successfully resized

The second command states to use 100% of the free extents. You can just specify a literal number of extents to add. Once you’ve increased the volume to have the required space, you need to resize the partition to include that space. This can be done with the system “online” and running. As I installed Ext3 as the filesystem, use the following command:

resize2fs /dev/vg_macbookpro/LogVolUniverse

You should see some messages saying (the actual amounts will be different):

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_macbookpro/LogVolUniverse is mounted on /universe; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_macbookpro/LogVolUniverse to 6065152 (4k) blocks.
The filesystem on /dev/vg_macbookpro/LogVolUniverse is now 6065152 blocks long.

May 20, 2012

Changing the Caps Lock Key into the Control Key

If you use Emacs bindings (either in the editor itself or wherever GNU Readline is used) then shifting the control key to the left of the home row will save a lot of finger ache.

Fedora (CLI)

Edit /etc/sysconfig/keyboard to use the “emacs” keytable

KEYTABLE="emacs"
MODEL="pc105"
LAYOUT="gb"

Fedora (X)

If you’re using Gnome (and probably KDE) you can change this with a graphical tool. However, I use Awesome as my window manager which has no such thing. Instead, you need to use xmodmap to alter the key bindings. Pop the following in a file called .xmodmap then run xmodmap .xmodmap and it will swap the control key with the caps lock. This should probably be run from .bashrc or some similar file:

remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

Debian

Edit /etc/default/keyboard to have the following in as well (it may be there but blank):

XKBOPTIONS="ctrl:nocaps"

Then run dpkg-reconfigure -phigh console-setup.

May 18, 2012

Manipulating the kernel's page cache with vmtouch

I came across vmtouch the other day which looked rather interesting. It allows you to check how much of a file or directory is currently loaded into the kernel’s virtual memory page cache. This is useful if you want to check your assumptions about why a process is performing outside what you expect (too fast/too slow) by seeing how much of a file is pre-loaded in RAM.

You can also evict particular files from RAM that are already loaded into cache or inform the kernel that you would like certain files/directories to be kept in RAM if possible (the kernel will still boot things out of the file cache if it deems it necessary to provide RAM for other processes AFAIK).

My thoughts on its use were to:

  • Preload data files before processing to avoid page faults occuring during processing. For example, to load a large pre-computed dictionary or rainbow table for brute forcing a password file.
  • Load a database into memory post-boot of a DB machine and lock it in place so it performs optimally from the get go (this assumes you have enough RAM to keep the whole thing there). I believe that this is basically how Redis works; loading itself and its data into RAM before allowing queries. As DB machines typically are dedicated machines, there’s no point waiting for page faults to occur on parts of the database that haven’t been loaded yet.
  • Ensure a static file proxy (whose only job is serving images/css/js for a website) has the static file directory loaded into RAM when it is brought up so it can start serving files quickly straight away (and from cache rather than needing I/O). In this instance, unless you had plenty of RAM for everything, you’d allow the kernel to swap out unused files as and when needed.

These pre-loading use cases could be incredibly useful when dealing with Virtual Machines whose backing store may not even be local to the VM (either on a SAN or are on a “cloud” service backing store). As the disk I/O is actually on another machine and transmitted to “disk” via the network, I/O operations are even more expensive than on a dedicated machine.

February 18, 2012

Setting up a Tor relay on Debian Squeeze

Tor is an anonymising relay system allowing people to reach sites on the internet without other parties being able to snoop on the traffic or to see what sites are connected to. This means that people living in regimes where their internet connection is censored (or for the super paranoid) they can connect to servers they wouldn’t otherwise be able to (such as Google Mail, Facebook, Twitter etc.).

As the system runs entirely with the help of volunteers running relays to share bandwidth and load, I decided to set one up on my hosting service using the following process.

Firstly, alter /etc/apt/sources.list to include the tor apt repositories. This not only avoids having to perform compilation and some messy config, but also means that a server doesn’t need to have a build chain installed. Currently the line you need in your sources file looks like the following:

deb http://deb.torproject.org/torproject.org squeeze main

though you should check on their site here in case this has changed at any point (and where it says ‘squeeze’ you should change it to match the version of Debian you’re running).

Then install Tor with:

gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key \
    add -
apt-get update
apt-get install deb.torproject.org-keyring    
apt-get install tor arm

I installed arm as a CLI means of keeping an eye on tor. This isn’t necessary but very useful. You will then need to edit the /etc/tor/torrc file. This should have mostly sensible defaults but the following should probably be changed:

# I set this to 0 as this is my server and I don't need to join
# tor as a client from it 
SocksPort 0

# I left this as the default but it does need to be specified
ORPort 9001

# Give your relay a nickname
Nickname armcd

# These specify how much bandwidth you want to provide. Use the
# rate in tandem with the AccountingMax option to make sure
# you don't go above your bandwidth quota set by your ISP. If this is
# too high, heavy tor traffic will result in your relay always
# hitting the imposed limit really quickly and going into hibernation
# soon after it resets. You want to try and avoid this flip flopping.
RelayBandwidthRate 100 KB
RelayBandwidthBurst 200 KB
AccountingMax 2 GB

# This is used if it is detected that your relay is doing something 
# daft. This is public so choose an account you're not worried
# being seen on the tor relay list.
ContactInfo <enter what you want here>

# I use this list of exit policies to make sure that most traffic
# that people could want to communicate can get through, but
# stopping people using bittorrent easily. Unfortunately bittorrent
# can lead to abuse complaints from your ISP (to them it appears 
# as if you're using bittorrent) and it will also ruin your
# bandwidth. It is very unlikely that people who are attempting to
# avoid censorship are going to be using bittorrent. It is more
# likely to be Americans trying to avoid MPAA notices. I
# shamelessly stole this off the tor forums.
ExitPolicy accept *:20-23     # FTP, SSH, telnet
ExitPolicy accept *:43        # WHOIS
ExitPolicy accept *:53        # DNS
ExitPolicy accept *:79-81     # finger, HTTP
ExitPolicy accept *:88        # kerberos
ExitPolicy accept *:110       # POP3
ExitPolicy accept *:143       # IMAP
ExitPolicy accept *:194       # IRC
ExitPolicy accept *:220       # IMAP3
ExitPolicy accept *:443       # HTTPS
ExitPolicy accept *:464       # kpasswd
ExitPolicy accept *:531       # IRC/AIM
ExitPolicy accept *:543-544   # Kerberos
ExitPolicy accept *:563       # NNTP over SSL
ExitPolicy accept *:706       # SILC
ExitPolicy accept *:749       # kerberos
ExitPolicy accept *:873       # rsync
ExitPolicy accept *:902-904   # VMware
ExitPolicy accept *:981       # Remote HTTPS management for firewall
ExitPolicy accept *:989-995   # FTP over SSL, Netnews Administration System, telnets, IMAP over SSL, ircs, POP3 over SSL
ExitPolicy accept *:1194      # OpenVPN
ExitPolicy accept *:1220      # QT Server Admin
ExitPolicy accept *:1293      # PKT-KRB-IPSec
ExitPolicy accept *:1500      # VLSI License Manager
ExitPolicy accept *:1533      # Sametime
ExitPolicy accept *:1677      # GroupWise
ExitPolicy accept *:1723      # PPTP
ExitPolicy accept *:1863      # MSNP
ExitPolicy accept *:2082      # Infowave Mobility Server
ExitPolicy accept *:2083      # Secure Radius Service (radsec)
ExitPolicy accept *:2086-2087 # GNUnet, ELI
ExitPolicy accept *:2095-2096 # NBX
ExitPolicy accept *:2102-2104 # Zephyr
ExitPolicy accept *:3128      # SQUID
ExitPolicy accept *:3389      # MS WBT
ExitPolicy accept *:3690      # SVN
ExitPolicy accept *:4321      # RWHOIS
ExitPolicy accept *:4643      # Virtuozzo
ExitPolicy accept *:5050      # MMCC
ExitPolicy accept *:5190      # ICQ
ExitPolicy accept *:5222-5223 # XMPP, XMPP over SSL
ExitPolicy accept *:5228      # Android Market
ExitPolicy accept *:5900      # VNC
ExitPolicy accept *:6660-6669 # IRC
ExitPolicy accept *:6679      # IRC SSL
ExitPolicy accept *:6697      # IRC SSL
ExitPolicy accept *:8000      # iRDMI
ExitPolicy accept *:8008      # HTTP alternate
ExitPolicy accept *:8074      # Gadu-Gadu
ExitPolicy accept *:8080      # HTTP Proxies
ExitPolicy accept *:8087-8088 # Simplify Media SPP Protocol, Radan HTTP
ExitPolicy accept *:8443      # PCsync HTTPS
ExitPolicy accept *:8888      # HTTP Proxies, NewsEDGE
ExitPolicy accept *:9418      # git
ExitPolicy accept *:9999      # distinct
ExitPolicy accept *:10000     # Network Data Management Protocol
ExitPolicy accept *:19294     # Google Voice TCP
ExitPolicy accept *:19638     # Ensim control panel
ExitPolicy reject *:*

Once you have this set up, start tor with /etc/init.d/tor start. Check the logs to make sure it has started without errors. You’re looking for lines like the following:

[notice] Tor 0.2.2.35 (git-73ff13ab3cc9570d) opening new log file.
[notice] Parsing GEOIP file /usr/share/tor/geoip.
[notice] OpenSSL OpenSSL 0.9.8o 01 Jun 2010 looks like version 0.9.8m or later; I will try SSL_OP to enable renegotiation
[notice] Bootstrapped 5%: Connecting to directory server.
[notice] I learned some more directory information, but not enough to build a circuit: We have no network-status consensus.
[notice] Bootstrapped 10%: Finishing handshake with directory server.
[notice] Bootstrapped 15%: Establishing an encrypted directory connection.
[notice] Bootstrapped 20%: Asking for networkstatus consensus.
[notice] I learned some more directory information, but not enough to build a circuit: We have no network-status consensus.
[notice] Bootstrapped 25%: Loading networkstatus consensus.
[notice] Bootstrapped 45%: Asking for relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 0/2955 usable descriptors.
[notice] Bootstrapped 50%: Loading relay descriptors.
[notice] Bootstrapped 53%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 96/2955 usable descriptors.
[notice] Bootstrapped 57%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 192/2955 usable descriptors.
[notice] Bootstrapped 61%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 288/2955 usable descriptors.
[notice] Bootstrapped 65%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 384/2955 usable descriptors.
[notice] Bootstrapped 68%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 480/2955 usable descriptors.
[notice] Bootstrapped 72%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 576/2955 usable descriptors.
[notice] Bootstrapped 76%: Loading relay descriptors.
[notice] I learned some more directory information, but not enough to build a circuit: We have only 672/2955 usable descriptors.
[notice] We now have enough directory information to build circuits.
[notice] Bootstrapped 80%: Connecting to the Tor network.
[notice] Bootstrapped 90%: Establishing a Tor circuit.
[notice] Tor has successfully opened a circuit. Looks like client functionality is working.
[notice] Bootstrapped 100%: Done.
[notice] Interrupt: exiting cleanly.

If you have control of your DNS, you may want to put a reverse DNS entry for your domain so that if anyone does a dig -x on your IP address they get a result showing you run a tor proxy. This will mean if they’re investigating things in their logs, see that your running a tor relay, they may realise that you are probably not the original generator of that traffic.

February 16, 2012

Joining NTPd to The NTP Pool Project

Keeping time — or at least, accurate time — is slightly tricky. The components inside a computer that perform the ticking are incredibly inaccurate and, left to their own devices, the clocks inside computers would slowly drift apart from each other. This can make it hard to track down problems as timestamps in log files will be wrong and certain security systems just start breaking down. Kerberos, a common network security protocol which Active Directory is also based on, requires everything under the same domain to have roughly analogous time.

To keep them vaguely in sync, most computers use a system called the Network Time Protocol. This is a means for interconnected computers to share timing information between themselves. Typically there is a hierarchy with the machine(s) at the top hooked up to some accurate time keeper such as an atomic clock and the machines further down the pyramid distributing the timing information to the siblings below.

In the early days of the net, there were a number of time servers running that people just connected to, usually run by government agencies that could afford to operate atomic clocks. Initially provided as a service to aid the burgeoning internet, they soon started being abused. To counter this, the NTP Pool Project was born; a collection of volunteer computers working together to buffer the definitive time sources from high levels of traffic. The NTP pool project purports to serve between 5 and 15 million machines though this is almost certainly an understatement as most distributions of Linux, various brands of routers, phones etc. are all configured to ascertain timing from the pool.

Joining the Pool

To join the pool you need at static IP address and an always on server. I’ve done this on Fedora/Red Hat and with Debian. The config for ntpd is similar over most distros. Install ntpd with either:

apt-get install ntp

or

yum install ntp

Chances are, ntpd is already installed. Open up the config file /etc/ntp.conf and remove the lines beginning with server that the distro may have put in. These most likely are set to connect to the pool already (and should be using the distro’s “vendor pool”).In place of these server lines, put 5 new server lines with hard coded ntp servers picked from either ntp.org’s list of stratum 2 servers or pick some servers from the pool. It’s a good idea to choose servers that are (network) close to yours. I went for the following as they’re all University’s in the UK so should be pretty close to me and permanent.

server ntp1.luns.net.uk
server ntp2d.mcc.ac.uk
server ntp2c.mcc.ac.uk
server ntp.cis.strath.ac.uk
server extntp1.inf.ed.ac.uk

Restart ntpd (or start it if it wasn’t already running) and use netstat -l to see whether it is listening on UDP port 123. Make sure you open the port on your firewall as well.

Then give it a test by pointing your local machine at your new NTP server. To check on a Linux machine, edit the /etc/ntp.conf file to have a server line listing your static machine and restart the service. Either check the logs or use ntpq -p to see whether it was able to sync successfully.

On Windows 7/Vista, open Control Panel and then go to Date and Time -> Internet Time -> Change Settings and put your server into the box. Hit update and Windows should say it synced.

Continue reading Joining NTPd to The NTP Pool Project.

July 23, 2011

SMTP and "No authenticators available"

This is as much a note to myself, and I'm sorry that this is almost certainly very boring to anyone who isn't interested in Linux.

I've been using Mutt as an email client for some time, however, when I installed Fedora on my mac I found SMTP programs (mutt using its own SMTP plugin and Postfix) kept giving me "no authenticators available" messages from SASL. However, the cyrus-sasl package was installed and, as far as I could tell, the configuration was correct.

The problem turned out to be down to my own stupidity during the installation. I had installed Fedora from the net installer and told it to install a basic version of the OS (i.e. no desktop stuff) thinking I could just yum install the things I wanted to later on as and when I needed. However, coming from Debian, I didn't realise that yum would not pull in everything needed. cyrus-sasl is split into various packages on Fedora and although the generic one was installed, the authenticators are in separate packages.

A quick

yum install cyrus-sasl-plain

and everything worked.

March 28, 2011

The Picture of Dorian Gray

The Kindle app on my tablet has inspired me to read some old classics that I have always passed by. When faced with paying £5 for a penguin classic or forking over for the latest Alistair Reynolds or Richard Morgan, the latter have always prevailed.

However, with easy access freebies in a conveniently small package I have been plowing through all those books our English Lit teachers told us we should have read. Although not the first book I read on the Kindle (that falls to The Adventures of Sherlock Holmes) it is the first that has surprised me with how much I enjoyed it.

Typically I like books due to their story and characters however this time I was struck as much by the writing itself. Oscar Wilde has managed to tie the language to the story so that it has become intrinsically part of the narrative.

The Picture of Dorian Gray details the life of a gentleman in late 1800's England called Dorian Gray who is bestowed with almost unnatural beauty and magnetic charisma. People love him on first sight and wish nothing more than to be near him believing themselves to be in the prescence of someone great. Through his friendship with an artist the infamous picture is created of him. And through a meeting with one of the artist's friends — Henry — a misplaced oath leads to an infamous curse whereby the picture takes on the taint of life rather than Dorian. Never growing old, Dorian launches himself into living the high life on the heels of his "mentor", Henry.

Henry imparts on Dorian the idea that beauty is itself more valuable than anything else; that to create or to observe beautiful things has more value than those of form or function. Tied to the love of beautiful things is the need to experience as much of them as possible. To experience all that life has to offer regardless of what form that might take or to the consequences of such a quest.

The prose, often in the form of Henry's dialogue, enforces this ideal with Oscar Wilde's formidable grasp of English. Sentences tumble over each other throughout always seeming as if they have intertwined together perfectly. Words effuse and emote as much as any description leaving a sense of how prose can be written beautifully. In the same way a line of algebra can discern secrets of the universe to a physicist, Wilde's language carries with it something of the form of the beauty that his protagonists are craving. A situation is not just explained; it is explained elegantly.

Throughout the book I felt as if I should subscribe to Henry's point of view, and drawn to Dorian's choice of life. They both are young, rich and wanted and rarely seem to worry about anything other than how to keep themselves entertained. When following Henry's discourses on aesthetics, as he encourages others to look at life the way that he does, I wanted to believe him. That beautiful things have in them an innate worth greater than anything else. When the narrator follows suit in the intervening passages it drives home the feeling that this is how one should lead life. Interspersed throughout the novel are various inconsequential dinner guests seeming to embody stereotypical "boring" professions (which I can't help but feel Oscar Wilde would include me in) which are ridiculed for not being able to see this point of view.

However, as the book progresses the mood starts to change. The world that Dorian Gray has created for himself becomes more ugly; seemingly at odds with his proscribed mission and Wilde's writing. The path of Dorian's life diverges from the language as he becomes more tainted by his acts. A small step here translates into a large leap later on to the point where his initial innocence seems hard to believe. Near the end of the book, his portrait has taken on a phantasmic quality; still portraying Dorian but mirroring the tragedy of his life as Dorian looks on. In a similar fashion, the language is still beautiful — constructed to great effect — but by describing something horrific takes on Dorian's double life. This juxtaposition is the great acheivement of this book.

March 7, 2011

Who doesn't love zombies?

So I've decided to take part in the Dream.Build.Play competition run by Microsoft. The idea is to build an indie game for the Xbox 360 in 3 months and publish it on their Indie Game section of Xbox Live. Mainly a marketing ploy but also an attempt to introduce more people to their development tools by offering cash prizes (and recognition for making a cool game, but mostly the cash).

Being a total sucker — and hideously unemployed — I have ripped out my Linux hard drive, replaced it with a fresh hard disk and installed a crappy old copy of Windows XP. It took a day, mostly spent fighting product key error messages and applying patches (I may have been briefly distracted by a few games of Portal as well…), but I now have a fully functioning development machine with all the C# compilers etc. running.

Now my cunning idea. I have decided to couple my love of turn based "strategy" games with zombies; some sort of mash up between Left 4 Dead and X-COM. I love turn based games as you don't need amazing reactions and a mouse finger like a jack hammer. Instead you can pause, maybe put on some music, lean back in your chair, steeple your fingers, enjoy a cup of tea, ruminate on various outcomes, then finally make your move. In my case this inevitably still leads to an hideous, messy, crushing defeat — animated body parts scattering to all four corners of the game world — but at least the outcome was entirely my own strategic ineptitude. I nearly always have one more go believing that I've got the right strategy pegged this time.

It also has advantages from a programming point of view. Initially I can make the game just a 2D top down affair with crappy graphics while I get a load of the programming done. The actual game relies on the positions of characters on the board rather than what the character models are doing. I'll deal with artwork later once I find someone to persuade/bribe into doing it for me and I learn how to do 3D graphics. Or if worse comes to worst I'll just leave it as shitty 2D game. It can look retro and 8-bit to hide the fact I don't know what the hell I'm doing. "This is what I came up with without an art department to make me meshes and textures".

There's also more mundane stuff such as the world doesn't need to be massive and beautiful with flashy lights. Glum and gloomy with low zombie moaning is far more fitting and much easier to do for someone who doesn't know what they're doing. Also save games are easier to deal with as you're just saving character positions and what level, rather than tracking the location of dynamic objects. Multiplayer is the same; sending move information over the wire rather than tracking multiple objects flying round the screen.

Anyhow, even if the rest of the game is shit, it still has zombies in it. And who doesn't love zombies?

November 30, 2010

FP!

I'm intent on trying to be a little more pro-active when it comes to being a geek. I've started using twitter more (mainly to post inane crap to my friends) and now I'm going to attempt to keep a blog going. It will probably end up more as a means to keep track of computer problems that I've had to solve so I can find out the solution again later on.

However, they may prove useful to someone else at some point...