Skip to content

Commit

Permalink
Merge branch 'main' into sdl-6895-retention
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl authored May 14, 2024
2 parents f3c2bed + f6b34b4 commit a0c35eb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 62 deletions.
9 changes: 0 additions & 9 deletions imageroot/actions/configure-module/91import-email

This file was deleted.

3 changes: 0 additions & 3 deletions imageroot/actions/get-configuration/20read
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ is_found_auditor = "$1$SLIIIS$JMBwGqQg4lIir2P2YU1y.0" in output.stdout
config['is_default_password_admin'] = True if is_found_admin else False
config['is_default_password_auditor'] = True if is_found_auditor else False

import_running = subprocess.run(['systemctl', '--user', 'is-active', "import-email-to-piler.service"], capture_output=True, text=True)
config['import_email_is_running'] = True if import_running.stdout.strip() == 'active' else False

# get the mail server module uuid
providers = agent.list_service_providers(rdb, 'imap', 'tcp', {
'module_uuid': os.getenv("MAIL_SERVER", ""),
Expand Down
7 changes: 0 additions & 7 deletions imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"mail_server": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"is_default_password_admin": false,
"is_default_password_auditor": false,
"import_email_is_running": false,
"retention_days": 365
}
],
Expand All @@ -23,7 +22,6 @@
"mail_server",
"is_default_password_admin",
"is_default_password_auditor",
"import_email_is_running",
"retention_days"
],
"properties": {
Expand Down Expand Up @@ -57,11 +55,6 @@
"title": "Default password",
"description": "True if the password is the default one"
},
"import_email_is_running": {
"type": "boolean",
"title": "Import email is running",
"description": "True if the import email is running"
},
"retention_days": {
"type": "integer",
"title": "Retention days",
Expand Down
20 changes: 18 additions & 2 deletions imageroot/bin/import-emails
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ import subprocess
import sys
import os
import agent
import argparse

parser = argparse.ArgumentParser(description='Script for importing user mailboxes from an IMAP server into the mail piler archive')
parser.add_argument('-A', '--after', metavar='AFTER_TIMESTAMP', type=str,
help='Import emails after the specified value (unix timestamp)')
parser.add_argument('-B', '--before', metavar='BEFORE_TIMESTAMP', type=str,
help='Import emails before the specified value (unix timestamp)')

args = parser.parse_args()

timestamp = []

if args.after is not None:
print("Import emails after timestamp:", args.after, file=sys.stderr)
timestamp += ['-A', args.after]
elif args.before is not None:
print("Import emails before timestamp:", args.before, file=sys.stderr)
timestamp += ['-B', args.before]

rdb = agent.redis_connect()

Expand Down Expand Up @@ -39,9 +56,8 @@ if providers:

subprocess.run([
'/usr/bin/podman', 'exec', '-w', '/var/piler/imap', '-u', 'piler', 'piler-app',
'/usr/bin/pilerimport', '-Z', '200', '-i', ip_address, '-u', f'{user}*vmail', '-p', password, '-P', '993'
'/usr/bin/pilerimport', '-Z', '200', *timestamp , '-i', ip_address, '-u', f'{user}*vmail', '-p', password, '-P', '993'
])
except Exception as e:
print(f"### Error to import {user} to {os.environ['MODULE_ID']}: {e}", file=sys.stderr)
continue

12 changes: 0 additions & 12 deletions imageroot/systemd/user/import-email-to-piler.service

This file was deleted.

3 changes: 0 additions & 3 deletions ui/public/i18n/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
"password_warning": "Change {user} password",
"password_warning_description": "The default password \"{password}\" of \"{user}\" must be changed",
"open_piler": "Open Piler",
"import_email_is_running_warning": "Import emails is running",
"import_email_is_running_description": "Please wait until the import emails action is finished",
"import_email_to_piler": "Import emails to Piler",
"advanced": "Advanced",
"import_old_emails_to_piler_description": "Import old emails to Piler, this process may take a long time",
"always_bcc_is_already_set": "Always BCC is already set in the server, you need to manually remove it (POSTFIX_ALWAYS_BCC)",
Expand Down
26 changes: 0 additions & 26 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@
/>
</cv-column>
</cv-row>
<cv-row v-if="import_email_is_running">
<cv-column>
<NsInlineNotification
kind="warning"
:title="$t('settings.import_email_is_running_warning')"
:description="$t('settings.import_email_is_running_description')"
:showCloseButton="false"
/>
</cv-column>
</cv-row>
<cv-row>
<cv-column>
<cv-tile light>
Expand Down Expand Up @@ -134,16 +124,6 @@
{{ $t("settings.choose_the_mail_server_to_use") }}
</template>
</NsComboBox>
<cv-row v-if="error.importEmailToPiler">
<cv-column>
<NsInlineNotification
kind="error"
:title="$t('action.importEmailToPiler')"
:description="error.importEmailToPiler"
:showCloseButton="false"
/>
</cv-column>
</cv-row>
<!-- advanced options -->
<cv-accordion ref="accordion" class="maxwidth mg-bottom">
<cv-accordion-item :open="toggleAccordion[0]">
Expand Down Expand Up @@ -195,7 +175,6 @@
<script>
import to from "await-to-js";
import { mapState } from "vuex";
import Play20 from "@carbon/icons-vue/es/play--outline/20";
import {
QueryParamService,
UtilService,
Expand All @@ -221,12 +200,10 @@ export default {
q: {
page: "settings",
},
Play20,
urlCheckInterval: null,
host: "",
mail_server: "",
mail_server_URL: [],
import_email_is_running: false,
piler_is_running: false,
always_bcc_correctly_set: false,
is_default_password_admin: false,
Expand All @@ -237,10 +214,8 @@ export default {
loading: {
getConfiguration: false,
configureModule: false,
importEmailToPiler: false,
},
error: {
importEmailToPiler: "",
getConfiguration: "",
configureModule: "",
host: "",
Expand Down Expand Up @@ -325,7 +300,6 @@ export default {
this.mail_server_URL = config.mail_server_URL;
this.is_default_password_admin = config.is_default_password_admin;
this.is_default_password_auditor = config.is_default_password_auditor;
this.import_email_is_running = config.import_email_is_running;
this.piler_is_running = config.piler_is_running;
this.always_bcc_correctly_set = config.always_bcc_correctly_set;
this.retention_days = config.retention_days.toString();
Expand Down

0 comments on commit a0c35eb

Please sign in to comment.