opened 08:58AM - 02 Oct 25 UTC
Firewall
### Describe the bug
An error occurs when trying to change the SSH port from th…e web admin
### Context
- Hardware: Odroid M1
- YunoHost version: 12.1.26
- I have access to my server: Through SSH, through the webadmin and direct access via keyboard / screen
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: No
- Using, or trying to install package version/branch: N.A.
- If upgrading, current YunoHost version: N.A.
### To reproduce
1. Go to `yunohost/admin/#/tools/settings/security`,
2. Change the SSH port to a value that has never been used yet (meaning the port is not already opened in the firewall)
3. Click on save button
4. Observe error
Error when trying to change the ssh port to 2323 :
```
2025-10-02 08:45:35,041 DEBUG yunohost.log.close - Journal complet de cette opération : '<a href="#/tools/logs/20251002-084525-regen_conf-2_categories" style="text-decoration :underline"> Régénérer les configurations du système '2_categories' </a>'
2025-10-02 08:45:35,177 ERROR yunohost.settings._apply - Post-change hook for setting failed : 2323
2025-10-02 08:45:35,185 ERROR yunohost.configpanel.set - Échec de l'application de la nouvelle configuration : Une erreur inattendue est survenue :
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/yunohost/utils/configpanel.py", line 607, in set
self._apply(self.form, self.config, previous_settings)
File "/usr/lib/python3/dist-packages/yunohost/settings.py", line 264, in _apply
trigger_post_change_hook(
File "/usr/lib/python3/dist-packages/yunohost/settings.py", line 291, in trigger_post_change_hook
f(setting_name, old_value, new_value)
File "/usr/lib/python3/dist-packages/yunohost/settings.py", line 345, in reconfigure_ssh_and_fail2ban
firewall_reload()
File "/usr/lib/python3/dist-packages/yunohost/firewall.py", line 566, in firewall_reload
if firewall.apply(upnp=not skip_upnp):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/yunohost/firewall.py", line 184, in apply
if not self.config["tcp"][ssh_port]["open"]:
~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 2323
```
### Expected behavior
No error, ssh port changed and functional
### Logs
https://paste.yunohost.org/raw/egomagewuj