email: Rename audit module to privileged

The module does not interact with kernel audit system or is not related to
security logging. The 'privileged' makes us pay more attension.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-02-16 09:33:35 -08:00 committed by James Valleroy
parent 37b28e05d7
commit 1b5e99c56e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
12 changed files with 17 additions and 17 deletions

View File

@ -10,7 +10,7 @@ import os
import sys
import plinth.log
from plinth.modules.email import audit
from plinth.modules.email import privileged
EXIT_SYNTAX = 10
EXIT_PERM = 20
@ -42,12 +42,12 @@ def _call(module_name, action_name, arguments):
logger.critical('This action is reserved for root')
sys.exit(EXIT_PERM)
# We only run actions defined in the audit module
if module_name not in audit.__all__:
# We only run actions defined in the privileged module
if module_name not in privileged.__all__:
logger.critical('Bad module name: %r', module_name)
sys.exit(EXIT_SYNTAX)
module = getattr(audit, module_name)
module = getattr(privileged, module_name)
try:
action = getattr(module, 'action_' + action_name)
except AttributeError:

View File

@ -19,7 +19,7 @@ from plinth.modules.letsencrypt.components import LetsEncrypt
from plinth.package import Packages, remove
from plinth.signals import domain_added, domain_removed
from . import audit, manifest
from . import manifest, privileged
_description = [
_('This is a complete email server solution using Postfix, Dovecot, '
@ -176,12 +176,12 @@ def setup(helper, old_version=None):
app.setup(old_version)
# Setup
helper.call('post', audit.home.repair)
helper.call('post', privileged.home.repair)
app.get_component('letsencrypt-email-postfix').setup_certificates()
app.get_component('letsencrypt-email-dovecot').setup_certificates()
helper.call('post', audit.domain.set_domains)
helper.call('post', audit.ldap.repair)
helper.call('post', audit.spam.repair)
helper.call('post', privileged.domain.set_domains)
helper.call('post', privileged.ldap.repair)
helper.call('post', privileged.spam.repair)
# Reload
actions.superuser_run('service', ['reload', 'postfix'])
@ -198,7 +198,7 @@ def on_domain_added(sender, domain_type, name, description='', services=None,
if app.needs_setup():
return
audit.domain.set_domains()
privileged.domain.set_domains()
def on_domain_removed(sender, domain_type, name='', **kwargs):
@ -206,4 +206,4 @@ def on_domain_removed(sender, domain_type, name='', **kwargs):
if app.needs_setup():
return
audit.domain.set_domains()
privileged.domain.set_domains()

View File

@ -37,9 +37,9 @@ class Entry: # pylint: disable=too-many-instance-attributes
def get_entries():
"""Return the list of DNS entries to make."""
from . import audit
from . import privileged
domain = audit.domain.get_domains()['primary_domain']
domain = privileged.domain.get_domains()['primary_domain']
mx_spam_entries = [
Entry(type_='MX', value=f'{domain}.'),
Entry(type_='TXT', value='v=spf1 mx a ~all'),
@ -49,7 +49,7 @@ def get_entries():
f'rua=mailto:postmaster@{domain}; ')
]
try:
dkim_public_key = audit.dkim.get_public_key(domain)
dkim_public_key = privileged.dkim.get_public_key(domain)
dkim_entries = [
Entry(domain='dkim._domainkey', type_='TXT',
value=f'v=DKIM1; k=rsa; p={dkim_public_key}')

View File

@ -13,7 +13,7 @@ from plinth.modules.email import dns
from plinth.views import AppView
from . import aliases as aliases_module
from . import audit, forms
from . import forms, privileged
class EmailAppView(AppView):
@ -31,7 +31,7 @@ class EmailAppView(AppView):
def get_initial(self):
"""Return the initial values to populate in the form."""
initial = super().get_initial()
domains = audit.domain.get_domains()
domains = privileged.domain.get_domains()
initial['primary_domain'] = domains['primary_domain']
return initial
@ -41,7 +41,7 @@ class EmailAppView(AppView):
new_data = form.cleaned_data
if old_data['primary_domain'] != new_data['primary_domain']:
try:
audit.domain.set_domains(new_data['primary_domain'])
privileged.domain.set_domains(new_data['primary_domain'])
messages.success(self.request, _('Configuration updated'))
except Exception:
messages.error(self.request,