website tracking
Logo
Japan
 
My Photo
Name: James Pearce
Location: Perth, WA, Australia

Powered by Blogger

Handling Multiple Warsync Servers
Thursday, June 28, 2007

Warsync is cool, it's like secure-rsync-in-a-box. But it also provides no built in way to manage replication from multiple servers to the same client.

When a client is setup, a private key and a public key is setup. This is a unique key pair for the client / server. The public key is added to the authorized keys list for SSH and the private key is kept on the client.

Warsync will also check itself against the server IP listed in the configuration file on the client.

List of files that change:

  • /root/.ssh/authorized_keys
  • /etc/warsync/client.conf
  • /etc/warsync/client-key
  • /etc/warsync/client-key.pub

The client-key.pub is added to the authorized_keys list automatically by the warsync-config binary. So I wrote a [dirty] rotation script to store these files for different warsync servers to allow fast syncing to different servers. If these files do NOT match the server, the server will probably complain about a version mismatch (when it is in fact an identity mismatch).

/# warsync -avn
######################################################
Replicating xxx (dry-run) ... (1 of 1)
Permission denied (publickey,keyboard-interactive).
!! Client xxx communication protocol differs.
!! Please manually upgrade client to version 0.9.9.
/#

At first, we run the warsync-config file for each server, and copy the config files out from the normal locations each time identifying the config files by server hostname.

Default Warsync File Stored Value For Rotation
/root/.ssh/authorized_keys /root/.ssh/authorized_keys.hostname
/etc/warsync/client.conf /etc/warsync/hostname.conf
/etc/warsync/client-key /etc/warsync/hostname-key
/etc/warsync/client-key.pub /etc/warsync/hostname-key.pub

Now the rotation script will look like this:

#/bin/sh

CONFIGDIR=/etc/warsync

cp $CONFIGDIR/$1.conf $CONFIGDIR/client.conf
cp $CONFIGDIR/$1-key $CONFIGDIR/client-key
cp $CONFIGDIR/$1-key.pub $CONFIGDIR/client-key.pub
cp /root/.ssh/authorized_keys.$1 /root/.ssh/authorized_keys

SSHFS fun with /etc/fstab
Tuesday, June 26, 2007
Just had a problem that really annoyed me with SSHFS and mount.fuse. See, fuse does not have an official mount program in Linux distributions. So there are a couple floating around out there...and the one I'm using is interesting in the sense that it does not tell you when you try and mount a non-existant remote directory!

So executing the following:

sshfs remoteuser@remotehost:/path/to/bin /path/local

Will give an error when /path/to/bin does not exist. But whack that into fstab and it uses the mount.fuse executable. So when you mount /path/to/bin from /etc/fstab, it does it successfully! What happens,

ls: /path/to/bin: Permission denied

And if you check the permissions

?--------- ? ? ? ? ? bin

Also this post has highlighted to me how much I need to get in the habit of structuing the blog posts better...code / terminal output really shouldn't look the same as text heh.
Leeuwin
Monday, June 11, 2007


I've been looking at boats recently. I posted about yachts a while back. Well, yachts are cool...catamarans are nice too. But I think it's hard to go past the beauty of the Leeuwin II :)
Relationship wha?
Friday, June 8, 2007
Girls in relationships with guys because it's fun. Guys having casual sex with girls because it's fun. People breaking up because they can't force the other person to be what they want them to be.
It's a wonder how anyone makes a relationship work!

It seems to be getting worse too. I mean, in my parents generation, people had some breakups. But looking at my generation, it's almost like a fad. "Oh yeah I dated her...not really sure how long, might have ummm...a week?". Why even bother? It seems to me that we don't even bother getting to know a person before we are suddenly in a "relationship" with them! Then well...it's kinda fun and has "benefits" so why break it off? Besides, she knows it's not "serious"! Well whats the point if it's not serious! Maybe just be friends in the first place? Then you probably wouldn't get to the point where you ever needed to break up. You might even become best friends forever. Makes a lot more sense to me than a temporary relationship.

I look at my grandparents generation, and when they got married that way it. I've been told that the mentality back then was more along the lines of, "this is my life and I choose to share it with you". Not "You make me happy, and when that stops I'm finding someone else to make me happy". Problems are always going to come into life. But it's not a problem, it's LIFE. Work it out people, start enjoying life instead of seeing it as a series of problems. I refuse to believe that relationship is supposed to make my life "easier". Great, now I just have to find someone who is shares my beliefs and is single sigh.
Why are you doing that?
Tuesday, June 5, 2007
I was talking today with a friend of mine who is a very successful businessman, asking how he managed to balance his priorities. I mean, starting a business from scratch, and building it to a sustainable level, while balancing family life and finances to keep that startup going, sounds hard!

Basically, it comes back to the reason behind the activity. If the reasoning is big enough, then we prioritise around that. And it's not money. E.g. if I am building a business to be able to increase our income to be able to retire my wife, then I want to do it as fast as possible to make that goal happen. So I cut out recreation in the short term, because the long term goal is more important.

If I am building a business "because I can"...then it will be very difficult to prioritise that business. The same goes for a degree...if you are just at university "because you can be", it can be very hard to prioritise university work above everything else...because there is no ultimate goal. And if I don't prioritise it, then it may take a lot longer to work properly (if at all), to the point where I just don't see any reason in continuing!

So I guess it begs the question...why are you doing what you are doing? What is the ultimate goal you are striving for? And, once you have achived that goal, whats your next goal?

I was once told that the "why" we do something will make the "how" to do it easy. But knowing "how" to do something, does not automatically give us a reason to do it. I mean, think of all the ideas you have had, inventions, business ideas, improvements in other peoples businesses...you have got the "how"...but maybe have not implemented them because you have no "why".