How to change the default Port 9090?

I would very much like to be able to choose during installation on which port Nethserver listens and whether it should be Public Exposed.

Can someone tell me how to change port 9090 afterwards?

Hi and welcome to NethServer Community,

to change the port one needs to edit the service and the firewall rule. I never tested this before but it seems to work in a first test.

In this example the port is changed to 1234.

Create directory for the listen.conf file:

mkdir -p /etc/systemd/system/cockpit.socket.d/

Create /etc/systemd/system/cockpit.socket.d/listen.conf with following content:

[Socket]
ListenStream=
ListenStream=1234

See also Cockpit TCP Port and Address for more information.

Reload daemons:

systemctl daemon-reload

Restart cockpit socket:

systemctl restart cockpit.socket

Create a custom template for changing the cockpit port in shorewall firewall.

mkdir -p /etc/e-smith/templates-custom/etc/shorewall/rules/

Copy the original fragment:

cp /etc/e-smith/templates/etc/shorewall/rules/70cockpit /etc/e-smith/templates-custom/etc/shorewall/rules/

Edit /etc/e-smith/templates-custom/etc/shorewall/rules/70cockpit and change the port from 9090 to 1234:

my $port = '1234';

Apply the firewall config:

signal-event firewall-adjust

Now the server manager should be reachable on port 1234.

4 Likes