[lug] Publishing config files

Jeff Schroeder jeff at neobox.net
Thu Nov 10 23:47:39 MST 2005


Daniel asked:

> I want to publish a bunch of my config files on my web site, but
> would like a nice clean way to remove passwords or sensitive info. 

My immediate response is to simply pipe the files through sed:

sed -i s/12341234/xxxxxxxx/g config.file

Of course that requires you know the passwords and other "secret" things 
you want to hide.  Your Asterisk example had "12341234" throughout the 
file, so it's an easy fix with the one-liner above.

However, if you want to hide strings that are unknown (but in a 
well-known line format) it's a slightly different story.  Take, for 
example, an /etc/shadow file:

root:kizjbu99eVt2Y:13059:0:99999:7:::
bin:x:13059:0:99999:7:::
jeff:jseCdKn4rtQLk:13059:0:99999:7:::

In this case you'd want to hide all the password hashes (to prevent 
someone from loading them into a brute-force cracker) but you don't 
necessarily know what they are.  This example is probably a job for 
awk, although sed would be useful as well.

In short, it seems to me that simple text substitutions like this don't 
require Perl.  That being said, if you really like Perl, go for it.  
That's the beauty of a big toolbox: you can use a lot of different 
tools for the same job. ;)

HTH,
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20051110/3c08a60b/attachment.pgp>


More information about the LUG mailing list