mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
added support for COMMUNITY_NAME environment variable (#814)
Co-authored-by: codeneno <qsmy_qin@163.com> Co-authored-by: Logan oos Even <Logan.00sEven@gmail.com>
This commit is contained in:
parent
f093996535
commit
09fdfb0424
|
@ -7,6 +7,8 @@ As communities designate virtual networks, they must be distinguishable from eac
|
||||||
|
|
||||||
To make full use of character space, hex values could be used, e.g. from Linux bash applying the `edge … -c $(echo -en '\x3a\x3b\x4a\x6a\xfa') …` command line syntax. If used with a configuration file, the bytes must be directly filled as characters into a corresponding `-c :;Jjþ` line.
|
To make full use of character space, hex values could be used, e.g. from Linux bash applying the `edge … -c $(echo -en '\x3a\x3b\x4a\x6a\xfa') …` command line syntax. If used with a configuration file, the bytes must be directly filled as characters into a corresponding `-c :;Jjþ` line.
|
||||||
|
|
||||||
|
Apart from command line `-c` and configuration file, the community name can be supplied through the `N2N_COMMUNITY` environment variable. This might prove useful to hide the community name from command line if used with header encryption enabled, see below.
|
||||||
|
|
||||||
|
|
||||||
## Restrict Supernode Access
|
## Restrict Supernode Access
|
||||||
|
|
||||||
|
|
11
edge.8
11
edge.8
|
@ -19,10 +19,10 @@ An equal sign ('=') should be used between key and value. Example: -p=7777
|
||||||
.SH OPTIONS FOR THE UNDERLYING NETWORK CONNECTION
|
.SH OPTIONS FOR THE UNDERLYING NETWORK CONNECTION
|
||||||
.TP
|
.TP
|
||||||
\fB\-c \fR<\fIcommunity\fR>, \fB\-\-community\fR=<\fIcommunity\fR>
|
\fB\-c \fR<\fIcommunity\fR>, \fB\-\-community\fR=<\fIcommunity\fR>
|
||||||
sets the n2n community name. All edges within the same community appear on the
|
sets the n2n community name (see also N2N_COMMUNITY in ENVIRONMENT). All edges
|
||||||
same LAN (layer 2 network segment). Community name is 16 bytes in length. A name
|
within the same community appear on the same LAN (layer 2 network segment).
|
||||||
smaller than this is padded with 0x00 bytes and a name longer than this is
|
Community name is 16 bytes in length. A name smaller than this is padded with
|
||||||
truncated to take the first 16 bytes.
|
0x00 bytes and a name longer than this is truncated to take the first 16 bytes.
|
||||||
.TP
|
.TP
|
||||||
\fB\-l \fR<\fIhost:port\fR>, \fB\-\-supernode-list\fR=<\fIhost:port\fR>
|
\fB\-l \fR<\fIhost:port\fR>, \fB\-\-supernode-list\fR=<\fIhost:port\fR>
|
||||||
sets the n2n supernode IP address and port to register to. Multiple supernodes
|
sets the n2n supernode IP address and port to register to. Multiple supernodes
|
||||||
|
@ -204,6 +204,9 @@ shows detailed parameter description
|
||||||
.TP
|
.TP
|
||||||
.B N2N_KEY
|
.B N2N_KEY
|
||||||
set the encryption key so it is not visible on the command line
|
set the encryption key so it is not visible on the command line
|
||||||
|
.TP
|
||||||
|
.B N2N_COMMUNITY
|
||||||
|
set the community name so it is not visible on the command line
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654
|
.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654
|
||||||
|
|
|
@ -214,6 +214,7 @@ static void help (int level) {
|
||||||
"\n\n environment "
|
"\n\n environment "
|
||||||
"N2N_KEY instead of [-k <key>]"
|
"N2N_KEY instead of [-k <key>]"
|
||||||
"\n variables "
|
"\n variables "
|
||||||
|
"N2N_COMMUNITY instead of -c <community>"
|
||||||
"\n "
|
"\n "
|
||||||
|
|
||||||
"\n meaning of the "
|
"\n meaning of the "
|
||||||
|
@ -326,6 +327,7 @@ static void help (int level) {
|
||||||
printf (" ENVIRONMENT VARIABLES\n");
|
printf (" ENVIRONMENT VARIABLES\n");
|
||||||
printf (" ---------------------\n\n");
|
printf (" ---------------------\n\n");
|
||||||
printf(" N2N_KEY | encryption key (ASCII), not with '-k ...'\n");
|
printf(" N2N_KEY | encryption key (ASCII), not with '-k ...'\n");
|
||||||
|
printf(" N2N_COMMUNITY | community name (ASCII), overwritten by '-c ...'\n");
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf (" AVAILABLE TAP ADAPTERS\n");
|
printf (" AVAILABLE TAP ADAPTERS\n");
|
||||||
|
|
|
@ -3680,6 +3680,11 @@ void edge_init_conf_defaults (n2n_edge_conf_t *conf) {
|
||||||
conf->encrypt_key = strdup(getenv("N2N_KEY"));
|
conf->encrypt_key = strdup(getenv("N2N_KEY"));
|
||||||
conf->transop_id = N2N_TRANSFORM_ID_AES;
|
conf->transop_id = N2N_TRANSFORM_ID_AES;
|
||||||
}
|
}
|
||||||
|
if(getenv("N2N_COMMUNITY")) {
|
||||||
|
strncpy((char*)conf->community_name, getenv("N2N_COMMUNITY"), N2N_COMMUNITY_SIZE);
|
||||||
|
conf->community_name[N2N_COMMUNITY_SIZE - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
conf->metric = 0;
|
conf->metric = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user