minidlna: Do not proxy minidlna web interface over Apache

Minidlna interface is still available to everybody in internal networks
at http://<ip-address>:8200. (Note that using mDNS name like
freedombox.local doesn't work here).

Remove 'minidlna' group and apache minidlna site configuration as
those are not useful any more.

Reconfigure minidlna front page shortcut to link to the app
description page.

Tests performed with stable and testing containers:
Create a user that belongs to minidlna group. Apply changes, after
minidlna app upgrade:
- the user is not in minidlna group any more.
- the users configuration page doesn't show minidlna group.
- Apache site /_minidlna is disabled.

Closes #2012, #2013, #2416.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Minor formatting, use single quotes for strings for consistency]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa 2024-04-18 13:00:15 +03:00 committed by Sunil Mohan Adapa
parent 0d0eb4472d
commit 681f2ef994
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 15 additions and 34 deletions

View File

@ -2,17 +2,15 @@
"""
FreedomBox app to configure minidlna.
"""
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules import firewall
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.modules.users.components import UsersAndGroups
from plinth.package import Packages, install
from plinth.utils import Version
@ -37,14 +35,12 @@ class MiniDLNAApp(app_module.App):
app_id = 'minidlna'
_version = 5
_version = 6
def __init__(self) -> None:
"""Initialize the app components."""
super().__init__()
groups = {'minidlna': _('Media streaming server')}
info = app_module.Info(app_id=self.app_id, version=self._version,
name=_('MiniDLNA'), icon_filename='minidlna',
short_description=_('Simple Media Server'),
@ -63,31 +59,21 @@ class MiniDLNAApp(app_module.App):
)
self.add(menu_item)
shortcut = frontpage.Shortcut('shortcut-minidlna', info.name,
short_description=info.short_description,
description=info.description,
icon=info.icon_filename,
url='/_minidlna/', login_required=True,
allowed_groups=list(groups))
shortcut = frontpage.Shortcut(
'shortcut-minidlna', info.name,
short_description=info.short_description,
description=info.description, icon=info.icon_filename,
configure_url=reverse_lazy('minidlna:index'), login_required=True)
self.add(shortcut)
packages = Packages('packages-minidlna', ['minidlna'])
self.add(packages)
dropin_configs = DropinConfigs(
'dropin-configs-minidlna',
['/etc/apache2/conf-available/minidlna-freedombox.conf'])
self.add(dropin_configs)
firewall_minidlna = Firewall('firewall-minidlna', info.name,
ports=['minidlna',
'ssdp'], is_external=False)
self.add(firewall_minidlna)
webserver = Webserver('webserver-minidlna', 'minidlna-freedombox',
urls=['https://{host}/_minidlna/'])
self.add(webserver)
daemon = Daemon('daemon-minidlna', 'minidlna')
self.add(daemon)
@ -95,10 +81,6 @@ class MiniDLNAApp(app_module.App):
**manifest.backup)
self.add(backup_restore)
users_and_groups = UsersAndGroups('users-and-groups-minidlna',
groups=groups)
self.add(users_and_groups)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
@ -111,6 +93,14 @@ class MiniDLNAApp(app_module.App):
firewall.remove_passthrough('ipv4', '-A', 'INPUT', '-p', 'tcp',
'--dport', '8200', '-j', 'REJECT')
if old_version and old_version <= 5:
# Remove minidlna LDAP group and disable minidlna apache config
from plinth.modules.apache import privileged as apache_privileged
from plinth.modules.users import privileged as users_privileged
users_privileged.remove_group('minidlna')
apache_privileged.disable('minidlna-freedombox', 'config')
if not old_version:
self.enable()

View File

@ -1,9 +0,0 @@
<Location /_minidlna/>
Include includes/freedombox-single-sign-on.conf
<IfModule mod_auth_pubtkt.c>
TKTAuthToken "admin"
</IfModule>
ProxyPass http://localhost:8200/
</Location>