Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"newserver" needs mysql securing after running #7

Open
btopro opened this issue Mar 13, 2015 · 1 comment
Open

"newserver" needs mysql securing after running #7

btopro opened this issue Mar 13, 2015 · 1 comment
Assignees

Comments

@btopro
Copy link
Member

btopro commented Mar 13, 2015

right now this is being treated as a development environment.

well.. https://github.com/psudug/nittany-vagrant/blob/master/scripts/_nonvagrant/newserver.sh happened and now these scripts will run on any CentOS 6.5 box they are copy and pasted into the terminal of. Unfortunately OOTB it currently doesn't do any mysql securing. So... we need to fix that

@btopro
Copy link
Member Author

btopro commented Mar 19, 2015

Proposed solution; @bradallenfisher plz review

/etc/init.d/mysqld restart
# mysql and instead, a high credential nittanydbo is created
mysql_install_db
# used for random password generation
COUNTER=0
char=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V X W Y Z)
max=${#char[*]}
# generate a random 30 digit password
pass=''
for i in `seq 1 30`
do
  let "rand=$RANDOM % 62"
  pass="${pass}${char[$rand]}"
done
# make mysql secure so no one knows the password except this script
cat <<EOF | mysql_secure_installation

Y
$pass
$pass
Y
Y
Y
Y
EOF
# generate a password for the nittanydbo account
dbopass=''
for i in `seq 1 30`
do
  let "rand=$RANDOM % 62"
  dbopass="${pass}${char[$rand]}"
done
# now make an nittanydbo
cat <<EOF | mysql -u root --password=$pass
CREATE USER 'nittanydbo'@'localhost' IDENTIFIED BY '$dbopass';
GRANT ALL PRIVILEGES ON *.* TO 'nittanydbo'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants