From 1e0e4dc323098531973f23b1271d5f8962819517 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Wed, 4 Aug 2021 12:19:19 +0200 Subject: [PATCH] security/acme-client: remove the legacy log file, refs #2366 --- security/acme-client/pkg-descr | 1 + .../app/library/OPNsense/AcmeClient/LeAccount.php | 2 +- .../mvc/app/library/OPNsense/AcmeClient/LeCommon.php | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/security/acme-client/pkg-descr b/security/acme-client/pkg-descr index 0e3f1c9a2..337a667b3 100644 --- a/security/acme-client/pkg-descr +++ b/security/acme-client/pkg-descr @@ -17,6 +17,7 @@ Changed: * rename plugin from "Let's Encrypt client" to "ACME Client" (#2361) * rename "Let's Encrypt Environment" to "ACME CA" (#2361) * preserve old LE accounts/certs by adding a compatibility layer (#2361) +* remove the legacy log file and only rely on syslog logging (#2366) Removed: * remove obsolete account parameters: certificateAuthority, lastUpdate diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAccount.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAccount.php index ad172033c..afec980fd 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAccount.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeAccount.php @@ -73,7 +73,7 @@ class LeAccount extends LeCommon $account_ca_file = $account_conf_dir . '/ca.conf'; $acme_conf = array(); $acme_conf[] = "CERT_HOME='" . self::ACME_HOME_DIR . "'"; - $acme_conf[] = "LOG_FILE='" . self::ACME_LOG_FILE . "'"; + $acme_conf[] = "SYS_LOG='" . $this->acme_syslog . "'"; $acme_conf[] = "ACCOUNT_KEY_PATH='" . $account_key_file . "'"; $acme_conf[] = "ACCOUNT_JSON_PATH='" . $account_json_file . "'"; $acme_conf[] = "CA_CONF='" . $account_ca_file . "'"; diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeCommon.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeCommon.php index f8d765bd3..1863061d6 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeCommon.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeCommon.php @@ -42,7 +42,6 @@ abstract class LeCommon public const ACME_BASE_CERT_DIR = '/var/etc/acme-client/certs'; public const ACME_BASE_CONFIG_DIR = '/var/etc/acme-client/configs'; public const ACME_HOME_DIR = '/var/etc/acme-client/home'; - public const ACME_LOG_FILE = '/var/log/acme.sh.log'; // Defaults for acme.sh public const ACME_ACCOUNT_KEY_LENGTH = 4096; @@ -61,6 +60,7 @@ abstract class LeCommon protected $acme_args = array(); # command line arguments to be passed to acme.sh protected $acme_env = array(); # environment variables to be used when running acme.sh protected $acme_keylength; # private key length in acme.sh compatible format + protected $acme_syslog; # syslog log level // Certificate details and configuration protected $cert_id; # AcmeClient certificate object ID @@ -173,34 +173,34 @@ abstract class LeCommon case 'extended': $this->acme_args[] = '--syslog 6'; $this->acme_args[] = '--log-level 2'; + $this->acme_syslog = 6; $this->debug = false; break; case 'debug': $this->acme_args[] = '--syslog 7'; $this->acme_args[] = '--debug'; + $this->acme_syslog = 7; $this->debug = true; break; case 'debug2': $this->acme_args[] = '--syslog 7'; $this->acme_args[] = '--debug 2'; + $this->acme_syslog = 7; $this->debug = true; break; case 'debug3': $this->acme_args[] = '--syslog 7'; $this->acme_args[] = '--debug 3'; + $this->acme_syslog = 7; $this->debug = true; break; default: $this->acme_args[] = '--syslog 6'; $this->acme_args[] = '--log-level 1'; + $this->acme_syslog = 6; $this->debug = false; break; } - - // Set log file - // NOTE: This log file is no longer exposed to the GUI. However, it may - // still turn out to be useful for debug purposes in rare egde cases. - $this->acme_args[] = LeUtils::execSafe('--log %s', self::ACME_LOG_FILE); } /**