summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-01-20 15:10:39 +0100
committerSergei Golubchik <serg@mariadb.org>2020-01-21 10:56:47 +0100
commit8870f18e1df8774b76c30792f6c7bf04230f2a58 (patch)
tree0b2c8231797e53f2aceec09e9404705023c0a959
parent42049f9d397b1e82d7ba5de8ac01acea537b0924 (diff)
downloadmariadb-git-8870f18e1df8774b76c30792f6c7bf04230f2a58.tar.gz
MDEV-17292 Package the pam_user_map module
-rw-r--r--cmake/cpack_rpm.cmake3
-rw-r--r--cmake/install_layout.cmake6
-rw-r--r--debian/mariadb-server-10.2.install2
-rw-r--r--plugin/auth_pam/CMakeLists.txt10
-rw-r--r--plugin/auth_pam/mapper/user_map.conf13
5 files changed, 34 insertions, 0 deletions
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 82fadd6b689..8a2313cd20c 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -100,8 +100,11 @@ SET(ignored
"%ignore /etc"
"%ignore /etc/init.d"
"%ignore /etc/logrotate.d"
+ "%ignore /etc/security"
"%ignore /etc/systemd"
"%ignore /etc/systemd/system"
+ "%ignore /lib"
+ "%ignore /lib/security"
"%ignore ${CMAKE_INSTALL_PREFIX}"
"%ignore ${CMAKE_INSTALL_PREFIX}/bin"
"%ignore ${CMAKE_INSTALL_PREFIX}/include"
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index d1bb477c072..57c57992f18 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -163,6 +163,7 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock"
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
+SET(INSTALL_PAMDIR_RPM "/lib/security")
#
# DEB layout
@@ -195,6 +196,11 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(INSTALL_PAMDIR_DEB "/lib/x86_64-linux-gnu/security")
+ELSE()
+ SET(INSTALL_PAMDIR_DEB "/lib/i386-linux-gnu/security")
+ENDIF()
#
# SVR4 layout
diff --git a/debian/mariadb-server-10.2.install b/debian/mariadb-server-10.2.install
index 1ac1c67472c..d35fdf87b94 100644
--- a/debian/mariadb-server-10.2.install
+++ b/debian/mariadb-server-10.2.install
@@ -3,7 +3,9 @@ debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
etc/apparmor.d/usr.sbin.mysqld
+etc/security/user_map.conf
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
+lib/*/security/pam_user_map.so
usr/bin/aria_chk
usr/bin/aria_dump_log
usr/bin/aria_ftdump
diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt
index 606fef002e7..0efb0b07feb 100644
--- a/plugin/auth_pam/CMakeLists.txt
+++ b/plugin/auth_pam/CMakeLists.txt
@@ -10,5 +10,15 @@ IF(HAVE_PAM_APPL_H)
ENDIF(HAVE_STRNDUP)
FIND_LIBRARY(PAM_LIBRARY pam)
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY)
+
+ IF(TARGET auth_pam)
+ ADD_LIBRARY(pam_user_map MODULE mapper/pam_user_map.c)
+ TARGET_LINK_LIBRARIES(pam_user_map pam)
+ SET_TARGET_PROPERTIES (pam_user_map PROPERTIES PREFIX "")
+ IF(INSTALL_PAMDIR)
+ INSTALL(TARGETS pam_user_map DESTINATION ${INSTALL_PAMDIR} COMPONENT Server)
+ INSTALL(FILES mapper/user_map.conf DESTINATION /etc/security COMPONENT Server)
+ ENDIF()
+ ENDIF()
ENDIF(HAVE_PAM_APPL_H)
diff --git a/plugin/auth_pam/mapper/user_map.conf b/plugin/auth_pam/mapper/user_map.conf
new file mode 100644
index 00000000000..4af8fb0fe10
--- /dev/null
+++ b/plugin/auth_pam/mapper/user_map.conf
@@ -0,0 +1,13 @@
+#
+# Configuration file for pam_user_map.so
+#
+# defines mapping in the form
+#
+# orig_user_name: mapped_user_name
+#
+# or (to map all users in a specific group)
+#
+# @group_name: mapped_user_name
+#
+# comments and empty lines are ignored
+#