View Issue Details

IDProjectCategoryView StatusLast Update
0002047unrealircdpublic2007-04-19 04:37
Reporteral5001 Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionwont fix 
Summary0002047: New DRpass item.
DescriptionFor those who use passphrases on their server private keys, this would be a handy feature.

When booting up the IRCd, if the server's private key has a passphrase, it must be typed each time. How about adding a feature to DRpass for the IRCd to do this automatically when requesting a /restart?

drpass {
    restart "restartpass";
    passphrase "mykeypassphrase";
    die "diepass";
};
3rd party modules

Activities

codemastr

2004-08-29 17:54

reporter   ~0007455

Well that password is managed by SSL, we really can't access it, as far as I know at least.

aquanight

2004-08-30 03:29

reporter   ~0007462

This is really a pain for using unreal as an NT Service! With no UI to request the passphrase for the private key, it is impossible to start unreal as an NT Service with an encrypted key.

codemastr

2004-08-30 17:28

reporter   ~0007463

Yes, I'm aware of that and I am trying to come up with some system to work around it. The thing is, if the password is just in some textfile, that provides no protection. I mean, then you just hack into the textfile rather than the cert.

I'm not quite sure how to do this, maybe the best way would be to specify a commandline argument wherein you can specify the password.

al5001

2004-09-10 05:30

reporter   ~0007617

Last edited: 2004-09-11 22:59

I think I've got onto something

OpenSSL includes: openssl/err.h, openssl/rsa.h, openssl/pem.h, openssl/md5.h

/* ok..here's our pretyped passphrase */
static char *passphrase = NULL;
passphrase = "mykeypass";

/* rsa privkey crap here */
FILE *privatekey;
RSA *rsa = NULL;


if (!(privatekey = fopen("/path/to/private.key", "r")))
{
/* ahhh it wont open!.. try a crowbar :P */
}
    
rsa = PEM_read_RSAPrivateKey(privatekey, NULL,passphrase_function, NULL);

if(!rsa)
{
/* unable to read private key... (user probably typed an incorrect passphrase) */
}
/* close the thing before it dies... heh...heh.. *taps on the 200mhz dinosaur to make it move faster* */
fclose(privatekey);


Now for the passphrase_function...

static int pass_cb(char *buf, int size, int rwflag, void *u)
{
  int len;
  char *tmp;
  /* well if the passphrase is not specified, then forget about it */
  if (passphrase == NULL)
    return;
  /* if not, let's keep going boys */
  len = strlen(passphrase);
  /* if the length is below or equal to 0, we have a problem, houston, so let's ignore it... or if not, finish up the function before our poor slow machine (200mhz) dies on us :( */
  if (len <= 0)
    return;
  if (len > size)
    len = size;
  memcpy(buf, passphrase, len);
  return len;
}

edited on: 2004-09-11 22:59

Issue History

Date Modified Username Field Change
2004-08-29 17:37 al5001 New Issue
2004-08-29 17:54 codemastr Note Added: 0007455
2004-08-30 03:29 aquanight Note Added: 0007462
2004-08-30 17:28 codemastr Note Added: 0007463
2004-09-10 05:30 al5001 Note Added: 0007617
2004-09-11 22:57 al5001 Note Edited: 0007617
2004-09-11 22:59 al5001 Note Edited: 0007617
2007-04-19 04:37 stskeeps Status new => closed
2007-04-19 04:37 stskeeps Resolution open => wont fix