Table of Contents
It is possible to add security to a new or an existing Oracle NoSQL Database installation.
To add security to a new or an existing Oracle NoSQL Database single host deployment, see the next section. For multiple node deployments, see Multiple Node Secure Deployment.
The following examples describe how to add security to a new or an existing Oracle NoSQL Database single host deployment.
To install Oracle NoSQL Database securely:
Run the makebootconfig
utility
with the required -store-security
option
to set up the basic store configuration with security:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar makebootconfig \ -root KVROOT -port 5000 \ -admin 5001 -host node01 -harange 5010,5020 \ -store-security configure -pwdmgr pwdfile -capacity 1
In this example, -store-security
configure
is used, so the
security configuration
utility
is run as part of the makebootconfig process and you
are prompted for a password to use for your keystore file:
Enter a password for the Java KeyStore:
Enter a password for your store and then reenter it
for verification. In this case, the password file is used, and
the securityconfig
tool will automatically
generate the following security related files:
Enter a password for the Java KeyStore: *********** Re-enter the KeyStore password for verification: *********** Created files: security/client.trust security/client.security security/store.keys security/store.trust security/store.passwd security/security.xml
In a multi-host store environment, the security directory and all files contained in it should be copied to each server that will host a Storage Node.
Start the Storage Node Agent (SNA):
nohup java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar start -root KVROOT&
When a newly created store with a secure configuration is first started, there are no user definitions available against which to authenticate access. In order to reduce risk of unauthorized access, an admin will only allow you to connect to it from the host on which it is running. This security measure is not a complete safeguard against unauthorized access. It is important that you do not provide local access to machines running KVStore. In addition, you should perform steps 5, 6 and 7 soon after this step in order to minimize the time period in which the admin might be accessible without full authentication. For more information on maintaining a secure store see Guidelines for Securing the Configuration.
Start runadmin
in security mode on the
KVStore server host (node01). To do this, use the following
command:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar \ runadmin -port 5000 -host node01 \ -security KVROOT/security/client.security Logged in admin as anonymous
Use the configure -name
command to specify
the name of the KVStore that you want to configure:
kv-> configure -name mystore Store configured: mystore
Create an admin user. In this case, user
root
is defined:
kv-> plan create-user -name root -admin -wait Enter the new password: ******** Re-enter the new password: ******** Executed plan 6, waiting for completion... Plan 6 ended successfully
For more information on user creation and administration, see User Management.
Create a new password file to store the credentials needed to allow clients to login as the admin user (root):
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar securityconfig \ pwdfile create -file KVROOT/security/login.passwd java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar securityconfig pwdfile secret \ -file KVROOT/security/login.passwd -set -alias root Enter the secret value to store: ******** Re-enter the secret value for verification: ******** Secret created OK
The password must match the one set for the admin in the previous step.
For more information on user creation and administration, see User Management.
At this point, it is possible to connect to the
store as the root user. To login, you can use either the
-username <user>
runadmin argument or specify
the "oracle.kv.auth.username" property in the security file.
In this example, a security file (mylogin.txt) is used. To login, use the following command:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar runadmin -port 5000 \ -host localhost -security mylogin Logged in admin as root
The file mylogin.txt
should be a copy of the
client.security
file with additional properties
settings for authentication. The file would then contain content like this:
oracle.kv.auth.username=root oracle.kv.auth.pwdfile.file=KVROOT/security/login.passwd oracle.kv.transport=ssl oracle.kv.ssl.trustStore=KVROOT/security/client.trust oracle.kv.ssl.protocols=TLSv1.2,TLSv1.1,TLSv1 oracle.kv.ssl.hostnameVerifier=dnmatch(CN\=NoSQL)
For more information, see User Login.
To add security to an existing Oracle NoSQL Database installation:
Shut down the KVStore instance:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar stop \ -root KVROOT
Run the securityconfig
utility to set up the basic store configuration with
security:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar securityconfig
Use the config create
command
with the -pwdmgr
option to specify
the mechanism used to hold passwords that is needed
for accessing the stores. In this case, Oracle Wallet is used. Oracle
Wallet is only available in the Oracle NoSQL Database EE version. CE deployments should use
the pwdfile
option instead.
config create -pwdmgr wallet -root KVROOT Enter a password for the Java KeyStore:
Enter a password for your store and then reenter it for verification. The configuration tool will automatically generate some security related files:
Enter a password for the Java KeyStore: *********** Re-enter the KeyStore password for verification: *********** Created files: security/security.xml security/store.keys security/store.trust security/store.wallet/cwallet.sso security/client.security security/client.trust
In a multi-host store environment, the security directory and all files contained in it should be copied to each server that will host a Storage Node.
Use the config add-security
command to add
the security configuration you just created:
security-> config add-security -root KVROOT -secdir security -config config.xml Configuration updated.
When running this command, the securityconfig
tool will verify the existence of the referenced files and
will update the specified bootstrap configuration file to refer
to the security configuration. This process is normally done with the
KVStore instance stopped, and must be performed on each Storage Node
of the store.
Start the Storage Node Agent (SNA):
nohup java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar start -root KVROOT&
Start runadmin
in security mode on the
KVStore server host (node01). To do this, use the following
command:
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar \ runadmin -port 5000 -host node01 \ -security KVROOT/security/client.security Logged in admin as anonymous.
This command sets SSL as a connection method and names a copy of the generated truststore file (client.security). For more information on SSL properties, see SSL communication properties.
Create an admin user. In this case, user
root
is defined:
kv-> plan create-user -name root -admin -wait Enter the new password: ******** Re-enter the new password: ******** Executed plan 8, waiting for completion... Plan 8 ended successfully
For more information on user creation and administration, see User Management.
Create a new wallet file to store the credentials needed to allow clients to login as the admin user (root):
java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar securityconfig \ wallet create -dir KVROOT/security/login.wallet java -Xmx256m -Xms256m \ -jar KVHOME/lib/kvstore.jar securityconfig wallet secret \ -dir KVROOT/security/login.wallet -set -alias root Enter the secret value to store: ******** Re-enter the secret value for verification: ******** Secret created OK
The password must match the one set for the admin in the previous step.
For more information on user creation and administration, see User Management.
At this point, it is possible to connect to the
store as the root user. To login, you can use either the
-username <user>
runadmin argument or specify
the "oracle.kv.auth.username" property in the security file.
In this example, the oracle.kv.security property is used. To login use the following command:
java -Xmx256m -Xms256m \ -Doracle.kv.security=mylogin \ -jar KVHOME/lib/kvstore.jar runadmin -port 5000 -host localhost Logged in admin as root
The file mylogin.txt
should be a copy of the
client.security
file with additional properties
settings for authentication. The file would then contain content like this:
oracle.kv.auth.username=root oracle.kv.auth.wallet.dir=KVROOT/security/login.wallet oracle.kv.transport=ssl oracle.kv.ssl.trustStore=KVROOT/security/client.trust oracle.kv.ssl.protocols=TLSv1.2,TLSv1.1,TLSv1 oracle.kv.ssl.hostnameVerifier=dnmatch(CN\=NoSQL)
For more information, see User Login.