changing UID/GID after startup of pluto/charon
added --with-uid/--with-gid configure option
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user