From 846383df9944e242c4aa61b04ae99b37e6ea2fe5 Mon Sep 17 00:00:00 2001 From: Alex Kenion Date: Thu, 1 Aug 2024 11:43:26 -0400 Subject: [PATCH] Moved all email config into reporting so it's only included for relevant commands --- .../cli/config/base_config_definitions.py | 68 ------------------ wordfence/cli/reporting.py | 72 ++++++++++++++++++- 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/wordfence/cli/config/base_config_definitions.py b/wordfence/cli/config/base_config_definitions.py index e6dd588..a08fb58 100644 --- a/wordfence/cli/config/base_config_definitions.py +++ b/wordfence/cli/config/base_config_definitions.py @@ -2,7 +2,6 @@ from ..terms_management import TERMS_URL from ..mailing_lists import EMAIL_SIGNUP_MESSAGE -from ..email import SmtpTlsMode from .defaults import INI_DEFAULT_PATH from .config_items import config_definitions_to_config_map @@ -33,73 +32,6 @@ "argument_type": "OPTION", "default": None }, - "email-from": { - "description": "The From address to use when sending emails. If not " - "specified, the current username and hostname will be " - "used.", - "context": "ALL", - "argument_type": "OPTION", - "default": None, - "category": "Email" - }, - "smtp-host": { - "description": "The host name of the SMTP server to use for sending " - "email.", - "context": "ALL", - "argument_type": "OPTION", - "default": None, - "category": "Email" - }, - "smtp-port": { - "description": "The port of the SMTP server to use for sending email.", - "context": "ALL", - "argument_type": "OPTION", - "meta": { - "value_type": int - }, - "default": None, - "category": "Email" - }, - "smtp-tls-mode": { - "description": "The SSL/TLS mode to use when communicating with the " - f"SMTP server. {SmtpTlsMode.NONE.value} disables TLS " - f"entirely. {SmtpTlsMode.SMTPS.value} requires TLS for " - f"all communication while {SmtpTlsMode.STARTTLS.value} " - "will negotiate TLS if supported using the STARTTLS " - "SMTP command.", - "context": "ALL", - "argument_type": "OPTION", - "meta": { - "valid_options": [mode.value for mode in SmtpTlsMode] - }, - "default": SmtpTlsMode.STARTTLS.value, - "category": "Email" - }, - "smtp-user": { - "description": "The username for authenticating with the SMTP server.", - "context": "ALL", - "argument_type": "OPTION", - "default": None, - "category": "Email" - }, - "smtp-password": { - "description": "The password for authentication with the SMTP server. " - "This should generally be specified in an INI file as " - "including passwords as command line arguments can " - "expose them to other users on the same system.", - "context": "ALL", - "argument_type": "OPTION", - "default": None, - "category": "Email" - }, - "sendmail-path": { - "description": "The path to the sendmail executable. This will be " - "used to send email if SMTP is not configured.", - "context": "ALL", - "argument_type": "OPTION", - "default": "sendmail", - "category": "Email" - }, "verbose": { "short_name": "v", "description": "Enable verbose logging. If not specified, verbose " diff --git a/wordfence/cli/reporting.py b/wordfence/cli/reporting.py index 2dde9b5..043c194 100644 --- a/wordfence/cli/reporting.py +++ b/wordfence/cli/reporting.py @@ -17,7 +17,7 @@ HtmlContent from .context import CliContext from .io import IoManager -from .email import Mailer +from .email import Mailer, SmtpTlsMode class ReportingException(Exception): @@ -581,6 +581,76 @@ def get_config_options( }, "category": "Email" }, + "email-from": { + "description": "The From address to use when sending emails. If " + "not specified, the current username and hostname " + "will be used.", + "context": "ALL", + "argument_type": "OPTION", + "default": None, + "category": "Email" + }, + "smtp-host": { + "description": "The host name of the SMTP server to use for " + "sending email.", + "context": "ALL", + "argument_type": "OPTION", + "default": None, + "category": "Email" + }, + "smtp-port": { + "description": "The port of the SMTP server to use for sending " + "email.", + "context": "ALL", + "argument_type": "OPTION", + "meta": { + "value_type": int + }, + "default": None, + "category": "Email" + }, + "smtp-tls-mode": { + "description": "The SSL/TLS mode to use when communicating with " + f"the SMTP server. {SmtpTlsMode.NONE.value} " + f"disables TLS entirely. {SmtpTlsMode.SMTPS.value} " + "requires TLS for all communication while " + f"{SmtpTlsMode.STARTTLS.value} will negotiate TLS " + "if supported using the STARTTLS SMTP command.", + "context": "ALL", + "argument_type": "OPTION", + "meta": { + "valid_options": [mode.value for mode in SmtpTlsMode] + }, + "default": SmtpTlsMode.STARTTLS.value, + "category": "Email" + }, + "smtp-user": { + "description": "The username for authenticating with the SMTP " + "server.", + "context": "ALL", + "argument_type": "OPTION", + "default": None, + "category": "Email" + }, + "smtp-password": { + "description": "The password for authentication with the SMTP " + "server. This should generally be specified in an " + "INI file as including passwords as command line " + "arguments can expose them to other users on the " + "same system.", + "context": "ALL", + "argument_type": "OPTION", + "default": None, + "category": "Email" + }, + "sendmail-path": { + "description": "The path to the sendmail executable. This will be " + "used to send email if SMTP is not configured.", + "context": "ALL", + "argument_type": "OPTION", + "default": "sendmail", + "category": "Email" + }, }