[lug] Publishing config files

David L. Anselmi anselmi at anselmi.us
Fri Nov 11 18:33:56 MST 2005


Daniel Webb wrote:
> On Fri, Nov 11, 2005 at 05:54:07PM -0700, David L. Anselmi wrote:
[...]
>>Rather than a comment that says "12341234 needs replacing", how about a 
>>comment that says "this is the Perl to run to sanitize this file".  Then 
>>you write a script that processes the the files and runs the appropriate 
>>code for each.
>>
>>Maybe that's overkill for your case--you always have one (or a few) 
>>strings in a file to replace.  But in the case of a shadow file, etc., 
>>you might have a field that needs replaced.
> 
> I'm thinking of several different filetypes (Asterisk, Mutt, Vim, etc), and
> each will have different things that will need sanitizing.  I'm sure it will
> all be by hand, there's no way to predict from a pattern which things will be
> "sensitive" and which won't.

It is possible that you'll have several files that use the same form of 
substitutions/syntax/whatever that make each use a different script to 
sanitize them.  So you might build a modular system ala logwatch.  I 
don't know much about how that's coded but it seems a reasonable approach.

> I want the instruction to replace right next to the line where the
> replace will happen, because I know if I don't, I'll end up changing
> the line sometime in the future, the pattern won't match any more, 
> and stuff I don't want on the net will be there.  It's guaranteed to
> happen, so I'm not going to risk it.  If the REPLACE line is right
> there, I'll remember to change it any time I change the line.

I hate having to change the same thing in more than one place.  So you 
might do something like:

; !!!REPLACE:XXXXX:12345
exten = XXXXX,1,SetCIDNum(1112223333)
exten = XXXXX,2,SetCIDName(Someone)
exten = XXXXX,3,Goto(calling_card,s,1)

and then run the script two ways: one way to replace the Xs with the 
real value for use, and another to just remove the REPLACE lines for 
publishing.  Perhaps REPLACE:<place holder>:<real value>:<fake value> 
would be easier to code but you get the idea.

Dave



More information about the LUG mailing list