Monthly Archives: March 2016

cloudlinux add node.js

curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum -y install nodejs
npm install -g grunt grunt-cli gulp bower

touch /etc/cagefs/conf.d/nodejs.cfg

[nodejs]
comment=Nodejs
paths=/usr/bin/node, /usr/bin/npm, /usr/lib/node_modules

touch /etc/cagefs/conf.d/grunt.cfg
[grunt]
comment=Grunt tools
paths=/usr/bin/grunt

touch /etc/cagefs/conf.d/gulp.cfg
[gulp]
comment=Gulp tools
paths=/usr/bin/gulp

touch /etc/cagefs/conf.d/bower.cfg
[bower]
comment=Bower web tools
paths=/usr/bin/bower

cagefsctl --force-update

sendmail enable tls

mkdir /etc/mail/cert
cd /etc/mail/cert

openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key.open
openssl req -new -x509 -days 3650 -key server.key.open -out server.crt
chmod 600 server.*

vi /etc/mail/sendmail.cf
O CACertPath=/etc/mail/cert
O CACertFile=/etc/mail/cert/server.crt
O ServerCertFile=/etc/mail/cert/server.crt
O ServerKeyFile=/etc/mail/cert/server.key.open
O ClientKeyFile=/etc/mail/cert/server.crt

/etc/init.d/sendmail restart

ansible change root password


ansible change root password command line

pwgen -n 15 -c 1
soo2Echu7SooLao

using new python3:
python3 -c "import crypt; print(crypt.crypt('soo2Echu7SooLao', '\$6\$eyoo3seivengu3cei'))"
$6$eyoo3seivengu3ce$U30IkaHvd9Zmf4PPl1ZVR0G4coP6JZFwW/uxMkiVZV8vL2WjZaYrmsalfJ9snLjGR8rGKhCEyZpX5cRhAIf.R0

using old python2:
python -c 'import crypt; print crypt.crypt("soo2Echu7SooLao", "$6$saltsalt$")'

If you are getting error File "", line 1
import crypt; print crypt.crypt
SyntaxError: invalid syntax
use python3

using Perl:
perl -e 'print crypt("soo2Echu7SooLao","\$6\$saltsalt\$") . "\n"'

ansible -i inv xx.xx.xx.xx -m user -a ' name=root password=$6$eyoo3seivengu3ce$U30IkaHvd9Zmf4PPl1ZVR0G4coP6JZFwW/uxMkiVZV8vL2WjZaYrmsalfJ9snLjGR8rGKhCEyZpX5cRhAIf.R0' -k

SSH password:
xx.xx.xx.xx | success >> {
"append": false,
"changed": true,
"comment": "root",
"group": 0,
"home": "/root",
"move_home": false,
"name": "root",
"password": "NOT_LOGGING_PASSWORD",
"shell": "/bin/bash",
"state": "present",
"uid": 0
}