Last active
October 5, 2018 05:21
-
-
Save sarjarapu/c3a6045f652b84d93785c3ef68fe6f5a to your computer and use it in GitHub Desktop.
A bash script to create a Kerberos database for the Realm and create the Principal entries for the Users, Services etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Kerberos database for the realm | |
sudo kdb5_util create -s -r MDBKRB5.NET | |
# Loading random data | |
# Initializing database '/var/kerberos/krb5kdc/principal' for realm 'MDBKRB5.NET', | |
# master key name 'K/[email protected]' | |
# You will be prompted for the database Master Password. | |
# It is important that you NOT FORGET this password. | |
# Enter KDC database master key: | |
# Re-enter KDC database master key to verify: | |
sudo systemctl start krb5kdc.service | |
sudo systemctl start kadmin.service | |
sudo systemctl enable krb5kdc.service | |
sudo systemctl enable kadmin.service | |
# Set up a Kerberos principal with admin privileges | |
# and principal for the users, KDC host, and MongoDB server | |
# for simplicity I used <user/service name>@123 as the password | |
# Commands you need to run | |
sudo kadmin.local | |
# Authenticating as principal root/[email protected] with password. | |
# kadmin.local: | |
# Run the below commands at kadmin.local prompt | |
addprinc root/admin | |
# Enter password for principal "root/[email protected]": | |
# Re-enter password for principal "root/[email protected]": | |
# Principal "root/[email protected]" created. | |
addprinc alex | |
# Enter password for principal "[email protected]": | |
# Re-enter password for principal "[email protected]": | |
# Principal "[email protected]" created. | |
addprinc bob | |
# Enter password for principal "[email protected]": | |
# Re-enter password for principal "[email protected]": | |
# Principal "[email protected]" created. | |
addprinc host/kdc.mdbkrb5.net | |
# Enter password for principal "host/[email protected]": | |
# Re-enter password for principal "host/[email protected]": | |
# Principal "host/[email protected]" created. | |
addprinc mongodb/mdb01.mdbkrb5.net | |
# Enter password for principal "mongodb/[email protected]": | |
# Re-enter password for principal "mongodb/[email protected]": | |
# Principal "mongodb/[email protected]" created. | |
q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment