Skip to content

Commit

Permalink
Pin niroco to port 55184 and open it to incoming VPN traffic
Browse files Browse the repository at this point in the history
By default, niroco allocates an ephemeral server port, which cannot be
effectively firewalled. We can force it to use a specific port with an
INI fragment installed to /usr/share/niroco.d, so that _firewall_config.py can
allow incoming traffic to that port.

We choose port 55184 more or less entirely arbitrarily, but placing it firmly in
the ephemeral range more or less demands that this cannot be the long-term
static port decision.

Signed-off-by: Richard Tollerton <[email protected]>
  • Loading branch information
rtollert committed Dec 16, 2024
1 parent 310138d commit c5cbdb3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ install : all mkinstalldirs $(DIST_FILES)
src/ni-wireguard-labview/ni-wireguard-labview.initd \
"$(DESTDIR)/etc/init.d/ni-wireguard-labview"

# firewall configuration pieces
install --mode=0644 \
src/x-niroco-static-port.ini \
"$(DESTDIR)/usr/share/niroco.d"

# install python library
for pyfile in $(PYNILRT_SNAC_FILES); do \
install -D "$${pyfile}" "$(DESTDIR)$(libdir)/$(PACKAGE)/$${pyfile}"; \
Expand All @@ -121,6 +126,7 @@ mkinstalldirs :
mkdir -p "$(DESTDIR)$(docdir)/$(PACKAGE)"
mkdir -p "$(DESTDIR)$(libdir)/$(PACKAGE)"
mkdir -p "$(DESTDIR)$(sbindir)"
mkdir -p "$(DESTDIR)/usr/share/niroco.d"


uninstall :
Expand Down
4 changes: 4 additions & 0 deletions nilrt_snac/_configs/_firewall_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def configure(self, args: argparse.Namespace) -> None:
"--add-service=ni-rpc-server",
"--add-service=ni-service-locator",
)
_offlinecmd("--policy=work-in",
# Temporary port add; see x-niroco-static-port.ini
"--add-port=55184/tcp",
)
_offlinecmd("--policy=work-out",
"--add-service=amqp",
"--add-service=salt-master",
Expand Down
2 changes: 2 additions & 0 deletions src/x-niroco-static-port.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[RemoteServer]
port=55184

0 comments on commit c5cbdb3

Please sign in to comment.