Skip to content

Instantly share code, notes, and snippets.

View FrancescaK's full-sized avatar

Francesca Krihely FrancescaK

View GitHub Profile
@FrancescaK
FrancescaK / traveling_santa.txt
Created December 10, 2015 23:20
Traveling Santa
{"_id":"Beijing","population":1.952e+07,"location":{"type":"Point","coordinates":[116.383333,39.916667]}}
{"_id":"Delhi","population":2.4953e+07,"location":{"type":"Point","coordinates":[77.23,28.61]}}
{"_id":"Guangzhou","population":2.0597e+07,"location":{"type":"Point","coordinates":[113.266667,23.133333]}}
{"_id":"Mexico City","population":2.0843e+07,"location":{"type":"Point","coordinates":[-99.133333,19.433333]}}
{"_id":"Mumbai","population":2.0741e+07,"location":{"type":"Point","coordinates":[72.825833,18.975]}}
{"_id":"New York","population":1.8591e+07,"location":{"type":"Point","coordinates":[-74.0059,40.7127]}}
{"_id":"North Pole","population":1.0,"location":{"type":"Point","coordinates":[0.0,90.0]}}
{"_id":"Osaka","population":2.0123e+07,"location":{"type":"Point","coordinates":[135.502222,-34.693889]}}
{"_id":"Shanghai","population":2.2991e+07,"location":{"type":"Point","coordinates":[121.5,31.2]}}
{"_id":"São Paulo","population":2.0831e+07,"location":{"type":"Point","coordinates":[-46.633333,-23.5
$ rpm -ihv centrifydc-5.2.0-rhel3-x86_64.rpm
$ adjoin -V -w -u ldap_admin mongotest.com
ldap_admin@MONGOTEST.COM's password:
$ kinit alex@MONGOTEST.COM
Password for alex@MONGOTEST.COM:
$ mongo --host lin-client.mongotest.com
> db.getSiblingDB("$external").auth(
{
mechanism: "GSSAPI",
user: "alex@MONGOTEST.COM",
}
)
1
$ nano /etc/mongod.conf
# Listen to local interface only. Comment out to listen on all interfaces.
#bind_ip=127.0.0.1
auth=true
setParameter=authenticationMechanisms=GSSAPI
$ service mongod stop
$ env KRB5_KTNAME=/home/ec2-user/mongod_lin.keytab mongod -f /etc/mongod.conf
$ adkeytab -n -P mongodb/lin-client.mongotest.com@MONGOTEST.COM -U mongodb/lin-client.mongotest.com@MONGOTEST.COM -K /home/ec2-user/mongod_lin.keytab -c "OU=support" -V --user ldap_admin lin-client-svc
ldap_admin@MONGOTEST.COM's password:
$ adquery user lin-client-svc -PS
userPrincipalName:mongodb/lin-client.mongotest.com@MONGOTEST.COM
servicePrincipalName:mongodb/lin-client.mongotest.com
$ mongo
> db.getSiblingDB("$external").auth(
{
mechanism: "PLAIN",
user: "alex",
pwd: "xxx",
digestPassword: false
}
)
1
$ nano /etc/mongod.conf
auth=true
setParameter=saslauthdPath=/var/run/saslauthd/mux
setParameter=authenticationMechanisms=PLAIN
$ service mongod restart
$ cp -v /etc/pam.d/{sshd,mongodb}
`/etc/pam.d/sshd' -> `/etc/pam.d/mongodb'
$ service saslauthd start
Starting saslauthd: [ OK ]
$ chkconfig saslauthd on
$ chkconfig --list saslauthd
saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
$ grep ^MECH /etc/sysconfig/saslauthd
MECH=pam