From 03cade4e22947681a997772dfb6a4ffb3e0835ca Mon Sep 17 00:00:00 2001 From: Spitap Date: Sun, 26 Feb 2023 13:57:31 +0100 Subject: [PATCH] Added doc and improved serializer --- doc/features/dmarc.rst | 64 +++++++++++++++++++ doc/features/pdfcredentials.rst | 14 ++++ doc/index.rst | 30 ++++++--- .../components/parameters/ParametersForm.vue | 1 + modoboa/pdfcredentials/api/v2/serializers.py | 13 ++++ 5 files changed, 113 insertions(+), 9 deletions(-) create mode 100644 doc/features/dmarc.rst create mode 100644 doc/features/pdfcredentials.rst diff --git a/doc/features/dmarc.rst b/doc/features/dmarc.rst new file mode 100644 index 000000000..9c2b268ad --- /dev/null +++ b/doc/features/dmarc.rst @@ -0,0 +1,64 @@ +modoboa-dmarc +============= + +.. _dmarcdoc: + +A set of tools to use DMARC through Modoboa. + +This feature is still in BETA stage, for now it only parses XML aggregated +reports and generate visual reports (using c3.js) on a per-domain basis. + +Installation +------------ + +.. note:: + modoboa-installer can automatically set it up for you. + +Make sure to install the following additional system package according to your distribution: + ++-----------------+ +| Debian / Ubuntu | ++=================+ +| libmagic1 | ++-----------------+ + ++------------+ +| CentOS | ++============+ +| file-devel | ++------------+ + + +Integration with Postfix +------------------------ + +A management command is provided to automatically parse DMARC +aggregated reports (rua) and feed the database. The execution of this +command can be automated with the definition of a postfix service and +a custom transport table. + +First, declare a new service in ``/etc/postfix/master.cf``:: + + dmarc-rua-parser unix - n n - - pipe + flags= user=vmail:vmail argv= /manage.py import_aggregated_report --pipe + +Define a new transport table inside ``/etc/postfix/main.cf``:: + + transport_maps = + hash:/etc/postfix/dmarc_transport + # other transport maps... + +Create a file called ``/etc/postfix/dmarc_transport`` with the following content:: + + dmarc-rua-parser: + +.. note:: + You must not declare this email address as an identity (user account or alias), else DMARC reports will be directed to your mailbox and won't be parsed. + +Hash the file using the following command:: + + $ postmap /etc/postfix/dmarc_transport + +Finally, reload postfix:: + + $ service postfix reload diff --git a/doc/features/pdfcredentials.rst b/doc/features/pdfcredentials.rst new file mode 100644 index 000000000..2b897d4a3 --- /dev/null +++ b/doc/features/pdfcredentials.rst @@ -0,0 +1,14 @@ +PDF credentials for Modoboa +=========================== + +.. _pdfc: + +A simple `Modoboa `_ extension which provides a +way to download PDF documents containing users credentials. + + +Configuration +------------- + +All the configuration is done from the admin panel (*Modoboa > +Parameters > PDF Credentials*). diff --git a/doc/index.rst b/doc/index.rst index 1a3a01322..cf037432a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -16,7 +16,27 @@ Modoboa is a mail hosting and management platform including a modern and simplified Web User Interface designed to work with `Postfix `_ and `Dovecot `_. -It is extensible by nature and comes with a lot of additional extensions: + +It provides built-in features by default : + + ++---------------------------------------------------------+-------------------------+------------------------------------------------------+ +|Name |Description |Documentation | +| | | | +| | | | +| | | | ++=========================================================+=========================+======================================================+ +|modoboa-dmarc |A set of tools to use |:ref:`modoboa_dmarc Documentation ` | +| |`DMARC | | +| |`_ | | ++---------------------------------------------------------+-------------------------+------------------------------------------------------+ +|modoboa-pdfcredentials |Generate PDF documents |:ref:`modoboa_pdfcredentials Documentation ` | +| |containing account | | +| |credentials | | ++---------------------------------------------------------+-------------------------+------------------------------------------------------+ + + +And it is extensible by nature and comes with a lot of additional extensions: +---------------------------------------------------------+-------------------------+------------------------------------------------------+ |Name |Description |Documentation | @@ -29,18 +49,10 @@ It is extensible by nature and comes with a lot of additional extensions: | | | | | | | | +---------------------------------------------------------+-------------------------+------------------------------------------------------+ -|`modoboa-dmarc |A set of tools to use |https://github.com/modoboa/modoboa-dmarc | -|`_ |`DMARC | | -| |`_ | | -+---------------------------------------------------------+-------------------------+------------------------------------------------------+ |`modoboa-imap-migration |Migrate mailboxes from an|https://github.com/modoboa/modoboa-imap-migration | |`_ |existing server using | | | |IMAP (and offlineimap) | | +---------------------------------------------------------+-------------------------+------------------------------------------------------+ -|`modoboa-pdfcredentials |Generate PDF documents |https://github.com/modoboa/modoboa-pdfcredentials | -|`_ |containing account | | -| |credentials | | -+---------------------------------------------------------+-------------------------+------------------------------------------------------+ |`modoboa-pfxadmin-migrate |A tool to migrate from |https://github.com/modoboa/modoboa-pfxadmin-migrate | |`_ |Postfixadmin | | +---------------------------------------------------------+-------------------------+------------------------------------------------------+ diff --git a/frontend/src/components/parameters/ParametersForm.vue b/frontend/src/components/parameters/ParametersForm.vue index 15b4ed460..bc08e8d7b 100644 --- a/frontend/src/components/parameters/ParametersForm.vue +++ b/frontend/src/components/parameters/ParametersForm.vue @@ -133,6 +133,7 @@ export default { return params.filter(param => this.display(param)) }, save () { + this.formErrors = {} parameters.saveApplication(this.$route.params.app, this.parameters).then(() => { bus.$emit('notification', { msg: this.$gettext('Parameters updated') }) }).catch(error => { diff --git a/modoboa/pdfcredentials/api/v2/serializers.py b/modoboa/pdfcredentials/api/v2/serializers.py index 8bc0f20e7..847fde923 100644 --- a/modoboa/pdfcredentials/api/v2/serializers.py +++ b/modoboa/pdfcredentials/api/v2/serializers.py @@ -42,6 +42,19 @@ class PDFCredentialsSettingsSerializer(serializers.Serializer): imap_connection_security = serializers.ChoiceField( choices=CONNECTION_SECURITY_MODES, default="starttls") + def validate_storage_dir(self, value): + """Check that directory exists.""" + if value: + if not os.path.isdir(value): + raise serializers.ValidationError( + _("Directory not found.") + ) + if not os.access(value, os.W_OK): + raise serializers.ValidationError( + _("Directory is not writable") + ) + return value + class GetAccountCredentialsSerializer(serializers.Serializer): """A serializer for get account credential view."""