From 74e2d05df2ed090909c0ac6fd7ff7816b94d83ce Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Fri, 30 Jul 2021 14:14:37 +0200 Subject: [PATCH] Use SHA-2 instead of SHA-1 Content-type: text/plain The use of SHA-1 in RHEL9 is deprecated --- policycoreutils/setfiles/restorecon.8 | 10 +++++----- policycoreutils/setfiles/restorecon_xattr.8 | 8 ++++---- policycoreutils/setfiles/restorecon_xattr.c | 12 ++++++------ policycoreutils/setfiles/ru/restorecon.8 | 8 ++++---- policycoreutils/setfiles/ru/restorecon_xattr.8 | 10 +++++----- policycoreutils/setfiles/ru/setfiles.8 | 8 ++++---- policycoreutils/setfiles/setfiles.8 | 10 +++++----- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/policycoreutils/setfiles/restorecon.8 b/policycoreutils/setfiles/restorecon.8 index e07db2c87dc4..dbd55ce7c512 100644 --- a/policycoreutils/setfiles/restorecon.8 +++ b/policycoreutils/setfiles/restorecon.8 @@ -95,14 +95,14 @@ display usage information and exit. ignore files that do not exist. .TP .B \-I -ignore digest to force checking of labels even if the stored SHA1 digest -matches the specfiles SHA1 digest. The digest will then be updated provided +ignore digest to force checking of labels even if the stored SHA256 digest +matches the specfiles SHA256 digest. The digest will then be updated provided there are no errors. See the .B NOTES section for further details. .TP .B \-D -Set or update any directory SHA1 digests. Use this option to +Set or update any directory SHA256 digests. Use this option to enable usage of the .IR security.sehash extended attribute. @@ -200,7 +200,7 @@ the .B \-D option to .B restorecon -will cause it to store a SHA1 digest of the default specfiles set in an extended +will cause it to store a SHA256 digest of the default specfiles set in an extended attribute named .IR security.sehash on each directory specified in @@ -217,7 +217,7 @@ for further details. .sp The .B \-I -option will ignore the SHA1 digest from each directory specified in +option will ignore the SHA256 digest from each directory specified in .IR pathname \ ... and provided the .B \-n diff --git a/policycoreutils/setfiles/restorecon_xattr.8 b/policycoreutils/setfiles/restorecon_xattr.8 index e04528e60824..4b1ce304d995 100644 --- a/policycoreutils/setfiles/restorecon_xattr.8 +++ b/policycoreutils/setfiles/restorecon_xattr.8 @@ -23,7 +23,7 @@ or .SH "DESCRIPTION" .B restorecon_xattr -will display the SHA1 digests added to extended attributes +will display the SHA256 digests added to extended attributes .I security.sehash or delete the attribute completely. These attributes are set by .BR restorecon (8) @@ -48,12 +48,12 @@ extended attribute and are automatically excluded from searches. .sp By default .B restorecon_xattr -will display the SHA1 digests with "Match" appended if they match the default +will display the SHA256 digests with "Match" appended if they match the default specfile set or the .I specfile set used with the .B \-f -option. Non-matching SHA1 digests will be displayed with "No Match" appended. +option. Non-matching SHA256 digests will be displayed with "No Match" appended. This feature can be disabled by the .B \-n option. @@ -87,7 +87,7 @@ Do not append "Match" or "No Match" to displayed digests. recursively descend directories. .TP .B \-v -display SHA1 digest generated by specfile set (Note that this digest is not +display SHA256 digest generated by specfile set (Note that this digest is not used to match the .I security.sehash directory digest entries, and is shown for reference only). diff --git a/policycoreutils/setfiles/restorecon_xattr.c b/policycoreutils/setfiles/restorecon_xattr.c index 31fb82fd2099..bc22d3fd4560 100644 --- a/policycoreutils/setfiles/restorecon_xattr.c +++ b/policycoreutils/setfiles/restorecon_xattr.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) unsigned int xattr_flags = 0, delete_digest = 0, recurse = 0; unsigned int delete_all_digests = 0, ignore_mounts = 0; bool display_digest = false; - char *sha1_buf, **specfiles, *fc_file = NULL, *pathname = NULL; + char *sha256_buf, **specfiles, *fc_file = NULL, *pathname = NULL; unsigned char *fc_digest = NULL; size_t i, fc_digest_len = 0, num_specfiles; @@ -133,8 +133,8 @@ int main(int argc, char **argv) exit(-1); } - sha1_buf = malloc(fc_digest_len * 2 + 1); - if (!sha1_buf) { + sha256_buf = malloc(fc_digest_len * 2 + 1); + if (!sha256_buf) { fprintf(stderr, "Error allocating digest buffer: %s\n", strerror(errno)); @@ -143,16 +143,16 @@ int main(int argc, char **argv) } for (i = 0; i < fc_digest_len; i++) - sprintf((&sha1_buf[i * 2]), "%02x", fc_digest[i]); + sprintf((&sha256_buf[i * 2]), "%02x", fc_digest[i]); - printf("specfiles SHA1 digest: %s\n", sha1_buf); + printf("specfiles SHA256 digest: %s\n", sha256_buf); printf("calculated using the following specfile(s):\n"); if (specfiles) { for (i = 0; i < num_specfiles; i++) printf("%s\n", specfiles[i]); } - free(sha1_buf); + free(sha256_buf); printf("\n"); } diff --git a/policycoreutils/setfiles/ru/restorecon.8 b/policycoreutils/setfiles/ru/restorecon.8 index 9be3a63db356..745135020f4b 100644 --- a/policycoreutils/setfiles/ru/restorecon.8 +++ b/policycoreutils/setfiles/ru/restorecon.8 @@ -82,11 +82,11 @@ restorecon \- восстановить SELinux-контексты безопас игнорировать файлы, которые не существуют. .TP .B \-I -игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA1 соответствует дайджесту SHA1 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе +игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA256 соответствует дайджесту SHA256 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе .B ПРИМЕЧАНИЯ. .TP .B \-D -установить или обновить дайджесты SHA1 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута +установить или обновить дайджесты SHA256 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута .IR security.restorecon_last. .TP .B \-m @@ -159,7 +159,7 @@ GNU .B \-D команды .B restorecon -обеспечит сохранение дайджеста SHA1 файлов спецификации по умолчанию в расширенном атрибуте с именем +обеспечит сохранение дайджеста SHA256 файлов спецификации по умолчанию в расширенном атрибуте с именем .IR security.restorecon_last для каталогов, указанных в соответствующих путях .IR pathname \ ... @@ -173,7 +173,7 @@ GNU .sp Параметр .B \-I -позволяет игнорировать дайджест SHA1 из каждого каталога, указанного в +позволяет игнорировать дайджест SHA256 из каждого каталога, указанного в .IR pathname \ ... , и, при условии, что НЕ установлен параметр .B \-n diff --git a/policycoreutils/setfiles/ru/restorecon_xattr.8 b/policycoreutils/setfiles/ru/restorecon_xattr.8 index 41c441b8c5c2..25c4c3033334 100644 --- a/policycoreutils/setfiles/ru/restorecon_xattr.8 +++ b/policycoreutils/setfiles/ru/restorecon_xattr.8 @@ -23,7 +23,7 @@ restorecon_xattr \- управление записями расширенных .SH "ОПИСАНИЕ" .B restorecon_xattr -покажет дайджесты SHA1, добавленные в расширенные атрибуты +покажет дайджесты SHA256, добавленные в расширенные атрибуты .I security.restorecon_last, или полностью удалит эти атрибуты. Эти атрибуты устанавливаются командой .BR restorecon (8) @@ -47,11 +47,11 @@ restorecon_xattr \- управление записями расширенных .sp По умолчанию .B restorecon_xattr -показывает дайджесты SHA1, добавляя в конце "Match", если они соответствуют установленному по умолчанию файлу спецификации или файлу спецификации +показывает дайджесты SHA256, добавляя в конце "Match", если они соответствуют установленному по умолчанию файлу спецификации или файлу спецификации .I specfile, который установлен с помощью параметра .B \-f. -Несоответствующие дайджесты SHA1 будут показаны с добавлением "No Match" в конце. +Несоответствующие дайджесты SHA256 будут показаны с добавлением "No Match" в конце. Эту возможность можно отключить с помощью параметра .B \-n. @@ -81,7 +81,7 @@ restorecon_xattr \- управление записями расширенных рекурсивно спускаться по каталогам. .TP .B \-v -показать дайджест SHA1, созданный установленным файлом спецификации. +показать дайджест SHA256, созданный установленным файлом спецификации. .TP .B \-e .I directory @@ -97,7 +97,7 @@ restorecon_xattr \- управление записями расширенных .BR file_contexts (5). Он будет использоваться .BR selabel_open (3) -для получения набора записей меток; получение дайджеста SHA1 выполняется с помощью +для получения набора записей меток; получение дайджеста SHA256 выполняется с помощью .BR selabel_digest (3). Если этот параметр не указан, будет использоваться файл file_contexts по умолчанию. diff --git a/policycoreutils/setfiles/ru/setfiles.8 b/policycoreutils/setfiles/ru/setfiles.8 index 910101452625..7f2daa09191b 100644 --- a/policycoreutils/setfiles/ru/setfiles.8 +++ b/policycoreutils/setfiles/ru/setfiles.8 @@ -69,11 +69,11 @@ setfiles \- установить SELinux-контексты безопаснос игнорировать файлы, которые не существуют. .TP .B \-I -игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA1 соответствует дайджесту SHA1 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе +игнорировать дайджест, чтобы принудительно проверить метки, даже если хранимый дайджест SHA256 соответствует дайджесту SHA256 файлов спецификации. Затем (при условии отсутствия ошибок) дайджест будет обновлён. Более подробные сведения доступны в разделе .B ПРИМЕЧАНИЯ. .TP .B \-D -установить или обновить дайджесты SHA1 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута +установить или обновить дайджесты SHA256 для любых каталогов. Используйте этот параметр, чтобы включить использование расширенного атрибута .IR security.restorecon_last. .TP .B \-l @@ -186,7 +186,7 @@ GNU .B \-D команды .B setfiles . -Он обеспечивает сохранение дайджеста SHA1 файла спецификации +Он обеспечивает сохранение дайджеста SHA256 файла спецификации .B spec_file в расширенном атрибуте с именем .IR security.restorecon_last @@ -204,7 +204,7 @@ GNU .sp Параметр .B \-I -позволяет игнорировать дайджест SHA1 из каждого каталога, указанного в +позволяет игнорировать дайджест SHA256 из каждого каталога, указанного в .IR pathname \ ... , и, при условии, что НЕ установлен параметр .B \-n diff --git a/policycoreutils/setfiles/setfiles.8 b/policycoreutils/setfiles/setfiles.8 index bf26e161a71d..36fe6b369548 100644 --- a/policycoreutils/setfiles/setfiles.8 +++ b/policycoreutils/setfiles/setfiles.8 @@ -95,14 +95,14 @@ display usage information and exit. ignore files that do not exist. .TP .B \-I -ignore digest to force checking of labels even if the stored SHA1 digest -matches the specfiles SHA1 digest. The digest will then be updated provided +ignore digest to force checking of labels even if the stored SHA256 digest +matches the specfiles SHA256 digest. The digest will then be updated provided there are no errors. See the .B NOTES section for further details. .TP .B \-D -Set or update any directory SHA1 digests. Use this option to +Set or update any directory SHA256 digests. Use this option to enable usage of the .IR security.sehash extended attribute. @@ -261,7 +261,7 @@ the .B \-D option to .B setfiles -will cause it to store a SHA1 digest of the +will cause it to store a SHA256 digest of the .B spec_file set in an extended attribute named .IR security.sehash @@ -282,7 +282,7 @@ for further details. .sp The .B \-I -option will ignore the SHA1 digest from each directory specified in +option will ignore the SHA256 digest from each directory specified in .IR pathname \ ... and provided the .B \-n -- 2.39.1