Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor build and documentation improvements #18

Merged
merged 17 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/slow_openwrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Set ref
run: |
echo "N2N_REF=$(./scripts/version.sh)" >> $GITHUB_ENV
echo "N3N_REF=$(./scripts/version.sh)" >> $GITHUB_ENV
./scripts/version.sh
working-directory: src

Expand Down Expand Up @@ -91,10 +91,10 @@ jobs:

- name: Build openwrt packages
env:
N2N_PKG_VERSION: ${{ env.N2N_REF }}
PKG_VERSION: ${{ env.N3N_REF }}
run: |
echo "Build for $N2N_PKG_VERSION"
export N2N_PKG_VERSION
echo "Build for $PKG_VERSION"
export PKG_VERSION
make package/n3n/clean V=s
make package/n3n/prepare USE_SOURCE_DIR=$GITHUB_WORKSPACE/n3n V=s
make package/n3n/compile V=s
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@
include:
- name: mips_24kc
sdk_ver: 22.03.3
sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/xrx200/openwrt-sdk-22.03.3-lantiq-xrx200_gcc-11.2.0_musl.Linux-x86_64.tar.xz

Check warning on line 365 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

365:81 [line-length] line too long (155 > 80 characters)

Check warning on line 365 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

365:81 [line-length] line too long (155 > 80 characters)
- name: i386_pentium4
sdk_ver: 22.03.3
sdk: https://downloads.openwrt.org/releases/22.03.3/targets/x86/generic/openwrt-sdk-22.03.3-x86-generic_gcc-11.2.0_musl.Linux-x86_64.tar.xz

Check warning on line 368 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

368:81 [line-length] line too long (151 > 80 characters)

Check warning on line 368 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

368:81 [line-length] line too long (151 > 80 characters)
- name: x86_64
sdk_ver: 22.03.3
sdk: https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/openwrt-sdk-22.03.3-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz

Check warning on line 371 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

371:81 [line-length] line too long (141 > 80 characters)

Check warning on line 371 in .github/workflows/tests.yml

View workflow job for this annotation

GitHub Actions / Code syntax

371:81 [line-length] line too long (141 > 80 characters)

defaults:
run:
Expand Down Expand Up @@ -412,7 +412,9 @@

- name: Build openwrt packages
run: |
export PKG_VERSION=$(../n3n/scripts/version.sh)
export BUILD_VERSION=$(../n3n/scripts/version.sh)
export BUILD_SOURCE_URL=https://github.com/${{github.repository}}
export BUILD_SOURCE_REF=$GITHUB_REF
echo "Build for $PKG_VERSION"
make package/n3n/clean V=s
make package/n3n/prepare USE_SOURCE_DIR=$GITHUB_WORKSPACE/n3n V=s
Expand Down Expand Up @@ -686,3 +688,4 @@
artifacts/packages-dpkg/*.deb
artifacts/packages-rpm/*.rpm
artifacts/packages-ipk/*/base/*.pkg
artifacts/x86_64-w64-mingw32/usr/local/sbin/*.exe
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ LINT_CCODE=\
# TODO: change either the files or the linter to remove these failures
LINT_EXCLUDE=include/uthash.h|include/lzodefs.h|src/minilzo.c

DOCS=edge.8.gz supernode.8.gz n3n.7.gz
DOCS=n3n-edge.8.gz n3n-supernode.8.gz n3n.7.gz

# This is the list of Debian/Ubuntu packages that are needed during the build.
# Mostly of use in automated build systems.
Expand Down Expand Up @@ -346,7 +346,7 @@ distclean:
rm -f tests/*.out src/*.indent src/*.unc-backup*
rm -rf autom4te.cache/
rm -f config.mak config.log config.status configure include/config.h include/config.h.in
rm -f edge.8.gz n3n.7.gz supernode.8.gz
rm -f n3n-edge.8.gz n3n.7.gz n3n-supernode.8.gz
rm -f packages/debian/config.log packages/debian/config.status
rm -rf packages/debian/autom4te.cache/
rm -f packages/rpm/config.log packages/rpm/config.status
Expand All @@ -368,16 +368,15 @@ install.bin: apps
.PHONY: install.systemd
install.systemd:
$(INSTALL) -d $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/edge@.service $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/edge.service $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/supernode.service $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/n3n-edge@.service $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/n3n-edge.service $(CONFIG_SYSTEMDDIR)
$(INSTALL_DOC) packages/lib/systemd/system/n3n-supernode.service $(CONFIG_SYSTEMDDIR)

.PHONY: install.doc
install: edge.8.gz supernode.8.gz n3n.7.gz
install: n3n-edge.8.gz n3n-supernode.8.gz n3n.7.gz
$(INSTALL) -d $(MAN7DIR) $(MAN8DIR) $(CONFIG_DOCDIR)
$(INSTALL_DOC) edge.8.gz $(MAN8DIR)/
$(INSTALL_DOC) supernode.8.gz $(MAN8DIR)/
$(INSTALL_DOC) n3n.7.gz $(MAN7DIR)/
$(INSTALL_DOC) n3n-edge.8.gz $(MAN8DIR)/
$(INSTALL_DOC) n3n-supernode.8.gz $(MAN8DIR)/
$(INSTALL_DOC) n3n.7.gz $(MAN7DIR)/
$(INSTALL_DOC) doc/*.md doc/*.sample $(CONFIG_DOCDIR)/

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1
3.3.0
8 changes: 4 additions & 4 deletions apps/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Main apps
edge
supernode
edge.exe
supernode.exe
n3n-edge
n3n-supernode
n3n-edge.exe
n3n-supernode.exe

# Examples
example_edge_embed_quick_edge_init
Expand Down
8 changes: 4 additions & 4 deletions apps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# LDFLAGS+=-L../libs/connslot
# LDLIBS_LOCAL+=-lconnslot

APPS+=edge
APPS+=supernode
APPS+=n3n-edge
APPS+=n3n-supernode

EXAMPLES+=example_edge_embed_quick_edge_init
EXAMPLES+=example_edge_embed
Expand All @@ -38,8 +38,8 @@ $(APPS) $(EXAMPLES): ../src/libn3n.a
.PHONY: install
install: $(addsuffix $(EXE),$(APPS))
$(INSTALL) -d $(CONFIG_SBINDIR)
$(INSTALL_PROG) supernode$(EXE) $(CONFIG_SBINDIR)/
$(INSTALL_PROG) edge$(EXE) $(CONFIG_SBINDIR)/
$(INSTALL_PROG) n3n-supernode$(EXE) $(CONFIG_SBINDIR)/
$(INSTALL_PROG) n3n-edge$(EXE) $(CONFIG_SBINDIR)/

# See comments in the topdir Makefile about how to generate coverage data.
gcov:
Expand Down
2 changes: 0 additions & 2 deletions apps/edge.c → apps/n3n-edge.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ static const struct option long_options[] = {
};

static const struct n3n_config_getopt option_map[] = {
{ 'A', "community", "cipher", NULL },
{ 'O', NULL, NULL, NULL, "<section>.<option>=<value> Set any config" },
{ 'V', NULL, NULL, NULL, " Show the version" },
{ 'a', NULL, NULL, NULL, "<arg> Set tuntap.address and tuntap.address_mode" },
Expand All @@ -112,7 +111,6 @@ static const struct n3n_config_getopt option_map[] = {
{ 'l', "community", "supernode", NULL },
{ 'r', "filter", "allow_routing", "true" },
{ 'v', NULL, NULL, NULL, " Increase logging verbosity" },
{ 'z', "community", "compression", NULL },
{ .optkey = 0 }
};

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions debian/n3n.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if [ "$1" = "configure" ]; then

# TODO: It would be nice if the dh_systemd_start handled templated services
if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
if systemctl is-active --quiet 'edge@*.service'; then
systemctl try-restart 'edge@*.service'
if systemctl is-active --quiet 'n3n-edge@*.service'; then
systemctl try-restart 'n3n-edge@*.service'
fi
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions doc/Advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Read about [Configuration Files](ConfigurationFiles.md) as they might come in ha
edge can also be run as a service instead of cli:

1. Edit `/etc/n3n/edge.conf` with your custom options. See [a sample](edge.conf.sample).
2. Start the service: `sudo systemctl start edge`
3. Optionally enable edge start on boot: `sudo systemctl enable edge`
2. Start the service: `sudo systemctl start n3n-edge`
3. Optionally enable edge start on boot: `sudo systemctl enable n3n-edge`

You can run multiple edge service instances by creating `/etc/n3n/instance1.conf` and
starting it with `sudo systemctl start edge@instance1`.
starting it with `sudo systemctl start n3n-edge@instance1`.


## Communities
Expand Down
10 changes: 5 additions & 5 deletions doc/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ environment. The password is set with the `auth.password` options.
Continuing the given example, the edge could be invoked by:

```
[user@host n3n]$ sudo ./edge \
[user@host n3n]$ sudo ./n3n-edge \
start \
-l <supernode:port> \
-c netleo \
Expand All @@ -113,8 +113,8 @@ Continuing the given example, the edge could be invoked by:
Note that header encryption already is enabled automatically as this
authentication scheme heavily relies on it. Also, currently only the stream
ciphers work with this authentication scheme reliably in terms of security. So,
`-AChaCha20` or `-ASpeck` along with a key `-k <key>` are required as
additional parameters.
`-Ocommunity.cipher=ChaCha20` or `-Ocommunity.cipher=Speck` along with a key
`-k <key>` are required as additional parameters.

The edges need to know the public key of the supernode. By default, the edges
assume the default federation name, or more specific, the corresponding public
Expand All @@ -131,14 +131,14 @@ auth.pubkey=opIyaWhWjKLJSNOHNpKnGmelhHWRqkmY5pAx7lbDHp4
Considering all this, our example expands to:

```
[user@host n3n]$ sudo ./edge \
[user@host n3n]$ sudo ./n3n-edge \
start \
-l <supernode:port> \
-c netleo \
-Oconnection.description=logan \
-Oauth.password=007 \
-Oauth.pubkey=opIyaWhWjKLJSNOHNpKnGmelhHWRqkmY5pAx7lbDHp4 \
-ASpeck \
-Ocommunity.cipher=Speck \
-k mySecretKey
```

Expand Down
7 changes: 4 additions & 3 deletions doc/BuildConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ the (re-)configuration and before building (again) using `make`.

ZSTD Compression Support

In addition to the built-in LZO1x for payload compression (`-zlzo` at the
edge's commandline), n3n optionally supports
In addition to the built-in LZO1x for payload compression (using the
`community.compression=lzo` option), n3n optionally supports
[ZSTD](https://github.com/facebook/zstd). As of 2020, it is considered cutting
edge and [praised](https://en.wikipedia.org/wiki/Zstandard) for reaching the
currently technologically possible Pareto frontier in terms of CPU power versus
Expand All @@ -34,7 +34,8 @@ ZSTD support can be configured using

`./configure --with-zstd`

which then will include ZSTD. It will be available via `-zzstd` at the edges.
which then will include ZSTD. It will be available via the
`community.compression=zstd` option on the edges.
Of course, it can be combined with the other optimisation features:

`./configure --with-zstd --with-openssl CFLAGS="-O3 -march=native"`
Expand Down
2 changes: 1 addition & 1 deletion doc/Communities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ of 20 bytes. Hence, the community name can never contain a NUL byte. There
are some other characters that cannot be used, namely `. * + ? [ ] \`.

To make full use of character space, hex values could be used, e.g. from Linux
bash applying something like `edge … -c $(echo -en '\x3a\x3b\x4a\x6a\xfa') …`
bash applying something like `n3n-edge … -c $(echo -en '\x3a\x3b\x4a\x6a\xfa') …`
as the command line syntax. If used with a configuration file, the bytes must
be directly filled as characters into the corresponding `community.name` option

Expand Down
10 changes: 5 additions & 5 deletions doc/ConfigurationFiles.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration Files

To help deployment and better handle locally different configurations, n3n
supports the use of configuration files for `edge` and `supernode`.
supports the use of configuration files for `n3n-edge` and `n3n-supernode`.

The daemon will attempt to locate a configuration file based on the
"sessionname" - which defaults to "edge" for the edge daemon. This would
Expand All @@ -12,7 +12,7 @@ They are plain text files formatted very similar to INI files.

To generate the help documentation for all current options:
```bash
edge help config
n3n-edge help config
```

If you created the following `/etc/n3n/testing.conf` file:
Expand All @@ -35,7 +35,7 @@ address_mode = static
which can be loaded by

```
sudo ./edge start testing
sudo ./n3n-edge start testing
```

If needed, the settings from the config file can all be overridden using a
Expand All @@ -44,7 +44,7 @@ command line parameter:
If required, additional command line parameters can also be supplied:

```
sudo edge start testing \
sudo n3n-edge start testing \
-Oconnection.description=myComputer \
-O community.compression=lzo
```
Expand All @@ -53,5 +53,5 @@ Some of the most common options also have a shortcut version, you can see all
these with:

```
edge help options
n3n-edge help options
```
17 changes: 9 additions & 8 deletions doc/Crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

Payload encryption currently comes in four different flavors using ciphers of different origins. Supported ciphers are enabled using the indicated command line option:

- Twofish in CTS mode (`-ATwofish`)
- AES in CBC mode (`-AAES`)
- ChaCha20 (CTR) (`-AChaCha20`)
- SPECK in CTR mode (`-ASpeck`)
- Twofish in CTS mode (`-Ocommunity.cipher=Twofish`)
- AES in CBC mode (`-Ocommunity.cipher=AES`)
- ChaCha20 (CTR) (`-Ocommunity.cipher=ChaCha20`)
- SPECK in CTR mode (`-Ocommunity.cipher=Speck`)

The following chart might help to make a quick comparison and decide what cipher to use:

Expand All @@ -30,11 +30,12 @@ the key can also be supplied through the `N3N_KEY` environment variable: `sudo
N3N_KEY=mysecretpass edge start -c mynetwork -a 192.168.100.1 -l
supernode.ntop.org:7777`.

Providing `-k <key>` without specifying any cipher by `-A_` will default to AES encryption.
Providing a key (with a community.key option) without specifying any cipher
(with a community.cipher` option) will default to AES encryption.

To renounce encryption, `-Anull` enables the so called `null_transform`
transmitting all payload data unencryptedly. Omitting `-A_` and not providing a
key through `-k <key>` shows the same effect.
To renounce encryption, `community.cipher=null` enables the so called
`null_transform` transmitting all payload data unencryptedly. Omitting any
cipher option and not providing a key through `-k <key>` has the same effect.

### Twofish

Expand Down
6 changes: 5 additions & 1 deletion doc/Faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ name via the network, **all** edge nodes should use

Also, please see the `community.list` file coming with n3n for advanced use of that file.

Beyond this access barrier you may want to use payload encryption `-A_` at the edges. Only the edges – not the supernode – are able to decipher the payload data. So, even if anyone would be able to break the access barrier to the supernode, the payload remains protected by the payload crypto, see [this document](Crypto.md) for details.
Beyond this access barrier you may want to use payload encryption (with the
`community.cipher` option) at the edges. Only the edges – not the supernode –
are able to decipher the payload data. So, even if anyone would be able to
break the access barrier to the supernode, the payload remains protected by
the payload crypto, see [this document](Crypto.md) for details.


### Can I get a list of connected edge nodes and their community and source IP address from the supernode?
Expand Down
2 changes: 1 addition & 1 deletion doc/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ make install

or

$ make PREFIX=/usr install
$ make CONFIG_PREFIX=/usr install

Debian Package
--------------
Expand Down
2 changes: 1 addition & 1 deletion doc/Routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ As an alternative to the `tools/n3n-route` utility, the `ip route` linux command
`net.ipv4.ip_forward=1` could be added in /etc/sysctl.d/ – your distro
may vary.
- To allow n3n to forward packets, both edge nodes need to be started
with `-r` option on their command line. All other regular network
with the `filter.allow_routing=true` option on. All other regular network
interfaces usually already allow packet forwarding and thus do not need
any further configuration.

Expand Down
2 changes: 1 addition & 1 deletion doc/TrafficRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The `filter.rule` option can be used multiple times to add multiple rules. Each
`filter.rule` definition adds one rule. for example:

```
edge \
n3n-edge \
-c xxxx \
-k xxxx \
-a 192.168.100.5 \
Expand Down
2 changes: 2 additions & 0 deletions doc/contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Code contributions courtesy of:
* Babak Farrokhi <babak@farrokhi.net> [FreeBSD port]
* Logan oos Even
* Hamish Coleman <hamish@zot.org>

and others, as seen in the commit history.
Loading
Loading