Пример #1
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('Performance'), icon='fa-bar-chart',
                               short_description=_('System Monitoring'),
                               description=_description,
                               manual_page='Performance',
                               clients=manifest.clients)
        self.add(info)

        menu_item = menu.Menu('menu-performance', info.name,
                              info.short_description, info.icon,
                              'performance:index', parent_url_name='system')
        self.add(menu_item)

        daemon_0 = Daemon('daemon-performance-0', managed_services[0],
                          listen_ports=None)
        self.add(daemon_0)

        daemon_1 = Daemon('daemon-performance-1', managed_services[1],
                          listen_ports=None)
        self.add(daemon_1)

        daemon_2 = Daemon('daemon-performance-2', managed_services[2],
                          listen_ports=None)
        self.add(daemon_2)

        daemon_3 = Daemon('daemon-performance-3', managed_services[3],
                          listen_ports=None)
        self.add(daemon_3)
Пример #2
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        groups = {'freedombox-share': _('Access to the private shares')}

        info = app_module.Info(
            app_id=self.app_id,
            version=version,
            name=_('Samba'),
            icon_filename='samba',
            short_description=_('Network File Storage'),
            manual_page='Samba',
            description=_description,
            clients=manifest.clients,
            donation_url='https://www.samba.org/samba/donations.html')
        self.add(info)

        menu_item = menu.Menu('menu-samba',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'samba:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-samba',
            info.name,
            short_description=info.short_description,
            icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('samba:index'),
            clients=info.clients,
            login_required=True,
            allowed_groups=list(groups))
        self.add(shortcut)

        firewall = Firewall('firewall-samba', info.name, ports=['samba'])
        self.add(firewall)

        daemon = Daemon('daemon-samba',
                        managed_services[0],
                        listen_ports=[(139, 'tcp4'), (139, 'tcp6'),
                                      (445, 'tcp4'), (445, 'tcp6')])
        self.add(daemon)

        daemon_nmbd = Daemon('daemon-samba-nmbd',
                             managed_services[1],
                             listen_ports=[(137, 'udp4'), (138, 'udp4')])

        self.add(daemon_nmbd)

        users_and_groups = UsersAndGroups('users-and-groups-samba',
                                          groups=groups)
        self.add(users_and_groups)

        backup_restore = SambaBackupRestore('backup-restore-samba',
                                            **manifest.backup)
        self.add(backup_restore)
Пример #3
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('Deluge'),
                               icon_filename='deluge',
                               short_description=_('BitTorrent Web Client'),
                               description=_description,
                               manual_page='Deluge',
                               clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-deluge',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'deluge:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut('shortcut-deluge',
                                      info.name,
                                      short_description=info.short_description,
                                      url='/deluge',
                                      icon=info.icon_filename,
                                      clients=info.clients,
                                      login_required=True,
                                      allowed_groups=[group[0]])
        self.add(shortcut)

        firewall = Firewall('firewall-deluge',
                            info.name,
                            ports=['http', 'https'],
                            is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-deluge',
                              'deluge-plinth',
                              urls=['https://{host}/deluge'])
        self.add(webserver)

        daemon = Daemon('daemon-deluged',
                        managed_services[0],
                        listen_ports=[(58846, 'tcp4')])
        self.add(daemon)

        daemon_web = Daemon('daemon-deluge-web',
                            managed_services[1],
                            listen_ports=[(8112, 'tcp4')])
        self.add(daemon_web)
Пример #4
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id,
                               version=self._version,
                               name=_('Performance'),
                               icon='fa-bar-chart',
                               short_description=_('System Monitoring'),
                               description=_description,
                               manual_page='Performance',
                               clients=manifest.clients)
        self.add(info)

        menu_item = menu.Menu('menu-performance',
                              info.name,
                              info.short_description,
                              info.icon,
                              'performance:index',
                              parent_url_name='system')
        self.add(menu_item)

        packages = Packages('packages-performance', ['cockpit-pcp'])
        self.add(packages)

        backup_restore = BackupRestore('backup-restore-performance',
                                       **manifest.backup)
        self.add(backup_restore)

        daemon_0 = Daemon('daemon-performance-0',
                          'pmcd.service',
                          listen_ports=None)
        self.add(daemon_0)

        daemon_1 = Daemon('daemon-performance-1',
                          'pmie.service',
                          listen_ports=None)
        self.add(daemon_1)

        daemon_2 = Daemon('daemon-performance-2',
                          'pmlogger.service',
                          listen_ports=None)
        self.add(daemon_2)

        daemon_3 = Daemon('daemon-performance-3',
                          'pmproxy.service',
                          listen_ports=None)
        self.add(daemon_3)
Пример #5
0
def test_app_is_running(service_is_running):
    """Test that checking whether app is running works."""
    daemon1 = Daemon('test-daemon-1', 'test-unit-1')
    daemon2 = FollowerComponent('test-daemon-2', 'test-unit-2')
    daemon2.is_running = Mock()

    follower1 = FollowerComponent('test-follower-1')

    class TestApp(App):
        """Test app"""
        app_id = 'test-app'

    app = TestApp()
    app.add(daemon1)
    app.add(daemon2)
    app.add(follower1)

    service_is_running.return_value = True
    daemon2.is_running.return_value = False
    assert not app_is_running(app)

    service_is_running.return_value = False
    daemon2.is_running.return_value = False
    assert not app_is_running(app)

    service_is_running.return_value = True
    daemon2.is_running.return_value = True
    assert app_is_running(app)
Пример #6
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('Shadowsocks'),
                               icon_filename='shadowsocks',
                               short_description=_('Socks5 Proxy'),
                               description=_description,
                               manual_page='Shadowsocks')
        self.add(info)

        menu_item = menu.Menu('menu-shadowsocks', info.name,
                              info.short_description, info.icon_filename,
                              'shadowsocks:index', parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-shadowsocks', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('shadowsocks:index'),
            login_required=True)
        self.add(shortcut)

        firewall = Firewall('firewall-shadowsocks', info.name,
                            ports=['shadowsocks-local-plinth'],
                            is_external=False)
        self.add(firewall)

        daemon = Daemon('daemon-shadowsocks', managed_services[0],
                        listen_ports=[(1080, 'tcp4'), (1080, 'tcp6')])
        self.add(daemon)
Пример #7
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        groups = {'ed2k': _('Download files using eDonkey applications')}

        info = app_module.Info(
            app_id=self.app_id,
            version=version,
            name=_('MLDonkey'),
            icon_filename='mldonkey',
            short_description=_('Peer-to-peer File Sharing'),
            description=_description,
            manual_page='MLDonkey',
            clients=manifest.clients)
        self.add(info)

        menu_item = menu.Menu('menu-mldonkey',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'mldonkey:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcuts = frontpage.Shortcut(
            'shortcut-mldonkey',
            info.name,
            short_description=info.short_description,
            icon=info.icon_filename,
            url='/mldonkey/',
            login_required=True,
            clients=info.clients,
            allowed_groups=list(groups))
        self.add(shortcuts)

        firewall = Firewall('firewall-mldonkey',
                            info.name,
                            ports=['http', 'https'],
                            is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-mldonkey',
                              'mldonkey-freedombox',
                              urls=['https://{host}/mldonkey/'])
        self.add(webserver)

        daemon = Daemon('daemon-mldonkey',
                        managed_services[0],
                        listen_ports=[(4080, 'tcp4')])
        self.add(daemon)

        users_and_groups = UsersAndGroups('users-and-groups-mldonkey',
                                          reserved_usernames=[_SYSTEM_USER],
                                          groups=groups)
        self.add(users_and_groups)

        backup_restore = BackupRestore('backup-restore-mldonkey',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #8
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('Privoxy'), icon_filename='privoxy',
                               short_description=_('Web Proxy'),
                               description=_description, manual_page='Privoxy')
        self.add(info)

        menu_item = menu.Menu('menu-privoxy', info.name,
                              info.short_description, info.icon_filename,
                              'privoxy:index', parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-privoxy', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('privoxy:index'), login_required=True)
        self.add(shortcut)

        firewall = Firewall('firewall-privoxy', info.name, ports=['privoxy'],
                            is_external=False)
        self.add(firewall)

        daemon = Daemon('daemon-privoxy', managed_services[0],
                        listen_ports=[(8118, 'tcp4'), (8118, 'tcp6')])
        self.add(daemon)

        users_and_groups = UsersAndGroups('users-and-groups-privoxy',
                                          reserved_usernames=['privoxy'])
        self.add(users_and_groups)
Пример #9
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('diaspora*'), icon_filename='diaspora',
                               short_description=_('Federated Social Network'),
                               description=_description, clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-diaspora', info.name,
                              info.short_description, info.icon_filename,
                              'diaspora:index', parent_url_name='apps')
        self.add(menu_item)

        shortcut = Shortcut('shortcut-diaspora', info.name,
                            short_description=info.short_description,
                            icon=info.icon_filename, url=None,
                            clients=info.clients, login_required=True)
        self.add(shortcut)

        firewall = Firewall('firewall-diaspora', info.name,
                            ports=['http', 'https'], is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-diaspora', 'diaspora-plinth')
        self.add(webserver)

        daemon = Daemon('daemon-diaspora', managed_services[0])
        self.add(daemon)
Пример #10
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('Tahoe-LAFS'),
                               icon_filename='tahoe-lafs',
                               short_description=_('Distributed File Storage'),
                               description=_description)

        self.add(info)

        menu_item = menu.Menu('menu-tahoe', info.name, info.short_description,
                              info.icon_filename, 'tahoe:index',
                              parent_url_name='apps', advanced=True)
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-tahoe', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            description=info.description, url=None,
            configure_url=reverse_lazy('tahoe:index'), login_required=True)
        self.add(shortcut)

        firewall = Firewall('firewall-tahoe', info.name,
                            ports=['tahoe-plinth'], is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-tahoe', 'tahoe-plinth')
        self.add(webserver)

        daemon = Daemon('daemon-tahoe', managed_services[0])
        self.add(daemon)
Пример #11
0
def test_initialization():
    """Test that component is initialized properly."""
    with pytest.raises(ValueError):
        Daemon(None, None)

    daemon = Daemon('test-daemon', 'test-unit')
    assert daemon.component_id == 'test-daemon'
    assert daemon.unit == 'test-unit'
    assert not daemon.strict_check
    assert daemon.listen_ports == []

    listen_ports = [(345, 'tcp4'), (123, 'udp')]
    daemon = Daemon('test-daemon', 'test-unit', strict_check=True,
                    listen_ports=listen_ports)
    assert daemon.strict_check
    assert daemon.listen_ports == listen_ports
Пример #12
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               depends=depends, name=_('PageKite'),
                               icon='fa-flag',
                               short_description=_('Public Visibility'),
                               description=_description,
                               manual_page='PageKite')
        self.add(info)

        menu_item = menu.Menu('menu-pagekite', info.name,
                              info.short_description, info.icon,
                              'pagekite:index', parent_url_name='system')
        self.add(menu_item)

        domain_type = DomainType('domain-type-pagekite', _('PageKite Domain'),
                                 'pagekite:index', can_have_certificate=True)
        self.add(domain_type)

        daemon = Daemon('daemon-pagekite', managed_services[0])
        self.add(daemon)

        # Register kite name with Name Services module.
        utils.update_names_module(is_enabled=self.is_enabled())
Пример #13
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id, version=self._version,
                               is_essential=True, depends=['names'],
                               name=_('Service Discovery'), icon='fa-compass',
                               description=_description,
                               manual_page='ServiceDiscovery')
        self.add(info)

        menu_item = menu.Menu('menu-avahi', info.name, None, info.icon,
                              'avahi:index', parent_url_name='system')
        self.add(menu_item)

        packages = Packages('packages-avahi', ['avahi-daemon', 'avahi-utils'])
        self.add(packages)

        domain_type = DomainType('domain-type-local',
                                 _('Local Network Domain'), 'config:index',
                                 can_have_certificate=False)
        self.add(domain_type)

        firewall = Firewall('firewall-avahi', info.name, ports=['mdns'],
                            is_external=False)
        self.add(firewall)

        daemon = Daemon('daemon-avahi', 'avahi-daemon')
        self.add(daemon)

        backup_restore = BackupRestore('backup-restore-avahi',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #14
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('Service Discovery'),
                               icon='fa-compass',
                               description=_description,
                               manual_page='ServiceDiscovery')
        self.add(info)

        menu_item = menu.Menu('menu-avahi',
                              info.name,
                              None,
                              info.icon,
                              'avahi:index',
                              parent_url_name='system')
        self.add(menu_item)

        domain_type = DomainType('domain-type-local',
                                 _('Local Network Domain'),
                                 'config:index',
                                 can_have_certificate=False)
        self.add(domain_type)

        firewall = Firewall('firewall-avahi',
                            info.name,
                            ports=['mdns'],
                            is_external=False)
        self.add(firewall)

        daemon = Daemon('daemon-avahi', managed_services[0])
        self.add(daemon)
Пример #15
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id,
                               version=self._version,
                               is_essential=True,
                               name=_('Secure Shell (SSH) Server'),
                               icon='fa-terminal',
                               description=_description)
        self.add(info)

        menu_item = menu.Menu('menu-ssh',
                              info.name,
                              None,
                              info.icon,
                              'ssh:index',
                              parent_url_name='system')
        self.add(menu_item)

        packages = Packages('packages-ssh', ['openssh-server'])
        self.add(packages)

        firewall = Firewall('firewall-ssh',
                            info.name,
                            ports=['ssh'],
                            is_external=True)
        self.add(firewall)

        daemon = Daemon('daemon-ssh', 'ssh')
        self.add(daemon)

        backup_restore = BackupRestore('backup-restore-ssh', **manifest.backup)
        self.add(backup_restore)
Пример #16
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        self.groups = {'vpn': _('Connect to VPN services')}

        info = app_module.Info(app_id=self.app_id,
                               version=self._version,
                               name=_('OpenVPN'),
                               icon_filename='openvpn',
                               short_description=_('Virtual Private Network'),
                               description=_description,
                               manual_page='OpenVPN',
                               clients=manifest.clients)
        self.add(info)

        menu_item = menu.Menu('menu-openvpn',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'openvpn:index',
                              parent_url_name='apps')
        self.add(menu_item)

        download_profile = \
            format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">'
                          'Download Profile</a>'),
                        link=reverse_lazy('openvpn:profile'))
        shortcut = frontpage.Shortcut(
            'shortcut-openvpn',
            info.name,
            short_description=info.short_description,
            icon=info.icon_filename,
            description=info.description + [download_profile],
            configure_url=reverse_lazy('openvpn:index'),
            login_required=True,
            allowed_groups=['vpn'])
        self.add(shortcut)

        packages = Packages('packages-openvpn', ['openvpn', 'easy-rsa'])
        self.add(packages)

        firewall = Firewall('firewall-openvpn',
                            info.name,
                            ports=['openvpn'],
                            is_external=True)
        self.add(firewall)

        daemon = Daemon('daemon-openvpn',
                        'openvpn-server@freedombox',
                        listen_ports=[(1194, 'udp4'), (1194, 'udp6')])
        self.add(daemon)

        users_and_groups = UsersAndGroups('users-and-groups-openvpn',
                                          groups=self.groups)
        self.add(users_and_groups)

        backup_restore = BackupRestore('backup-restore-openvpn',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #17
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id,
                               version=self._version,
                               is_essential=True,
                               name=_('Date & Time'),
                               icon='fa-clock-o',
                               description=_description,
                               manual_page='DateTime')
        self.add(info)

        menu_item = menu.Menu('menu-datetime',
                              info.name,
                              None,
                              info.icon,
                              'datetime:index',
                              parent_url_name='system')
        self.add(menu_item)

        packages = Packages('packages-datetime', ['systemd-timesyncd'])
        self.add(packages)

        if self._is_time_managed():
            daemon = Daemon('daemon-datetime', 'systemd-timesyncd')
            self.add(daemon)

        backup_restore = BackupRestore('backup-restore-datetime',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #18
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(
            app_id=self.app_id, version=version, name=_('MLDonkey'),
            icon_filename='mldonkey',
            short_description=_('Peer-to-peer File Sharing'),
            description=_description, manual_page='MLDonkey', clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-mldonkey', info.name,
                              info.short_description, info.icon_filename,
                              'mldonkey:index', parent_url_name='apps')
        self.add(menu_item)

        shortcuts = frontpage.Shortcut(
            'shortcut-mldonkey', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            url='/mldonkey/', login_required=True, clients=info.clients,
            allowed_groups=[group[0]])
        self.add(shortcuts)

        firewall = Firewall('firewall-mldonkey', info.name,
                            ports=['http', 'https'], is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-mldonkey', 'mldonkey-freedombox',
                              urls=['https://{host}/mldonkey/'])
        self.add(webserver)

        daemon = Daemon('daemon-mldonkey', managed_services[0],
                        listen_ports=[(4080, 'tcp4')])
        self.add(daemon)
Пример #19
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               is_essential=is_essential,
                               name=_('Users and Groups'),
                               icon='fa-users',
                               description=_description,
                               manual_page='Users')
        self.add(info)

        menu_item = menu.Menu('menu-users',
                              info.name,
                              None,
                              info.icon,
                              'users:index',
                              parent_url_name='system')
        self.add(menu_item)

        daemon = Daemon('daemon-users',
                        managed_services[0],
                        listen_ports=[(389, 'tcp4'), (389, 'tcp6')])
        self.add(daemon)

        # Add the admin group
        groups = {'admin': _('Access to all services and system settings')}
        users_and_groups = UsersAndGroups('users-and-groups-admin',
                                          groups=groups)
        self.add(users_and_groups)
Пример #20
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               is_essential=is_essential,
                               name=_('Storage'),
                               icon='fa-hdd-o',
                               description=_description,
                               manual_page='Storage')
        self.add(info)

        menu_item = menu.Menu('menu-storage',
                              info.name,
                              None,
                              info.icon,
                              'storage:index',
                              parent_url_name='system')
        self.add(menu_item)

        daemon = Daemon('daemon-udiskie', managed_services[0])
        self.add(daemon)

        # Check every hour for low disk space, every 3 minutes in debug mode
        interval = 180 if cfg.develop else 3600
        glib.schedule(interval, warn_about_low_disk_space)
Пример #21
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('Mumble'), icon_filename='mumble',
                               short_description=_('Voice Chat'),
                               description=_description, manual_page='Mumble',
                               clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-mumble', info.name, info.short_description,
                              'mumble', 'mumble:index', parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-mumble', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('mumble:index'), clients=info.clients)
        self.add(shortcut)

        firewall = Firewall('firewall-mumble', info.name,
                            ports=['mumble-plinth'], is_external=True)
        self.add(firewall)

        daemon = Daemon(
            'daemon-mumble', managed_services[0],
            listen_ports=[(64738, 'tcp4'), (64738, 'tcp6'), (64738, 'udp4'),
                          (64738, 'udp6')])
        self.add(daemon)

        users_and_groups = UsersAndGroups('users-and-groups-mumble',
                                          reserved_usernames=['mumble-server'])
        self.add(users_and_groups)
Пример #22
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(
            app_id=self.app_id, version=self._version, depends=['names'],
            name=_('PageKite'), icon='fa-flag',
            short_description=_('Public Visibility'), description=_description,
            manual_page='PageKite',
            donation_url='https://pagekite.net/support/faq/#donate')
        self.add(info)

        menu_item = menu.Menu('menu-pagekite', info.name,
                              info.short_description, info.icon,
                              'pagekite:index', parent_url_name='system')
        self.add(menu_item)

        packages = Packages('packages-pagekite', ['pagekite'])
        self.add(packages)

        domain_type = DomainType('domain-type-pagekite', _('PageKite Domain'),
                                 'pagekite:index', can_have_certificate=True)
        self.add(domain_type)

        daemon = Daemon('daemon-pagekite', self.DAEMON)
        self.add(daemon)

        backup_restore = BackupRestore('backup-restore-pagekite',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #23
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               is_essential=is_essential,
                               name=_('Secure Shell (SSH) Server'),
                               icon='fa-terminal',
                               description=_description)
        self.add(info)

        menu_item = menu.Menu('menu-ssh',
                              info.name,
                              None,
                              info.icon,
                              'ssh:index',
                              parent_url_name='system')
        self.add(menu_item)

        firewall = Firewall('firewall-ssh',
                            info.name,
                            ports=['ssh'],
                            is_external=True)
        self.add(firewall)

        daemon = Daemon('daemon-ssh', managed_services[0])
        self.add(daemon)
Пример #24
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('BIND'),
                               icon='fa-globe-w',
                               short_description=_('Domain Name Server'),
                               description=_description)
        self.add(info)

        menu_item = menu.Menu('menu-bind',
                              info.name,
                              info.short_description,
                              info.icon,
                              'bind:index',
                              parent_url_name='system')
        self.add(menu_item)

        firewall = Firewall('firewall-bind',
                            info.name,
                            ports=['dns'],
                            is_external=False)
        self.add(firewall)

        daemon = Daemon('daemon-bind',
                        managed_services[0],
                        listen_ports=[(53, 'tcp6'), (53, 'udp6'), (53, 'tcp4'),
                                      (53, 'udp4')],
                        alias=managed_services[1])
        self.add(daemon)

        backup_restore = BackupRestore('backup-restore-bind',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #25
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               is_essential=is_essential)
        self.add(info)

        web_server_ports = Firewall('firewall-web',
                                    _('Web Server'),
                                    ports=['http', 'https'],
                                    is_external=True)
        self.add(web_server_ports)

        freedombox_ports = Firewall('firewall-plinth',
                                    format_lazy(
                                        _('{box_name} Web Interface (Plinth)'),
                                        box_name=_(cfg.box_name)),
                                    ports=['http', 'https'],
                                    is_external=True)
        self.add(freedombox_ports)

        letsencrypt = LetsEncrypt('letsencrypt-apache',
                                  domains='*',
                                  daemons=[managed_services[0]])
        self.add(letsencrypt)

        daemon = Daemon('daemon-apache', managed_services[0])
        self.add(daemon)
Пример #26
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id, version=version,
                               name=_('infinoted'), icon_filename='infinoted',
                               short_description=_('Gobby Server'),
                               description=_description,
                               manual_page='Infinoted', clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-infinoted', info.name,
                              info.short_description, info.icon_filename,
                              'infinoted:index', parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-infinoted', info.name,
            short_description=info.short_description, icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('infinoted:index'),
            clients=info.clients, login_required=False)
        self.add(shortcut)

        firewall = Firewall('firewall-infinoted', info.name,
                            ports=['infinoted-plinth'], is_external=True)
        self.add(firewall)

        daemon = Daemon('daemon-infinoted', managed_services[0],
                        listen_ports=[(6523, 'tcp4'), (6523, 'tcp6')])
        self.add(daemon)
Пример #27
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               is_essential=is_essential,
                               name=_('Firewall'),
                               icon='fa-shield',
                               description=_description,
                               manual_page='Firewall')
        self.add(info)

        menu_item = menu.Menu('menu-firewall',
                              info.name,
                              None,
                              info.icon,
                              'firewall:index',
                              parent_url_name='system')
        self.add(menu_item)

        daemon = Daemon('daemon-firewall', managed_services[0])
        self.add(daemon)

        backup_restore = BackupRestore('backup-restore-firewall',
                                       **manifest.backup)
        self.add(backup_restore)
Пример #28
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('Samba'),
                               icon_filename='samba',
                               short_description=_('File Sharing'),
                               manual_page='Samba',
                               description=_description,
                               clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-samba',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'samba:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-samba',
            info.name,
            short_description=info.short_description,
            icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('samba:index'),
            clients=info.clients,
            login_required=True,
            allowed_groups=[group[0]])
        self.add(shortcut)

        firewall = Firewall('firewall-samba', info.name, ports=['samba'])
        self.add(firewall)

        daemon = Daemon('daemon-samba',
                        managed_services[0],
                        listen_ports=[(139, 'tcp4'), (139, 'tcp6'),
                                      (445, 'tcp4'), (445, 'tcp6')])
        self.add(daemon)

        daemon_nmbd = Daemon('daemon-samba-nmbd',
                             managed_services[1],
                             listen_ports=[(137, 'udp4'), (138, 'udp4')])

        self.add(daemon_nmbd)
Пример #29
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()
        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('Matrix Synapse'),
                               icon_filename='matrixsynapse',
                               short_description=_('Chat Server'),
                               description=_description,
                               manual_page='MatrixSynapse',
                               clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-matrixsynapse',
                              info.name,
                              info.short_description,
                              'matrixsynapse',
                              'matrixsynapse:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut(
            'shortcut-matrixsynapse',
            info.name,
            short_description=info.short_description,
            icon=info.icon_filename,
            description=info.description,
            configure_url=reverse_lazy('matrixsynapse:index'),
            clients=info.clients,
            login_required=True)
        self.add(shortcut)

        firewall = Firewall('firewall-matrixsynapse',
                            info.name,
                            ports=['matrix-synapse-plinth'],
                            is_external=True)
        self.add(firewall)

        webserver = Webserver('webserver-matrixsynapse',
                              'matrix-synapse-plinth',
                              urls=['https://{host}/_matrix/client/versions'])
        self.add(webserver)

        letsencrypt = LetsEncrypt(
            'letsencrypt-matrixsynapse',
            domains=get_domains,
            daemons=[managed_services[0]],
            should_copy_certificates=True,
            private_key_path='/etc/matrix-synapse/homeserver.tls.key',
            certificate_path='/etc/matrix-synapse/homeserver.tls.crt',
            user_owner='matrix-synapse',
            group_owner='nogroup',
            managing_app='matrixsynapse')
        self.add(letsencrypt)

        daemon = Daemon('daemon-matrixsynapse',
                        managed_services[0],
                        listen_ports=[(8008, 'tcp4'), (8448, 'tcp4')])
        self.add(daemon)
Пример #30
0
    def __init__(self):
        """Create components for the app."""
        super().__init__()

        groups = {'i2p': _('Manage I2P application')}

        info = app_module.Info(app_id=self.app_id,
                               version=version,
                               name=_('I2P'),
                               icon_filename='i2p',
                               short_description=_('Anonymity Network'),
                               description=_description,
                               manual_page='I2P',
                               clients=clients)
        self.add(info)

        menu_item = menu.Menu('menu-i2p',
                              info.name,
                              info.short_description,
                              info.icon_filename,
                              'i2p:index',
                              parent_url_name='apps')
        self.add(menu_item)

        shortcut = frontpage.Shortcut('shortcut-i2p',
                                      info.name,
                                      short_description=info.short_description,
                                      icon=info.icon_filename,
                                      url='/i2p/',
                                      clients=info.clients,
                                      login_required=True,
                                      allowed_groups=list(groups))
        self.add(shortcut)

        firewall = Firewall('firewall-i2p-web',
                            info.name,
                            ports=['http', 'https'],
                            is_external=True)
        self.add(firewall)

        firewall = Firewall('firewall-i2p-proxies',
                            _('I2P Proxy'),
                            ports=tunnels_to_manage.values(),
                            is_external=False)
        self.add(firewall)

        webserver = Webserver('webserver-i2p',
                              'i2p-freedombox',
                              urls=['https://{host}/i2p/'])
        self.add(webserver)

        daemon = Daemon('daemon-i2p',
                        managed_services[0],
                        listen_ports=[(7657, 'tcp6')])
        self.add(daemon)

        users_and_groups = UsersAndGroups('users-and-groups-i2p',
                                          groups=groups)
        self.add(users_and_groups)