Commit 23dae617 authored by Geoff Montee's avatar Geoff Montee Committed by Andrew Hutchings

MDEV-18374: Add SELinux policy to cracklib_password_check packages

parent 515ba857
......@@ -229,6 +229,8 @@ SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_compat_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_compat_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_cracklib-password-check_POST_INSTALL_SCRIPT_FILE
${CMAKE_SOURCE_DIR}/plugin/cracklib_password_check/support-files/rpm/mariadb-plugin-cracklib-password-check-postin.sh)
MACRO(ALTERNATIVE_NAME real alt)
IF(${ARGC} GREATER 2)
......
......@@ -14,4 +14,29 @@ IF (HAVE_ALLOCA_H AND HAVE_CRACK_H AND HAVE_LIBCRACK AND HAVE_MEMCPY)
MYSQL_ADD_PLUGIN(cracklib_password_check cracklib_password_check.c
LINK_LIBRARIES crack MODULE_ONLY
COMPONENT cracklib-password-check)
IF (RPM)
SET(inst_location ${INSTALL_SUPPORTFILESDIR})
INSTALL(DIRECTORY policy DESTINATION ${inst_location} COMPONENT cracklib-password-check)
FIND_PROGRAM(CHECKMODULE checkmodule)
FIND_PROGRAM(SEMODULE_PACKAGE semodule_package)
MARK_AS_ADVANCED(CHECKMODULE SEMODULE_PACKAGE)
# Build pp files in policy/selinux
IF(CHECKMODULE AND SEMODULE_PACKAGE)
FOREACH(pol mariadb-plugin-cracklib-password-check)
SET(src ${CMAKE_CURRENT_SOURCE_DIR}/policy/selinux/${pol}.te)
SET(tmp ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${pol}-pp.dir/${pol}.mod)
SET(out ${CMAKE_CURRENT_BINARY_DIR}/${pol}.pp)
ADD_CUSTOM_COMMAND(OUTPUT ${out}
COMMAND ${CHECKMODULE} -M -m ${src} -o ${tmp}
COMMAND ${SEMODULE_PACKAGE} -m ${tmp} -o ${out}
DEPENDS ${src})
ADD_CUSTOM_TARGET(${pol}-pp ALL DEPENDS ${out})
INSTALL(FILES ${out} DESTINATION ${inst_location}/policy/selinux COMPONENT cracklib-password-check)
ENDFOREACH()
ENDIF()
ENDIF()
ENDIF()
module mariadb-plugin-cracklib-password-check 1.0;
require {
type mysqld_t;
type crack_db_t;
class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
class dir { write search getattr add_name read remove_name open };
}
allow mysqld_t crack_db_t:dir { search read open };
allow mysqld_t crack_db_t:file { getattr read open };
SETARGETDIR=/etc/selinux/targeted/src/policy
SEDOMPROG=$SETARGETDIR/domains/program
SECONPROG=$SETARGETDIR/file_contexts/program
if [ -x /usr/sbin/semodule ] ; then
/usr/sbin/semodule -i /usr/share/mysql/policy/selinux/mariadb-plugin-cracklib-password-check.pp
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment