From 9afe99aaf9b2a9b24734612bbb6d9144e646fbb4 Mon Sep 17 00:00:00 2001 From: themylogin Date: Tue, 15 Feb 2022 21:42:53 +0100 Subject: [PATCH 1/3] Add empty `/etc/default/locale` file to be read by `/etc/pam.d/sshd` We should not have any default locale as https://wiki.debian.org/Locale suggests ("If you have users who access the system through ssh, it is recommended that you choose None as your default locale") --- src/freenas/etc/default/locale | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/freenas/etc/default/locale diff --git a/src/freenas/etc/default/locale b/src/freenas/etc/default/locale new file mode 100644 index 000000000000..e69de29bb2d1 From 1952025bd7b1a8f0ad9f41e47052b9766901cce1 Mon Sep 17 00:00:00 2001 From: caleb Date: Tue, 3 Dec 2024 08:06:42 -0500 Subject: [PATCH 2/3] add test --- tests/api2/test_default_locale.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/api2/test_default_locale.py diff --git a/tests/api2/test_default_locale.py b/tests/api2/test_default_locale.py new file mode 100644 index 000000000000..66e2be1b19e7 --- /dev/null +++ b/tests/api2/test_default_locale.py @@ -0,0 +1,11 @@ +from middlewared.test.integration.utils import call + + +def test_default_locale_exists(): + # it's important we keep this empty file + # since it causes error like these + # root@truenas[~]# tail -1 /var/log/error + # Nov 20 21:17:01 truenas CRON[399613]: pam_env(cron:session): \ + # Unable to open env file: /etc/default/locale: No such file or directory + rv = call("filesystem.stat", "/etc/default/locale") + assert rv, rv From 809394246d165c302389fbbfbcc29b5d06ca2784 Mon Sep 17 00:00:00 2001 From: caleb Date: Tue, 3 Dec 2024 08:07:57 -0500 Subject: [PATCH 3/3] expand comment --- tests/api2/test_default_locale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/api2/test_default_locale.py b/tests/api2/test_default_locale.py index 66e2be1b19e7..9e59054b2830 100644 --- a/tests/api2/test_default_locale.py +++ b/tests/api2/test_default_locale.py @@ -3,7 +3,7 @@ def test_default_locale_exists(): # it's important we keep this empty file - # since it causes error like these + # since it causes error like these if its missing # root@truenas[~]# tail -1 /var/log/error # Nov 20 21:17:01 truenas CRON[399613]: pam_env(cron:session): \ # Unable to open env file: /etc/default/locale: No such file or directory