diff options
Diffstat (limited to 'support-files')
-rw-r--r-- | support-files/Makefile.am | 4 | ||||
-rw-r--r-- | support-files/RHEL4-SElinux/Makefile.am | 23 | ||||
-rw-r--r-- | support-files/RHEL4-SElinux/mysql.fc | 25 | ||||
-rw-r--r-- | support-files/RHEL4-SElinux/mysql.te | 132 | ||||
-rw-r--r-- | support-files/mysql.server.sh | 24 | ||||
-rw-r--r-- | support-files/mysql.spec.sh | 42 |
6 files changed, 230 insertions, 20 deletions
diff --git a/support-files/Makefile.am b/support-files/Makefile.am index da8c25ccb1e..f2533100117 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -30,13 +30,13 @@ EXTRA_DIST = mysql.spec.sh \ MySQL-shared-compat.spec.sh \ ndb-config-2-node.ini.sh -SUBDIRS = MacOSX +SUBDIRS = MacOSX RHEL4-SElinux pkgdata_DATA = my-small.cnf \ my-medium.cnf \ my-large.cnf \ my-huge.cnf \ - my-innodb-heavy-4G.cnf \ + my-innodb-heavy-4G.cnf \ mysql-log-rotate \ binary-configure \ ndb-config-2-node.ini diff --git a/support-files/RHEL4-SElinux/Makefile.am b/support-files/RHEL4-SElinux/Makefile.am new file mode 100644 index 00000000000..52292136877 --- /dev/null +++ b/support-files/RHEL4-SElinux/Makefile.am @@ -0,0 +1,23 @@ +# Copyright (C) 2000-2001, 2003-2006 MySQL AB +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + +## Process this file with automake to create Makefile.in + +EXTRA_DIST = mysql.fc mysql.te + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/support-files/RHEL4-SElinux/mysql.fc b/support-files/RHEL4-SElinux/mysql.fc new file mode 100644 index 00000000000..0db0ccf6e68 --- /dev/null +++ b/support-files/RHEL4-SElinux/mysql.fc @@ -0,0 +1,25 @@ +# MySQL Database Server + +# +# /etc +# +/etc/my\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0) +/etc/mysql(/.*)? gen_context(system_u:object_r:mysqld_etc_t,s0) + +# +# /usr +# Red Hat compatibility +/usr/libexec/mysqld -- gen_context(system_u:object_r:mysqld_exec_t,s0) + +# MySQL AB compatibility +/usr/sbin/mysqld(-max)? -- gen_context(system_u:object_r:mysqld_exec_t,s0) + +# +# /var +# +/var/lib/mysql(/.*)? gen_context(system_u:object_r:mysqld_db_t,s0) +/var/lib/mysql/mysql\.sock -s gen_context(system_u:object_r:mysqld_var_run_t,s0) + +/var/log/mysql.* -- gen_context(system_u:object_r:mysqld_log_t,s0) + +/var/run/mysqld(/.*)? gen_context(system_u:object_r:mysqld_var_run_t,s0) diff --git a/support-files/RHEL4-SElinux/mysql.te b/support-files/RHEL4-SElinux/mysql.te new file mode 100644 index 00000000000..b050fa7b1a6 --- /dev/null +++ b/support-files/RHEL4-SElinux/mysql.te @@ -0,0 +1,132 @@ + +policy_module(mysql,1.0.0) + +######################################## +# +# Declarations +# + +type mysqld_t; +type mysqld_exec_t; +init_daemon_domain(mysqld_t,mysqld_exec_t) + +type mysqld_var_run_t; +files_pid_file(mysqld_var_run_t) + +type mysqld_db_t; +files_type(mysqld_db_t) + +type mysqld_etc_t alias etc_mysqld_t; +files_config_file(mysqld_etc_t) + +type mysqld_log_t; +logging_log_file(mysqld_log_t) + +type mysqld_tmp_t; +files_tmp_file(mysqld_tmp_t) + +######################################## +# +# Local policy +# + +allow mysqld_t self:capability { dac_override setgid setuid sys_resource net_bind_service }; +dontaudit mysqld_t self:capability sys_tty_config; +allow mysqld_t self:process { setsched getsched setrlimit signal_perms rlimitinh }; +allow mysqld_t self:fifo_file { read write }; +allow mysqld_t self:unix_stream_socket create_stream_socket_perms; +allow mysqld_t self:tcp_socket create_stream_socket_perms; +allow mysqld_t self:udp_socket create_socket_perms; + +allow mysqld_t mysqld_db_t:dir create_dir_perms; +allow mysqld_t mysqld_db_t:file create_file_perms; +allow mysqld_t mysqld_db_t:lnk_file create_lnk_perms; +files_var_lib_filetrans(mysqld_t,mysqld_db_t,{ dir file }) + +allow mysqld_t mysqld_etc_t:file { getattr read }; +allow mysqld_t mysqld_etc_t:lnk_file { getattr read }; +allow mysqld_t mysqld_etc_t:dir list_dir_perms; + +allow mysqld_t mysqld_log_t:file create_file_perms; +logging_log_filetrans(mysqld_t,mysqld_log_t,file) + +allow mysqld_t mysqld_tmp_t:dir create_dir_perms; +allow mysqld_t mysqld_tmp_t:file create_file_perms; +files_tmp_filetrans(mysqld_t, mysqld_tmp_t, { file dir }) + +allow mysqld_t mysqld_var_run_t:dir rw_dir_perms; +allow mysqld_t mysqld_var_run_t:sock_file create_file_perms; +allow mysqld_t mysqld_var_run_t:file create_file_perms; +files_pid_filetrans(mysqld_t,mysqld_var_run_t,file) + +kernel_read_system_state(mysqld_t) +kernel_read_kernel_sysctls(mysqld_t) + +corenet_non_ipsec_sendrecv(mysqld_t) +corenet_tcp_sendrecv_all_if(mysqld_t) +corenet_udp_sendrecv_all_if(mysqld_t) +corenet_tcp_sendrecv_all_nodes(mysqld_t) +corenet_udp_sendrecv_all_nodes(mysqld_t) +corenet_tcp_sendrecv_all_ports(mysqld_t) +corenet_udp_sendrecv_all_ports(mysqld_t) +corenet_tcp_bind_all_nodes(mysqld_t) +corenet_tcp_bind_mysqld_port(mysqld_t) +corenet_tcp_connect_mysqld_port(mysqld_t) +corenet_sendrecv_mysqld_client_packets(mysqld_t) +corenet_sendrecv_mysqld_server_packets(mysqld_t) + +dev_read_sysfs(mysqld_t) + +fs_getattr_all_fs(mysqld_t) +fs_search_auto_mountpoints(mysqld_t) + +term_dontaudit_use_console(mysqld_t) + +domain_use_interactive_fds(mysqld_t) + +files_getattr_var_lib_dirs(mysqld_t) +files_read_etc_runtime_files(mysqld_t) +files_read_etc_files(mysqld_t) +files_read_usr_files(mysqld_t) +files_search_var_lib(mysqld_t) + +auth_use_nsswitch(mysqld_t) + +init_use_fds(mysqld_t) +init_use_script_ptys(mysqld_t) + +libs_use_ld_so(mysqld_t) +libs_use_shared_libs(mysqld_t) + +logging_send_syslog_msg(mysqld_t) + +miscfiles_read_localization(mysqld_t) + +sysnet_read_config(mysqld_t) + +userdom_dontaudit_use_unpriv_user_fds(mysqld_t) +# for /root/.my.cnf - should not be needed: +userdom_read_sysadm_home_content_files(mysqld_t) + +ifdef(`distro_redhat',` + # because Fedora has the sock_file in the database directory + type_transition mysqld_t mysqld_db_t:sock_file mysqld_var_run_t; +') + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(mysqld_t) + term_dontaudit_use_generic_ptys(mysqld_t) + files_dontaudit_read_root_files(mysqld_t) +') + +optional_policy(` + daemontools_service_domain(mysqld_t, mysqld_exec_t) +') + +optional_policy(` + seutil_sigchld_newrole(mysqld_t) +') + +optional_policy(` + udev_read_db(mysqld_t) +') diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index f5fa4e9ed9a..9258fcf10c2 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -143,11 +143,12 @@ parse_manager_arguments() { wait_for_pid () { i=0 - while test $i -lt 35 ; do + while test $i -lt 900 ; do sleep 1 case "$1" in 'created') test -s $pid_file && i='' && break + kill -0 $2 || break # if the program goes away, stop waiting ;; 'removed') test ! -s $pid_file && i='' && break @@ -163,8 +164,10 @@ wait_for_pid () { if test -z "$i" ; then log_success_msg + return 0 else log_failure_msg + return 1 fi } @@ -277,26 +280,28 @@ case "$mode" in # Give extra arguments to mysqld with the my.cnf file. This script may # be overwritten at next upgrade. $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 & - wait_for_pid created + wait_for_pid created $!; return_value=$? # Make lock for RedHat / SuSE if test -w /var/lock/subsys then touch /var/lock/subsys/mysqlmanager fi + exit $return_value elif test -x $bindir/mysqld_safe then # Give extra arguments to mysqld with the my.cnf file. This script # may be overwritten at next upgrade. pid_file=$server_pid_file $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 & - wait_for_pid created + wait_for_pid created $!; return_value=$? # Make lock for RedHat / SuSE if test -w /var/lock/subsys then touch /var/lock/subsys/mysql fi + exit $return_value else log_failure_msg "Couldn't find MySQL manager or server" fi @@ -322,13 +327,14 @@ case "$mode" in echo $echo_n "Shutting down MySQL" kill $mysqlmanager_pid # mysqlmanager should remove the pid_file when it exits, so wait for it. - wait_for_pid removed + wait_for_pid removed; return_value=$? # delete lock for RedHat / SuSE if test -f $lock_dir then rm -f $lock_dir fi + exit $return_value else log_failure_msg "MySQL manager or server PID file could not be found!" fi @@ -337,8 +343,12 @@ case "$mode" in 'restart') # Stop the service and regardless of whether it was # running or not, start it again. - $0 stop $other_args - $0 start $other_args + if $0 stop $other_args; then + $0 start $other_args + else + log_failure_msg "Failed to stop running server, so refusing to try to start." + exit 1 + fi ;; 'reload') @@ -357,3 +367,5 @@ case "$mode" in exit 1 ;; esac + +exit 0 diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 528b1f2746b..f60664bdefd 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,3 +1,19 @@ +# Copyright (C) 2000-2007 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston +# MA 02110-1301 USA. + %define mysql_version @VERSION@ # use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) @@ -70,12 +86,9 @@ is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of MySQL AB. -The MySQL software has Dual Licensing, which means you can use the MySQL -software free of charge under the GNU General Public License -(http://www.gnu.org/licenses/). You can also purchase commercial MySQL -licenses from MySQL AB if you do not wish to be bound by the terms of -the GPL. See the chapter "Licensing and Support" in the manual for -further info. +Copyright (C) 2000-2007 MySQL AB +This software comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to modify and redistribute it under the GPL license. The MySQL web site (http://www.mysql.com/) provides the latest news and information about the MySQL software. Also please see the @@ -95,12 +108,9 @@ is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of MySQL AB. -The MySQL software has Dual Licensing, which means you can use the MySQL -software free of charge under the GNU General Public License -(http://www.gnu.org/licenses/). You can also purchase commercial MySQL -licenses from MySQL AB if you do not wish to be bound by the terms of -the GPL. See the chapter "Licensing and Support" in the manual for -further info. +Copyright (C) 2000-2007 MySQL AB +This software comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to modify and redistribute it under the GPL license. The MySQL web site (http://www.mysql.com/) provides the latest news and information about the MySQL software. Also please see the @@ -345,6 +355,8 @@ then fi ( cd mysql-test + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD perl ./mysql-test-run.pl --force --report-features perl ./mysql-test-run.pl --force --ps-protocol true ) @@ -407,6 +419,8 @@ then fi ( cd mysql-test + MTR_BUILD_THREAD=auto + export MTR_BUILD_THREAD perl ./mysql-test-run.pl --force --report-features perl ./mysql-test-run.pl --force --ps-protocol true ) @@ -755,6 +769,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Wed Jan 31 2007 Daniel Fischer <df@mysql.com> + +- add MTR_BUILD_THREAD=auto to test runs. + * Fri Jan 05 2007 Kent Boortz <kent@mysql.com> - Add CFLAGS to gcc call with --print-libgcc-file, to make sure the |