I need to make some secure data available to mod_perl handlers, without having it physically stored in a file, database, or "named" shared memory (since if someone can read the handlers' code, then they could read the sensitive data as well). So I need to prompt for it during server (re)start-up, and stuff it away into a lexical variable that only the handler can get at (i.e. another piece of code, or even another handler, that blesses itself into my handler's package still cannot access the data). Every httpd child process should have their own copy of the data. Is there a solution or cookbook recipe for this yet?
Said another way, here's my basic handler code: package MyHandler; use Apache::Constants qw(OK DECLINED); my $SECRET = "secret"; my $SECRETSET = 0; # only allow the secret to be set once, by startup.pl sub set_secret { $SECRET = shift unless $SECRETSET++; } sub handler($$) { if ($SECRET eq "secret") { return DECLINED; } else { # go ahead, make use of $SECRET # ... return OK; } } 1; __END__ And I want startup.pl to do this: use Term::ReadPassword; use MyHandler; MyHandler::set_secret(read_password("Enter secret:")); __END__ Does this make sense? Will this work? Will this be secure? (as long as no one intercepts my call to set_secret() in startup.pl by installing a bogus MyHandler.pm in my lib search path ...). Thanks, -Aaron -- Aaron J Mackey Pearson Laboratory University of Virginia (434) 924-2821 [EMAIL PROTECTED]