Hello community, here is the log from the commit of package apache-rex for openSUSE:Factory checked in at 2020-03-11 18:32:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/apache-rex (Old) and /work/SRC/openSUSE:Factory/.apache-rex.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "apache-rex" Wed Mar 11 18:32:23 2020 rev:19 rq:782217 version:20200228 Changes: -------- --- /work/SRC/openSUSE:Factory/apache-rex/apache-rex.changes 2020-02-22 18:59:43.393556185 +0100 +++ /work/SRC/openSUSE:Factory/.apache-rex.new.3160/apache-rex.changes 2020-03-11 18:32:33.426906427 +0100 @@ -1,0 +2,7 @@ +Fri Feb 28 17:27:46 UTC 2020 - pgaj...@suse.com + +- version update to 20200228 + * refactor mod_authn_dbd-mysql, create lib/mysql + * new mod_php-mysql + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apache-rex.spec ++++++ --- /var/tmp/diff_new_pack.44KGGz/_old 2020-03-11 18:32:34.906907335 +0100 +++ /var/tmp/diff_new_pack.44KGGz/_new 2020-03-11 18:32:34.910907338 +0100 @@ -25,7 +25,7 @@ %define macros_file macros.apache-rex Name: apache-rex -Version: 20200210 +Version: 20200228 Release: 0 Summary: Script for Apache HTTPD Runnable Examples License: Apache-2.0 ++++++ apache-rex.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/.gitignore new/apache-rex/.gitignore --- old/apache-rex/.gitignore 2020-02-10 17:09:07.343896984 +0100 +++ new/apache-rex/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -*.swp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/README.md new/apache-rex/README.md --- old/apache-rex/README.md 2020-02-10 17:09:07.339896960 +0100 +++ new/apache-rex/README.md 2020-02-28 18:25:01.993612197 +0100 @@ -81,6 +81,8 @@ * `VERBOSITY` Amount of information written by `run-rex` to the stdout. Possible values are 0 (normal), 1 (verbose) and 2 (debug). +* `MYSQL_ADMIN` + Admin of the mysql server (mysqladmin, create table). Example Structure ----------------- Binary files old/apache-rex/apache-rex.tar.bz2 and new/apache-rex/apache-rex.tar.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/contents new/apache-rex/contents --- old/apache-rex/contents 2020-02-10 17:09:07.351897036 +0100 +++ new/apache-rex/contents 2020-02-28 18:25:02.157613074 +0100 @@ -88,6 +88,7 @@ mod_wsgi-basic mod_proxy_uwsgi-basic mod_php-basic +mod_php-mysql mod_proxy_fcgi-php-fpm mod_proxy_fcgi-php-fpm-CGIPassAuth mod_proxy_fcgi-php-fpm-auth-RewriteRule diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/lib/mysql new/apache-rex/lib/mysql --- old/apache-rex/lib/mysql 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/lib/mysql 2020-02-28 18:25:02.157613074 +0100 @@ -0,0 +1,77 @@ +#!/bin/bash + +# $AREX_USER is invoking mysqld and is admin of the db + +function mysql_socket_path() +{ + echo -n "$mysql_dir/mysql.sock" +} + +function mysql_create_config() +{ + mysql_dir=$1 + + echo '>>> Create mysql configuration' + mkdir $mysql_dir/datadir $mysql_dir/datadir-private + cat << EOF > $mysql_dir/my.cnf +[client] +socket = $(mysql_socket_path) + +[mysqld] +log-error = $mysql_dir/mysqld.log +secure_file_priv = $mysql_dir/datadir-private +datadir = $mysql_dir/datadir +server-id = 1 +socket = $(mysql_socket_path) +EOF +} + +function mysql_initialize_db() +{ + mysql_dir=$1 + echo '>>> Initializing databases' + # --force is required by at least 10.0.38 on SLE 12 changeroot + mysql_install_db --defaults-file=$mysql_dir/my.cnf --force +} + +function mysql_invoke_mysqld() +{ + mysql_dir=$1 + mysqld --defaults-file=$mysql_dir/my.cnf& + sleep 2 +} + +function mysql_create_database +{ + mysql_dir=$1 + db_name=$2 + echo '>>> Creating database' + mysqladmin --defaults-file=$mysql_dir/my.cnf --user=$AREX_MYSQL_ADMIN password 'strong_secret' + mysqladmin --defaults-file=$mysql_dir/my.cnf --user=$AREX_MYSQL_ADMIN --password='strong_secret' create $db_name +} + +function mysql_invoke_script +{ + mysql_dir=$1 + mysql_script=$2 + user=$3 + pass=$4 + if [ -z "$user" ]; then + user=$AREX_MYSQL_ADMIN + pass='strong_secret' + fi + mysql --defaults-file=$mysql_dir/my.cnf --user=$user --password=$pass < $mysql_script +} + +function mysql_shutdown_server() +{ + mysql_dir=$1 + + echo + echo '>>> Shutting the mysql server down' + cat << EOF > $mysql_dir/shutdown.sql +SHUTDOWN; +EOF + mysql_invoke_script $mysql_dir $mysql_dir/shutdown.sql + sleep 2 +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_authn_dbd-mysql/post-run.sh new/apache-rex/mod_authn_dbd-mysql/post-run.sh --- old/apache-rex/mod_authn_dbd-mysql/post-run.sh 2020-02-10 17:09:07.347897010 +0100 +++ new/apache-rex/mod_authn_dbd-mysql/post-run.sh 2020-02-28 18:25:02.021612349 +0100 @@ -1,10 +1,5 @@ +. ../lib/mysql mysql_dir=$AREX_RUN_DIR/mysql -echo -echo '>>> Shutting the mysql server down' -cat << EOF > $mysql_dir/shutdown.sql -SHUTDOWN; -EOF -mysql --defaults-file=$mysql_dir/my.cnf --user root --password='roots_secret' < $mysql_dir/shutdown.sql -sleep 2 +mysql_shutdown_server $mysql_dir echo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_authn_dbd-mysql/pre-run.sh new/apache-rex/mod_authn_dbd-mysql/pre-run.sh --- old/apache-rex/mod_authn_dbd-mysql/pre-run.sh 2020-02-10 17:09:07.347897010 +0100 +++ new/apache-rex/mod_authn_dbd-mysql/pre-run.sh 2020-02-28 18:25:02.021612349 +0100 @@ -1,3 +1,5 @@ +. ../lib/mysql + # create password database mysql_dir=$AREX_RUN_DIR/mysql mkdir -p $mysql_dir @@ -5,33 +7,10 @@ john_sha1_passwd=$(htpasswd -nbs john johns_secret | head -n 1 | sed 's/john://') hans_sha1_passwd=$(htpasswd -nbs hans hans_secret | head -n 1 | sed 's/hans://') - -mkdir $mysql_dir/datadir $mysql_dir/datadir-private -cat << EOF > $mysql_dir/my.cnf -[client] -user = $AREX_USER -socket = $mysql_dir/mysql.sock - -[mysqld] -user=$AREX_USER -log-error = $mysql_dir/mysqld.log -secure_file_priv = $mysql_dir/datadir-private -datadir = $mysql_dir/datadir -server-id = 1 -socket = $mysql_dir/mysql.sock -EOF - -echo '>>> Initializing databases' -# --force is required by at least 10.0.38 on SLE 12 change root -mysql_install_db --defaults-file=$mysql_dir/my.cnf --force - -echo '>>> Invoking mysqld' -mysqld --defaults-file=$mysql_dir/my.cnf& -sleep 2 - -echo '>>> Creating authentication database' -mysqladmin --defaults-file=$mysql_dir/my.cnf --user root password 'roots_secret' -mysqladmin --defaults-file=$mysql_dir/my.cnf --user root --password='roots_secret' create httpd_auth +mysql_create_config $mysql_dir +mysql_initialize_db $mysql_dir +mysql_invoke_mysqld $mysql_dir +mysql_create_database $mysql_dir 'httpd_auth' echo '>>> Creating authentication table' cat << EOF > $mysql_dir/auth-db-setup.sql @@ -48,7 +27,7 @@ primary key (username) ); EOF -mysql --defaults-file=$mysql_dir/my.cnf --user root --password='roots_secret' < $mysql_dir/auth-db-setup.sql +mysql_invoke_script $mysql_dir $mysql_dir/auth-db-setup.sql echo '>>> Filling authentication table with example data' cat << EOF > $mysql_dir/insert-users.sql @@ -56,15 +35,16 @@ INSERT INTO password_table (username, passwd, groups) VALUES('john', '$john_sha1_passwd', 'employees'); INSERT INTO password_table (username, passwd, groups) VALUES('hans', '$hans_sha1_passwd', 'customers'); EOF -mysql --defaults-file=$mysql_dir/my.cnf --user auth_admin --password='auth_admin_secret' < $mysql_dir/insert-users.sql +mysql_invoke_script $mysql_dir $mysql_dir/insert-users.sql auth_admin 'auth_admin_secret' echo '>>> Testing the mysql is running and database is ready via password query' cat << EOF > $mysql_dir/password-get.sql USE httpd_auth; SELECT passwd FROM password_table WHERE username = 'hans'; EOF -mysql --defaults-file=$mysql_dir/my.cnf --user auth_admin --password='auth_admin_secret' \ - < $mysql_dir/password-get.sql > $mysql_dir/test-password.txt +mysql_invoke_script $mysql_dir $mysql_dir/password-get.sql auth_admin 'auth_admin_secret' \ + > $mysql_dir/test-password.txt grep "$hans_sha1_passwd" $mysql_dir/test-password.txt && echo "SUCCESS" || echo "FAILURE"; echo + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/BINARIES new/apache-rex/mod_php-mysql/BINARIES --- old/apache-rex/mod_php-mysql/BINARIES 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/BINARIES 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1 @@ +mysql mysql_install_db mysqld mysqladmin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/DESCRIPTION new/apache-rex/mod_php-mysql/DESCRIPTION --- old/apache-rex/mod_php-mysql/DESCRIPTION 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/DESCRIPTION 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1 @@ +How to connect php to mysql. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/MODULES new/apache-rex/mod_php-mysql/MODULES --- old/apache-rex/mod_php-mysql/MODULES 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/MODULES 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1 @@ +authz_user version php[5,7] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/MODULES_OPT new/apache-rex/mod_php-mysql/MODULES_OPT --- old/apache-rex/mod_php-mysql/MODULES_OPT 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/MODULES_OPT 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1 @@ +authn_core socache_shmcb authn_socache authz_dbd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/all_users.php.in new/apache-rex/mod_php-mysql/all_users.php.in --- old/apache-rex/mod_php-mysql/all_users.php.in 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/all_users.php.in 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,11 @@ +<?php + ini_set('mysqli.default_socket', '@mysql_socket@'); + $link = mysqli_connect('localhost', 'dbuser', 'dbuserpw', 'testdb'); + $result = mysqli_query($link, "INSERT INTO testtab VALUES('honza', 'Honza', 'Hloupy')"); + print("add honza: "); var_dump($result); + $result = mysqli_query($link, "SELECT username FROM testtab"); + while($row = mysqli_fetch_assoc($result)){ + print("${row['username']}\n"); + } +?> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/example.conf.in new/apache-rex/mod_php-mysql/example.conf.in --- old/apache-rex/mod_php-mysql/example.conf.in 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/example.conf.in 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,6 @@ +<Directory "@AREX_DOCUMENT_ROOT@"> + <FilesMatch "\.ph(p|tml)"> + SetHandler application/x-httpd-php + </FilesMatch> +</Directory> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/post-run.sh new/apache-rex/mod_php-mysql/post-run.sh --- old/apache-rex/mod_php-mysql/post-run.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/post-run.sh 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,5 @@ +. ../lib/mysql +mysql_dir=$AREX_RUN_DIR/mysql + +mysql_shutdown_server $mysql_dir +echo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/pre-run.sh new/apache-rex/mod_php-mysql/pre-run.sh --- old/apache-rex/mod_php-mysql/pre-run.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/pre-run.sh 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,52 @@ +. ../lib/mysql + +mysql_dir=$AREX_RUN_DIR/mysql +mkdir -p $mysql_dir + +mysql_create_config $mysql_dir +mysql_initialize_db $mysql_dir +mysql_invoke_mysqld $mysql_dir +mysql_create_database $mysql_dir 'testdb' + +echo '>>> Creating test table' +cat << EOF > $mysql_dir/test-db-setup.sql +GRANT SELECT, INSERT, UPDATE, DELETE ON testdb.* TO 'dbuser'@'localhost' IDENTIFIED BY 'dbuserpw'; +GRANT SELECT, INSERT, UPDATE, DELETE ON testdb.* TO 'dbuser'@'localhost.localdomain' IDENTIFIED BY 'dbuserpw'; +FLUSH PRIVILEGES; + +USE testdb; + +CREATE TABLE testtab ( +username varchar(255) not null, +name varchar(255), +surname varchar(255), +primary key (username) +); +EOF +mysql_invoke_script $mysql_dir $mysql_dir/test-db-setup.sql + +echo '>>> Filling authentication table with example data' +cat << EOF > $mysql_dir/insert-users.sql +USE testdb; +INSERT INTO testtab (username, name, surname) VALUES('john', 'John', 'Doe'); +INSERT INTO testtab (username, name, surname) VALUES('hans', 'Hans', 'Raw'); +EOF +mysql_invoke_script $mysql_dir $mysql_dir/insert-users.sql dbuser dbuserpw + +echo '>>> Testing the mysql is running and database' +cat << EOF > $mysql_dir/password-get.sql +USE testdb; +SELECT surname FROM testtab WHERE username = 'hans'; +EOF +mysql_invoke_script $mysql_dir $mysql_dir/password-get.sql dbuser dbuserpw \ + > $mysql_dir/test-fetch.txt +grep "Raw" $mysql_dir/test-fetch.txt && echo "SUCCESS" || echo "FAILURE"; +echo + +mkdir -p $AREX_DOCUMENT_ROOT +for i in all_users user_info; do + cp $i.php.in $AREX_DOCUMENT_ROOT/$i.php + sed -i "s:@mysql_socket@:$(mysql_socket_path):" $AREX_DOCUMENT_ROOT/$i.php +done + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/run.sh new/apache-rex/mod_php-mysql/run.sh --- old/apache-rex/mod_php-mysql/run.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/run.sh 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,12 @@ +exit_code=0 + +echo "[1] insert into table, get whole column from the table" +curl -s http://localhost:$AREX_PORT/all_users.php > $AREX_RUN_DIR/all_users.txt +grep 'add honza.*true' $AREX_RUN_DIR/all_users.txt || exit_code=1 +grep 'john' $AREX_RUN_DIR/all_users.txt || exit_code=1 + +echo "[2] get a column" +curl -s http://localhost:$AREX_PORT/user_info.php?un=hans > $AREX_RUN_DIR/user_info.txt +grep 'hans Hans Raw' $AREX_RUN_DIR/user_info.txt || exit_code=2 + +exit $exit_code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/skip.sh new/apache-rex/mod_php-mysql/skip.sh --- old/apache-rex/mod_php-mysql/skip.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/skip.sh 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,2 @@ +# REASON: mysqld is already running +exit $(ps -A | grep -q mysqld) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_php-mysql/user_info.php.in new/apache-rex/mod_php-mysql/user_info.php.in --- old/apache-rex/mod_php-mysql/user_info.php.in 1970-01-01 01:00:00.000000000 +0100 +++ new/apache-rex/mod_php-mysql/user_info.php.in 2020-02-28 18:25:02.081612668 +0100 @@ -0,0 +1,8 @@ +<?php + ini_set('mysqli.default_socket', '@mysql_socket@'); + $link = mysqli_connect('localhost', 'dbuser', 'dbuserpw', 'testdb'); + $result = mysqli_query($link, "SELECT * FROM testtab WHERE username = '$_GET[un]'"); + while($row = mysqli_fetch_assoc($result)){ + print("${row['username']} ${row['name']} ${row['surname']}\n"); + } +?> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/mod_ssl-pkcs11/pre-run.sh new/apache-rex/mod_ssl-pkcs11/pre-run.sh --- old/apache-rex/mod_ssl-pkcs11/pre-run.sh 2020-02-10 17:09:07.499897965 +0100 +++ new/apache-rex/mod_ssl-pkcs11/pre-run.sh 2020-02-28 18:25:02.277613715 +0100 @@ -39,7 +39,7 @@ else echo '--- Failed. --------------------------------' fi -echo "--- Write certiicate to token ---------------------" +echo "--- Write certificate to token ---------------------" success='yes' softhsm2_token_load_file "$AREX_RUN_DIR/pkcs11" 'aserver.suse.cz-token' 010203 $AREX_RUN_DIR/aserver.suse.cz/my.crt 'aserver.suse.cz-cert' cert || success='no' if [ $success == 'yes' ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apache-rex/run-rex new/apache-rex/run-rex --- old/apache-rex/run-rex 2020-02-10 17:09:07.355897061 +0100 +++ new/apache-rex/run-rex 2020-02-28 18:25:02.157613074 +0100 @@ -114,6 +114,10 @@ VERBOSITY=0 fi +if [ -z "$MYSQL_ADMIN" ]; then + MYSQL_ADMIN=$USER +fi + echod # @@ -270,6 +274,26 @@ which nc 2>/dev/null } +function mysql_install_db_command +{ + which mysql_install_db 2>/dev/null +} + +function mysqld_command +{ + which mysqld 2>/dev/null +} + +function mysqladmin_command +{ + which mysqladmin 2>/dev/null +} + +function mysql_command +{ + which mysql 2>/dev/null +} + function python_command() { which python3 python 2>/dev/null | head -n 1 @@ -439,6 +463,18 @@ NC_COMMAND=$(nc_command) register_command "$NC_COMMAND" nc echod -n '.' + MYSQL_INSTALL_DB_COMMAND=$(mysql_install_db_command) + register_command "$MYSQL_INSTALL_DB_COMMAND" mysql_install_db + echod -n '.' + MYSQLD_COMMAND=$(mysqld_command) + register_command "$MYSQLD_COMMAND" mysqld + echod -n '.' + MYSQLADMIN_COMMAND=$(mysqladmin_command) + register_command "$MYSQLADMIN_COMMAND" mysqladmin + echod -n '.' + MYSQL_COMMAND=$(mysql_command) + register_command "$MYSQL_COMMAND" mysql + echod -n '.' PYTHON_COMMAND=$(python_command) register_command "$PYTHON_COMMAND" python echod -n '.' @@ -504,7 +540,9 @@ fi export AREX_CORE_PATTERN=$(core_pattern) echod -n '.' - export AREX_HAVE_SYSTEMD_COREDUMP=$(have_systemd_coredump) + if command_exists coredumpctl; then + export AREX_HAVE_SYSTEMD_COREDUMP=$(have_systemd_coredump) + fi if command_exists vsftpd; then echod -n '.' export AREX_VSFTPD_VERSION=$(vsftpd_version) @@ -640,6 +678,9 @@ echod "httpd user ............................... $AREX_USER" export AREX_GROUP=$(id -gn) echod "httpd user group ......................... $AREX_GROUP" + + export AREX_MYSQL_ADMIN="$MYSQL_ADMIN" + echod "mysql admin .............................. $AREX_MYSQL_ADMIN" echod }