Added Mysql CT
This commit is contained in:
72
CT-Files/mysql/Configs/config.inc.php
Normal file
72
CT-Files/mysql/Configs/config.inc.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('check_file_access')) {
|
||||
function check_file_access($path)
|
||||
{
|
||||
if (is_readable($path)) {
|
||||
return true;
|
||||
} else {
|
||||
error_log(
|
||||
'phpmyadmin: Failed to load ' . $path
|
||||
. ' Check group www-data has read access and open_basedir restrictions.'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load secret generated on postinst
|
||||
if (check_file_access('/opt/PhpMyAdmin/blowfish_secret.inc.php')) {
|
||||
require('/opt/PhpMyAdmin/blowfish_secret.inc.php');
|
||||
}
|
||||
|
||||
|
||||
$i = 0;
|
||||
$i++;
|
||||
|
||||
|
||||
/* Configure according to dbconfig-common if enabled */
|
||||
if (!empty($dbname)) {
|
||||
/* Authentication type */
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
/* Server parameters */
|
||||
if (empty($dbserver)) $dbserver = 'localhost';
|
||||
$cfg['Servers'][$i]['host'] = $dbserver;
|
||||
|
||||
if (!empty($dbport) || $dbserver != 'localhost') {
|
||||
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||
$cfg['Servers'][$i]['port'] = $dbport;
|
||||
}
|
||||
//$cfg['Servers'][$i]['compress'] = false;
|
||||
/* Select mysqli if your server has it */
|
||||
$cfg['Servers'][$i]['extension'] = 'mysqli';
|
||||
/* Optional: User for advanced features */
|
||||
$cfg['Servers'][$i]['controluser'] = $dbuser;
|
||||
$cfg['Servers'][$i]['controlpass'] = $dbpass;
|
||||
/* Optional: Advanced phpMyAdmin features */
|
||||
$cfg['Servers'][$i]['pmadb'] = $dbname;
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$cfg['Servers'][$i]['host'] = '127.0.0.1';
|
||||
$cfg['ThemeDefault'] = 'metro';
|
||||
29
CT-Files/mysql/Configs/my.cnf
Normal file
29
CT-Files/mysql/Configs/my.cnf
Normal file
@@ -0,0 +1,29 @@
|
||||
[mysqld]
|
||||
disable_log_bin
|
||||
default-authentication-plugin = mysql_native_password
|
||||
user = mysql
|
||||
pid-file = /var/run/mysqld/mysqld.pid
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
port = 3306
|
||||
basedir = /usr
|
||||
datadir = /var/lib/mysql
|
||||
tmpdir = /tmp
|
||||
lc-messages-dir = /usr/share/mysql
|
||||
skip-external-locking
|
||||
|
||||
innodb_buffer_pool_size = 1G # (adjust value here to about, 50%-70% of total RAM)
|
||||
innodb_log_file_size = 256M
|
||||
innodb_flush_log_at_trx_commit = 1 # may change to 0 or 2
|
||||
innodb_flush_method = O_DIRECT
|
||||
bind-address = 0.0.0.0
|
||||
key_buffer_size = 16M
|
||||
max_allowed_packet = 16M
|
||||
thread_stack = 192K
|
||||
thread_cache_size = 8
|
||||
myisam-recover-options = BACKUP
|
||||
log-error = /var/log/mysql/error.log
|
||||
expire_logs_days = 10
|
||||
max_binlog_size = 100M
|
||||
|
||||
[client]
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
82
CT-Files/mysql/Configs/php.ini
Normal file
82
CT-Files/mysql/Configs/php.ini
Normal file
@@ -0,0 +1,82 @@
|
||||
[PHP]
|
||||
engine = On
|
||||
short_open_tag = Off
|
||||
precision = 14
|
||||
output_buffering = 4096
|
||||
zlib.output_compression = Off
|
||||
implicit_flush = Off
|
||||
unserialize_callback_func =
|
||||
serialize_precision = -1
|
||||
disable_functions =
|
||||
disable_classes =
|
||||
zend.enable_gc = On
|
||||
zend.exception_ignore_args = On
|
||||
expose_php = On
|
||||
max_execution_time = 30
|
||||
max_input_time = 60
|
||||
max_input_vars = 5000
|
||||
memory_limit = -1
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
||||
display_errors = Off
|
||||
display_startup_errors = Off
|
||||
log_errors = On
|
||||
log_errors_max_len = 1024
|
||||
ignore_repeated_errors = Off
|
||||
ignore_repeated_source = Off
|
||||
report_memleaks = On
|
||||
variables_order = "GPCS"
|
||||
request_order = "GP"
|
||||
register_argc_argv = Off
|
||||
auto_globals_jit = On
|
||||
post_max_size = 256M
|
||||
auto_prepend_file =
|
||||
auto_append_file =
|
||||
default_mimetype = "text/html"
|
||||
default_charset = "UTF-8"
|
||||
doc_root =
|
||||
user_dir =
|
||||
enable_dl = Off
|
||||
file_uploads = On
|
||||
upload_max_filesize = 256M
|
||||
max_file_uploads = 20
|
||||
allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
default_socket_timeout = 60
|
||||
|
||||
[MySQLi]
|
||||
mysqli.max_persistent = -1
|
||||
mysqli.allow_persistent = On
|
||||
mysqli.max_links = -1
|
||||
mysqli.default_port = 3306
|
||||
mysqli.default_socket =
|
||||
mysqli.default_host =
|
||||
mysqli.default_user =
|
||||
mysqli.default_pw =
|
||||
mysqli.reconnect = Off
|
||||
|
||||
[Session]
|
||||
session.save_handler = files
|
||||
session.use_strict_mode = 0
|
||||
session.use_cookies = 1
|
||||
session.use_only_cookies = 1
|
||||
session.name = PHPSESSID
|
||||
session.auto_start = 0
|
||||
session.cookie_lifetime = 0
|
||||
session.cookie_path = /
|
||||
session.cookie_domain =
|
||||
session.cookie_httponly =
|
||||
session.cookie_samesite =
|
||||
session.serialize_handler = php
|
||||
session.gc_probability = 0
|
||||
session.gc_divisor = 1000
|
||||
session.gc_maxlifetime = 1440
|
||||
session.referer_check =
|
||||
session.cache_limiter = nocache
|
||||
session.cache_expire = 180
|
||||
session.use_trans_sid = 0
|
||||
session.sid_length = 26
|
||||
session.trans_sid_tags = "a=href,area=href,frame=src,form="
|
||||
session.sid_bits_per_character = 5
|
||||
|
||||
[Assertion]
|
||||
zend.assertions = -1
|
||||
14
CT-Files/mysql/Configs/phpmyadmin.service
Normal file
14
CT-Files/mysql/Configs/phpmyadmin.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=PhpMyadmin
|
||||
After=network.target
|
||||
After=mysqld.service
|
||||
|
||||
[Service]
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=php -S 0.0.0.0:80 -q -t /opt/PhpMyAdmin -c /opt/PhpMyAdmin/php.ini
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
14
CT-Files/mysql/Scripts/FirstRun.sh
Normal file
14
CT-Files/mysql/Scripts/FirstRun.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
read -p "Enter new password for mysql root: " -s NewMysqlPassword
|
||||
echo
|
||||
|
||||
#StaticVars
|
||||
TempPassword=$(cat /opt/Setup/TempMysqlPasswd)
|
||||
JeninsPlugins="dark-theme ssh-slaves workflow-aggregator locale golang git dark-theme copyartifact ws-cleanup"
|
||||
|
||||
#Configure PhpMyAdmin
|
||||
mysql -u root --password="$TempPassword" < /opt/PhpMyAdmin/sql/create_tables.sql
|
||||
echo -e "<?php\n\n\$cfg['blowfish_secret'] = '$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)';\n\n?>" >> /opt/PhpMyAdmin/blowfish_secret.inc.php
|
||||
#Set MysqlPassword
|
||||
mysql -u root -p$TempPassword -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$NewMysqlPassword'";
|
||||
rm /opt/Setup/TempMysqlPasswd
|
||||
15
CT-Files/mysql/Scripts/Init.sh
Normal file
15
CT-Files/mysql/Scripts/Init.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
#Configure MySQL
|
||||
rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf
|
||||
mkdir /etc/mysql/
|
||||
touch /etc/mysql/my.cnf.fallback
|
||||
mv /opt/Setup/Configs/my.cnf /etc/mysql/my.cnf
|
||||
|
||||
#Setup PhpMyAdmin
|
||||
mkdir /opt/PhpMyAdmin
|
||||
tar -C /opt/PhpMyAdmin -xzf /opt/Setup/phpmyadmin.tar.gz --strip 1
|
||||
rm -rf /opt/Setup/phpmyadmin.tar.gz
|
||||
mv /opt/Setup/Configs/config.inc.php /opt/PhpMyAdmin/config.inc.php
|
||||
mv /opt/Setup/Configs/phpmyadmin.service /etc/systemd/system/phpmyadmin.service
|
||||
chmod +x /etc/systemd/system/phpmyadmin.service
|
||||
ln -s /etc/systemd/system/phpmyadmin.service /etc/systemd/system/multi-user.target.wants/phpmyadmin.service
|
||||
Reference in New Issue
Block a user