Skip to content

Instantly share code, notes, and snippets.

View jamesattard's full-sized avatar

James A. jamesattard

View GitHub Profile
root@m-mysql01# mysql -u root -p -e "INSERT INTO mysql.user (Host,User) values ('10.250.1.100','haproxy_check'); FLUSH PRIVILEGES;"
root@m-mysql01# mysql -u root -p -e "GRANT ALL PRIVILEGES ON *.* TO 'mycoolapp'@'10.250.1.100' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES"
root@mysql-cluster# yum install mysql-client
root@mysql-cluster# mysql -h 10.250.1.101 -u haproxy_root -p -e "SHOW DATABASES"
root@mysql-cluster# yum install haproxy
root@mysql-cluster# cat /etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local0 notice
user haproxy
group haproxy
defaults
log global
retries 2
root@mysql-cluster# haproxy -D -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg
root@mysql-cluster# mysql -h 10.250.1.101 -u mycoolapp -p password -e "SHOW DATABASES"
root@mysql-cluster# mysqlslap --auto-generate-sql --concurrency=50 --number-of-queries=1000 --iterations=10 -umycoolapp -ppassword -h10.250.10.100
Benchmark
Average number of seconds to run all queries: 3.102 seconds
Minimum number of seconds to run all queries: 2.990 seconds
Maximum number of seconds to run all queries: 3.174 seconds
Number of clients running queries: 50
Average number of queries per client: 20
root@mysql-cluster# mysqlslap --auto-generate-sql --concurrency=50 --number-of-queries=1000 --iterations=10 -umycoolapp -ppassword -h10.250.10.101
Benchmark
Average number of seconds to run all queries: 3.182 seconds
Minimum number of seconds to run all queries: 3.073 seconds
Maximum number of seconds to run all queries: 3.329 seconds
Number of clients running queries: 50
Average number of queries per client: 20
listen MySQL-Proxy 10.250.1.100:3306
mode tcp
option mysql-check user haproxy_check
balance roundrobin
server m-mysql01 10.250.1.101:3306 check maxconn 20
#server m-mysql02 10.250.1.102:3306 check maxconn 20
╭─james@darktech ~
╰─$ env X="() { :;} ; echo Vulnerable" /bin/sh -c "echo hello world"
Vulnerable
hello world