mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
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:
parent
37b28e05d7
commit
1b5e99c56e
@ -10,7 +10,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import plinth.log
|
import plinth.log
|
||||||
from plinth.modules.email import audit
|
from plinth.modules.email import privileged
|
||||||
|
|
||||||
EXIT_SYNTAX = 10
|
EXIT_SYNTAX = 10
|
||||||
EXIT_PERM = 20
|
EXIT_PERM = 20
|
||||||
@ -42,12 +42,12 @@ def _call(module_name, action_name, arguments):
|
|||||||
logger.critical('This action is reserved for root')
|
logger.critical('This action is reserved for root')
|
||||||
sys.exit(EXIT_PERM)
|
sys.exit(EXIT_PERM)
|
||||||
|
|
||||||
# We only run actions defined in the audit module
|
# We only run actions defined in the privileged module
|
||||||
if module_name not in audit.__all__:
|
if module_name not in privileged.__all__:
|
||||||
logger.critical('Bad module name: %r', module_name)
|
logger.critical('Bad module name: %r', module_name)
|
||||||
sys.exit(EXIT_SYNTAX)
|
sys.exit(EXIT_SYNTAX)
|
||||||
|
|
||||||
module = getattr(audit, module_name)
|
module = getattr(privileged, module_name)
|
||||||
try:
|
try:
|
||||||
action = getattr(module, 'action_' + action_name)
|
action = getattr(module, 'action_' + action_name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from plinth.modules.letsencrypt.components import LetsEncrypt
|
|||||||
from plinth.package import Packages, remove
|
from plinth.package import Packages, remove
|
||||||
from plinth.signals import domain_added, domain_removed
|
from plinth.signals import domain_added, domain_removed
|
||||||
|
|
||||||
from . import audit, manifest
|
from . import manifest, privileged
|
||||||
|
|
||||||
_description = [
|
_description = [
|
||||||
_('This is a complete email server solution using Postfix, Dovecot, '
|
_('This is a complete email server solution using Postfix, Dovecot, '
|
||||||
@ -176,12 +176,12 @@ def setup(helper, old_version=None):
|
|||||||
app.setup(old_version)
|
app.setup(old_version)
|
||||||
|
|
||||||
# Setup
|
# 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-postfix').setup_certificates()
|
||||||
app.get_component('letsencrypt-email-dovecot').setup_certificates()
|
app.get_component('letsencrypt-email-dovecot').setup_certificates()
|
||||||
helper.call('post', audit.domain.set_domains)
|
helper.call('post', privileged.domain.set_domains)
|
||||||
helper.call('post', audit.ldap.repair)
|
helper.call('post', privileged.ldap.repair)
|
||||||
helper.call('post', audit.spam.repair)
|
helper.call('post', privileged.spam.repair)
|
||||||
|
|
||||||
# Reload
|
# Reload
|
||||||
actions.superuser_run('service', ['reload', 'postfix'])
|
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():
|
if app.needs_setup():
|
||||||
return
|
return
|
||||||
|
|
||||||
audit.domain.set_domains()
|
privileged.domain.set_domains()
|
||||||
|
|
||||||
|
|
||||||
def on_domain_removed(sender, domain_type, name='', **kwargs):
|
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():
|
if app.needs_setup():
|
||||||
return
|
return
|
||||||
|
|
||||||
audit.domain.set_domains()
|
privileged.domain.set_domains()
|
||||||
|
|||||||
@ -37,9 +37,9 @@ class Entry: # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
def get_entries():
|
def get_entries():
|
||||||
"""Return the list of DNS entries to make."""
|
"""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 = [
|
mx_spam_entries = [
|
||||||
Entry(type_='MX', value=f'{domain}.'),
|
Entry(type_='MX', value=f'{domain}.'),
|
||||||
Entry(type_='TXT', value='v=spf1 mx a ~all'),
|
Entry(type_='TXT', value='v=spf1 mx a ~all'),
|
||||||
@ -49,7 +49,7 @@ def get_entries():
|
|||||||
f'rua=mailto:postmaster@{domain}; ')
|
f'rua=mailto:postmaster@{domain}; ')
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
dkim_public_key = audit.dkim.get_public_key(domain)
|
dkim_public_key = privileged.dkim.get_public_key(domain)
|
||||||
dkim_entries = [
|
dkim_entries = [
|
||||||
Entry(domain='dkim._domainkey', type_='TXT',
|
Entry(domain='dkim._domainkey', type_='TXT',
|
||||||
value=f'v=DKIM1; k=rsa; p={dkim_public_key}')
|
value=f'v=DKIM1; k=rsa; p={dkim_public_key}')
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from plinth.modules.email import dns
|
|||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from . import aliases as aliases_module
|
from . import aliases as aliases_module
|
||||||
from . import audit, forms
|
from . import forms, privileged
|
||||||
|
|
||||||
|
|
||||||
class EmailAppView(AppView):
|
class EmailAppView(AppView):
|
||||||
@ -31,7 +31,7 @@ class EmailAppView(AppView):
|
|||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
"""Return the initial values to populate in the form."""
|
"""Return the initial values to populate in the form."""
|
||||||
initial = super().get_initial()
|
initial = super().get_initial()
|
||||||
domains = audit.domain.get_domains()
|
domains = privileged.domain.get_domains()
|
||||||
initial['primary_domain'] = domains['primary_domain']
|
initial['primary_domain'] = domains['primary_domain']
|
||||||
return initial
|
return initial
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class EmailAppView(AppView):
|
|||||||
new_data = form.cleaned_data
|
new_data = form.cleaned_data
|
||||||
if old_data['primary_domain'] != new_data['primary_domain']:
|
if old_data['primary_domain'] != new_data['primary_domain']:
|
||||||
try:
|
try:
|
||||||
audit.domain.set_domains(new_data['primary_domain'])
|
privileged.domain.set_domains(new_data['primary_domain'])
|
||||||
messages.success(self.request, _('Configuration updated'))
|
messages.success(self.request, _('Configuration updated'))
|
||||||
except Exception:
|
except Exception:
|
||||||
messages.error(self.request,
|
messages.error(self.request,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user