Francisco Javier Martínez Martínez wrote:
>
> Hello.
> Where and how I put the two arguments 'the first is of the form
> ``servername:portnumber'', the second is either ``RSA'' or ``DSA''', It is
> not clear almost for me and I wonder that there must be some people more.
> And as you saids this is a secure matter due that the private password could
> be compromised, if you would please explain (with an example if possible)
> how it works.
> Thanks you in advance.
OK, here we go.
Take my C example from yesterday:
int main(int argc, char** argv)
{
}
argc tells you how many parameters there are in the array argv. The
first element in that array is always the name of the program. So if
mod_ssl passes two parameters to our program, it means they are stored
in the second and third element of argv. With C array indices starting
from 0, that means that
argv[1] is a null-terminated string containing "servername:portnumber".
argv[2] is a null-terminated string containing either "RSA" or "DSA".
You can test these two strings to determine which password your program
has to output. For instance
int main(int argc, char** argv)
{
// defensive test to stop Steve Fairhead from making valid
// points about defensive coding
if (argc == 3)
{
if (strcmp(argv[1],"yourserver:443") == 0
&& strcmp(argv[2],"RSA") == 0)
{
puts("xxxxxx"); // where xxxxxx is the RSA password for
// yourserver listening on port 443
}
}
...
return 0;
}
If all your certificates have the same password, or if there is just
one, you needn't necessarily test for the arguments.
The thing about security is, as some other poster pointed out, if a
hacker can get hold of your password protected key, it's reasonable to
assume he can get hold of your password program as well. All the hacker
then has to do is run that program, pass it the server name and
portnumber as arguments, and see what it prints to know your private key
password. Unless ... if the password program is intelligent enough to
detect it's being executed by a hacker rather than from it't mod_ssl
environment. It would also not be wise, even if the program does check
it's environment, to just have plain readable passwords in your
program's code (as I did above with the xxxxxx), since that too is
easily visible for a hacker who manages to obtain your password program.
And these are just two issues, but there are many, many more such things
to think about. As Ralph points out in the FAQ, just how far you want to
go with this is up to you.
Regards,
Jan Dries
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]