From 32f757922c6ed375664c5d8faa2e5f9f7f148d83 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Sat, 22 Jun 2019 15:46:46 +0200 Subject: [PATCH] Add warning when community and encryption keys match --- edge.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/edge.c b/edge.c index 07626b6..72b6e72 100644 --- a/edge.c +++ b/edge.c @@ -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);