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

Add ffbs-mesh-vpn-parker #142

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

SmithChart
Copy link
Contributor

This is the core package of gluon-parker,
a Gluon fork that uses routing between the nodes
(aka. Router devices) and the infrastructure.
It is currently in use at Freifunk Braunschweig.
Other communities are interested in adopting it as well.

This package installs the nodeconfig and noderoute services together
with a set of new firewall-rules.

@SmithChart SmithChart requested a review from grische November 6, 2024 20:54
@SmithChart
Copy link
Contributor Author

Well, some of the shellcheck messages for files in /etc/init.d look fun. Will look into that later on..

@SmithChart SmithChart marked this pull request as draft November 7, 2024 06:49
@SmithChart
Copy link
Contributor Author

FTR: @maurerle provided some changes to this package we are currently discussing here. Will un-draft once I have an updated package.

This was referenced Nov 8, 2024
Copy link
Contributor

@grische grische left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments on the shell code

Comment on lines 6 to 12
site_config_server = site.parker.config_server()
uci:section('parker', 'nodeconfig', 'nodeconfig',
{ config_server = site_config_server }
)
uci:save('parker')

site_config_pubkey = site.parker.config_pubkey()
Copy link
Contributor

@grische grische Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice, if we can also add the pubkey to uci so that it's easier to override it on-demand.

Suggested change
site_config_server = site.parker.config_server()
uci:section('parker', 'nodeconfig', 'nodeconfig',
{ config_server = site_config_server }
)
uci:save('parker')
site_config_pubkey = site.parker.config_pubkey()
local site_config_server = site.parker.config_server()
local site_config_pubkey = site.parker.config_pubkey()
uci:section('parker', 'nodeconfig', 'nodeconfig',
{
config_server = site_config_server,
config_pubkey = site_config_pubkey
}
)
uci:save('parker')

and you can delete the lines that write the file to disk afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grische can you verify that this has been resolved by SmithChart#5 ?

Comment on lines 2 to 3
config nodeconfig 'example'
option config_server 'config.community.example'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be

Suggested change
config nodeconfig 'example'
option config_server 'config.community.example'
config nodeconfig 'nodeconfig'
option config_server 'config.community.example'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grische can you verify that this has been resolved by SmithChart#6 ?

fi

pubkey=$(sed 's/+/%2B/g' /etc/parker/wg-pubkey)

Copy link
Contributor

@grische grische Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow-up of the above suggested change to move the pubkey to uci

Suggested change
if ! { echo "untrusted comment: signify public key" && uci -q get parker.nodeconfig.config_pubkey; } > "${SIGN_PUB_KEY}"; then
$LOGGER unable to read or write pubkey from uci
fi

Or maybe something more elegant 😉

I would probably also move the file from flash /etc to ram /tmp instead if it's being written on every service start.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grische can you verify that this has been resolved by SmithChart#5 ?

continue;
fi

config_server=$(uci get parker.nodeconfig.config_server)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we can add a check here if this config exists, to transparently send a log message in case someone broke their UCI config.

Something like

Suggested change
config_server=$(uci get parker.nodeconfig.config_server)
if ! config_server=$(uci get parker.nodeconfig.config_server); then
$LOGGER unable to get config_server from uci
continue
fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grische can you verify that this has been resolved by SmithChart#7 ?


check_batman() {
# check if we have a functional batman-setup
if ip l | grep -q "bat0:"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For style, I would prefer having an early exit here instead of nesting the if's.

Suggested change
if ip l | grep -q "bat0:"; then
if ! ip l | grep -q "bat0:"; then
$LOGGER ERROR: No BATMAN-interface found
return 1
fi

remove the neting and remove lines 23-26 (they have been moved up).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grische can you verify that this has been resolved by SmithChart#8 ?

@blocktrron
Copy link
Member

Please see #139 (comment)

SmithChart and others added 10 commits November 20, 2024 20:22
This adds ffbs-parker-nodeconfig - a package of the *parker*-flavor
of Gluon.

Previously this package has been managed in
https://gitli.stratum0.org/ffbs/ffbs-packages under the name
`gluon-ffbsnext-nodeconfig`.
Last commit-id: 4f83ee2f2571a2baa5493038da7c6fb3cc0b8016
This removes a hard-coded value.
Previously, this scripts have only been used by Freifunk Braunschweig.
There hard-coding was no issue.
Now, with more communities wanting to try parker out, we have to fix
those.

The `ntp_servers` list has already been introduced by Gluon upstream.
With this change we re-use this value here.

This also means that the NTP-server for the nodes should be accessible
for the clients as well.
This firewall rules make sure, that respondd is only accessible from
inside the Freifunk network (client network or VPN) - but not from other
interfaces (e.g. `br-wan`).

While we were only using it for Freifunk Braunschweig the `src_ip`
limitation did not really matter:
Per definition these are the only IPv6 addresses on these interfaces
anyway.

But while preparing this tooling for a wider use we should rethink this
decision.
There is no need to limit access to a specific IPv6 range, as long as
the requests are still coming from the inside.
This check was intended to check if the IPv6 address/routing
configuration is sane.
But it currently relies on a hard-coded value for ffbs, so it does not
make sense to have it for all communities.

Lately we did not see this diagnosis trigger, so it's probably safe to
remove anyway.

If we encounter problems later on we can still add a generic check.
@SmithChart SmithChart force-pushed the ffbs-parker-nodeconfig branch from db1097b to 35b7dc7 Compare November 20, 2024 19:25
@SmithChart
Copy link
Contributor Author

FTR: Appended commits from SmithChart#1 . Thx @maurerle

Also added one change from me while I was on it.

@SmithChart SmithChart changed the title Add ffbs-parker-nodeconfig Add ffbs-mesh-vpn-parker Nov 20, 2024
@maurerle
Copy link
Member

Wouldn't it be useful to also add the additional uci settings required for parker to one of the packages?

Specifically:

and adding

uci:delete_all('firewall', 'rule', function(rule)
	return rule['.name']:find('^mesh_respondd_siteprefix')
end)

instead of having this here:
ffbs/gluon-parker@2e53380#diff-70c0178fef0afe6aa581fdd24bcd19c5ad4f04874648698469f5f5896dc1b500

This would further reduce the required delta of gluon.

SmithChart and others added 9 commits November 27, 2024 20:54
ffbs-mesh-vpn-parker: reduce nesting in noderoute
ffbs-mesh-vpn-parker: check uci for config_server
ffbs-mesh-vpn-parker: fix default parker config
ffbs-mesh-vpn-parker: make sure wg-pubkey exists
ffbs-mesh-vpn-parker: move parker network rules into package
The mesh_respondd_siteprefix and mesh_respondd_extraprefix[0-9]+ rules
do not make sense in the context of parker as there are no prefix4
and prefix6 attributes anymore.

Based on
ffbs/gluon-parker@2e53380#diff-70c0178fef0afe6aa581fdd24bcd19c5ad4f04874648698469f5f5896dc1b500L36-L43
Also moving the pubkey file to /tmp/ as it will be written every
time that nodeconfig is run.
ffbs-mesh-vpn-parker: move parker pubkey to uci
ffbs-mesh-vpn-parker: delete firewall rules for the prefix6 site config
@SmithChart
Copy link
Contributor Author

Wouldn't it be useful to also add the additional uci settings required for parker to one of the packages?

Specifically:

* [ffbs/gluon-parker@1722bc5](https://github.com/ffbs/gluon-parker/commit/1722bc53f5b6612927ee6f49d6c4713321003c63)

* and [ffbs/gluon-parker@42987a0](https://github.com/ffbs/gluon-parker/commit/42987a057518d9b409cd502e37145ae1b8c30e0a)

and adding

uci:delete_all('firewall', 'rule', function(rule)
	return rule['.name']:find('^mesh_respondd_siteprefix')
end)

instead of having this here: ffbs/gluon-parker@2e53380#diff-70c0178fef0afe6aa581fdd24bcd19c5ad4f04874648698469f5f5896dc1b500

This would further reduce the required delta of gluon.

Do not get me wrong: This suggestion is totally right, but I would like to get forward to get this PR ready to merge at the moment.

I would suggest to open an issue against https://github.com/ffbs/gluon-parker/issues and track this suggestion there. After we have got this merged once we can continue to work on reducing the delta of gluon-parker against upstream gluon.

@grische
Copy link
Contributor

grische commented Dec 15, 2024

@SmithChart the suggestions should have been implemented already with the two PRs you merged today

The name of the dependency has been changed during cleanup. So let's
change the dependency here, too.
@maurerle
Copy link
Member

I think if we test the current packages with the latest https://github.com/ffbs/gluon-parker
and it works on your side, we can merge the related packages and this :)

@SmithChart
Copy link
Contributor Author

@maurerle For now it does not work on our side. It is building - but the firmware on the nodes does not work.
My investigation is based on Gluon + site.

On the bright side: The problem seems trivial:
In production mode br-wan is not in table 1. We are missing a network.wan.ip4table='1'.

(On the other hand my automated tests are broken due to the changes in handling of the wg-key. So more error reports are to expect.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants