changing UID/GID after startup of pluto/charon

added --with-uid/--with-gid configure option
This commit is contained in:
Martin Willi
2007-05-07 12:38:46 +00:00
parent a4a3884c83
commit 6874bf698c
16 changed files with 113 additions and 57 deletions
+5
View File
@@ -216,7 +216,11 @@ starter_start_pluto (starter_config_t *cfg, bool debug)
FILE *f;
plog("no %s file, generating RSA key", SECRETS_FILE);
seteuid(IPSEC_UID);
setegid(IPSEC_GID);
system("ipsec scepclient --out pkcs1 --out cert-self --quiet");
seteuid(0);
setegid(0);
/* ipsec.secrets is root readable only */
oldmask = umask(0066);
@@ -229,6 +233,7 @@ starter_start_pluto (starter_config_t *cfg, bool debug)
fprintf(f, ": RSA myKey.der\n");
fclose(f);
}
chown(SECRETS_FILE, IPSEC_UID, IPSEC_GID);
umask(oldmask);
}