ssh: Use drop-in config component for /etc files

Tests:

- Config files are all symlinks in /etc/

- fail2ban-client show shows sshd in jail list

- When ssh is enabled avahi-browse -a shows SSH and SFTP services. The avahi
service files are created in /etc/avahi/services/. When service is disabled,
files are removed and avahi-browse -a does not show the services.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2023-05-16 12:15:49 -07:00 committed by James Valleroy
parent 56b3c854e4
commit e019f76b40
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
5 changed files with 16 additions and 1 deletions

View File

@ -132,3 +132,6 @@ rm_conffile /etc/apache2/conf-available/searx-freedombox.conf 23.10~
rm_conffile /etc/fail2ban/fail2ban.d/freedombox.conf 23.10~ rm_conffile /etc/fail2ban/fail2ban.d/freedombox.conf 23.10~
rm_conffile /etc/fail2ban/jail.d/freedombox.conf 23.10~ rm_conffile /etc/fail2ban/jail.d/freedombox.conf 23.10~
rm_conffile /etc/apache2/includes/freedombox-sharing.conf 23.10~ rm_conffile /etc/apache2/includes/freedombox-sharing.conf 23.10~
rm_conffile /etc/fail2ban/jail.d/ssh-freedombox.conf 23.10~
rm_conffile /etc/avahi/services/sftp-ssh.service 23.10~
rm_conffile /etc/avahi/services/ssh.service 23.10~

View File

@ -9,6 +9,7 @@ from django.utils.translation import gettext_lazy as _
from plinth import app as app_module from plinth import app as app_module
from plinth import menu from plinth import menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon from plinth.daemon import Daemon
from plinth.modules.backups.components import BackupRestore from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall from plinth.modules.firewall.components import Firewall
@ -30,7 +31,7 @@ class SSHApp(app_module.App):
app_id = 'ssh' app_id = 'ssh'
_version = 3 _version = 4
def __init__(self): def __init__(self):
"""Create components for the app.""" """Create components for the app."""
@ -50,6 +51,17 @@ class SSHApp(app_module.App):
packages = Packages('packages-ssh', ['openssh-server']) packages = Packages('packages-ssh', ['openssh-server'])
self.add(packages) self.add(packages)
dropin_configs = DropinConfigs('dropin-configs-ssh', [
'/etc/fail2ban/jail.d/ssh-freedombox.conf',
])
self.add(dropin_configs)
dropin_configs = DropinConfigs('dropin-config-ssh-avahi', [
'/etc/avahi/services/sftp-ssh.service',
'/etc/avahi/services/ssh.service',
], copy_only=True)
self.add(dropin_configs)
firewall = Firewall('firewall-ssh', info.name, ports=['ssh'], firewall = Firewall('firewall-ssh', info.name, ports=['ssh'],
is_external=True) is_external=True)
self.add(firewall) self.add(firewall)