Add warning when community and encryption keys match

This commit is contained in:
emanuele-f 2019-06-22 15:46:46 +02:00
parent 65c81612ca
commit 32f757922c

7
edge.c
View File

@ -264,7 +264,7 @@ static int setOption(int optkey, char *optargument, n2n_priv_config_t *ec, n2n_e
break;
}
#endif
case 'l': /* supernode-list */
if(optargument) {
if(edge_conf_add_supernode(conf, optargument) != 0) {
@ -325,7 +325,7 @@ static int setOption(int optkey, char *optargument, n2n_priv_config_t *ec, n2n_e
case 'v': /* verbose */
setTraceLevel(4); /* DEBUG */
break;
default:
{
traceEvent(TRACE_WARNING, "Unknown option -%c: Ignored", (char)optkey);
@ -649,6 +649,9 @@ int main(int argc, char* argv[]) {
if(tuntap_open(&tuntap, ec.tuntap_dev_name, ec.ip_mode, ec.ip_addr, ec.netmask, ec.device_mac, ec.mtu) < 0)
return(-1);
if(conf.encrypt_key && !strcmp((char*)conf.community_name, conf.encrypt_key))
traceEvent(TRACE_WARNING, "Community and encryption key must differ, otherwise security will be compromised");
if((eee = edge_init(&tuntap, &conf, &rc)) == NULL) {
traceEvent(TRACE_ERROR, "Failed in edge_init");
exit(1);