Allow running tinc without RSA keys.

This allows one to run tinc with only Ed25519 keys, forcing tinc to
always use the SPTPS protocol.
This commit is contained in:
Guus Sliepen 2014-12-26 14:38:01 +01:00
parent 266afc6c63
commit 880d74ad2d
2 changed files with 21 additions and 2 deletions

View file

@ -277,6 +277,8 @@ static bool read_rsa_private_key(void) {
if(!fp) {
logger(DEBUG_ALWAYS, LOG_ERR, "Error reading RSA private key file `%s': %s",
fname, strerror(errno));
if(errno == ENOENT)
logger(DEBUG_ALWAYS, LOG_INFO, "Create an RSA keypair with `tinc -n %s generate-rsa-keys'.", netname ?: ".");
free(fname);
return false;
}
@ -780,8 +782,14 @@ static bool setup_myself(void) {
return false;
}
if(!read_rsa_private_key())
return false;
if(!read_rsa_private_key()) {
if(experimental) {
logger(DEBUG_ALWAYS, LOG_WARNING, "Support for legacy protocol disabled.");
} else {
logger(DEBUG_ALWAYS, LOG_ERR, "No private keys available, cannot start tinc!");
return false;
}
}
/* Ensure myport is numeric */