Dave's Free Press: Journal

violence, pornography, and rude words for the web generation

 

Recent posts

(subscribe)

Recently commented posts

(subscribe)

Journals what I read

geeky politics rant silly religion meta music perl weird drinking culture london language transport sport olympics hacking media maths web photography etiquette spam amazon film bastards books bryar holidays palm telecoms cars travel yapc bbc clothes rsnapshot phone whisky security home radio lolcats deafness environment curry art work privacy iphone linux bramble unix go business engineering kindle gps economics latin anglo-saxon money cars environment electronics
Wed, 11 Jun 2008

Per-user resolv.conf files

I want per-user resolv.conf files. I've mentioned this in a couple of places and got asked why. It's so that I can have a consistent set of aliases everywhere I go (so I can, eg, type ssh sdf instead of ssh sverige.freeshell.org) and also so that the resolver will fill in my choice of domain on the end of hostnames, so I can be lazy and type ssh plough instead of ssh plough.barnyard.co.uk.

Some quick googling didn't turn up anything usefully cross-platform, but the implementation shouldn't be too hard - just set LD_LIBRARY_PATH or LD_PRELOAD and provide my own resolver library. Unfortunately, the resolver is part of libc so I need to figure out how to:

  • persuade arbitrary binaries to load an extra library;
  • have that library effectively replace bits of libc ...
  • ... even when the functions I'm replacing are called by other functions in libc

Damn, I might have to read about how the linker actually works if I'm ever to do this.

Posted at 19:10 by David Cantrell
keywords: geeky | unix
Permalink | 5 Comments

Funny enough, I was just working on a testcase involving LD_PRELOAD for random $security-weirdness.

Maybe my results are somehow insightful for you...

Posted by Alexander W. Janssen on Wed, 11 Jun 2008 at 21:16:56


Well... If your use is purely SSH (the only examples you give), I do that in .ssh/config:

Host bleh*

HostName bleh.domain.net

User blehuser

Port 1325

etc...

Posted by vegiVamp on Wed, 25 Jun 2008 at 13:47:03


Any updates? I need something like this too.

Posted by Jab~ on Wed, 17 Feb 2010 at 21:27:45


I'm interested too in per-user resolving (less for host aliases but rather for DNS addresses).

I found the following interesting but not implemented so far:

wWw.nickhill.co.uk/resolver_proposal/

Posted by Raph on Sun, 2 Jan 2011 at 14:11:11


But in the host-file case, the following is the answer :

github.com/apetresc/nss-hostslocal

Posted by Raph on Sun, 2 Jan 2011 at 14:19:16


Sorry, this post is too old for you to comment on it.

Archive