DC/OS Hive Metastore Security
-
The DC/OS Hive Metastore service allows you to create a service account to configure access for Hive Metastore. The service allows you to create and assign permissions as required for access.
-
The DC/OS Hive Metastore service supports Hive Metastore’s native transport encryption mechanisms. The service provides automation and orchestration to simplify the usage of the following features.
Provisioning a service account
This section describes how to configure DC/OS access for Hive Metastore. Depending on your security mode, Hive Metastore may require service authentication for access to DC/OS.
A service like Hive Metastore typically performs certain privileged actions on the cluster, which might require authenticating with the cluster. A service account associated with the service is used to authenticate with the DC/OS cluster. It is recommended to provisioning a separate service account for each service that would perform privileged operations. Service accounts authenticate using public-private keypair. The public key is used to create the service account in the cluster, while the corresponding private key is stored in the secret store. The service account and the service account secret are passed to the service as install time options.
Security mode | Service Account |
---|---|
Disabled | Not available |
Permissive | Optional |
Strict | Required |
If you install a service in permissive mode and do not specify a service account, Metronome and Marathon will act as if requests made by this service are made by an account with the superuser permission.
Prerequisites:
- DC/OS CLI installed and be logged in as a superuser.
- Enterprise DC/OS CLI 0.4.14 or later installed.
Create a Key Pair
In this step, a 2048-bit RSA public-private key pair is created using the Enterprise DC/OS CLI.
Create a public-private key pair and save each value into a separate file within the current directory.
dcos security org service-accounts keypair <private-key>.pem <public-key>.pem
Create a Service Account
From a terminal prompt, create a new service account (for example, hive-metastore
) containing the public key (<your-public-key>.pem
).
dcos security org service-accounts create -p <your-public-key>.pem -d <description> hive-metastore
You can verify your new service account using the following command.
dcos security org service-accounts show hive-metastore
Create a Secret
Create a secret (hive-metastore/<secret-name>
) with your service account and private key specified (<private-key>.pem
).
dcos security secrets create-sa-secret <private-key>.pem <service-account-id> hive-metastore/<secret-name>
You can list the secrets with this command:
dcos security secrets list /
Create and Assign Permissions
Use the following DC/OS CLI commands to rapidly provision the Hive Metastore service account with the required permissions.
- Create the permission.
If you need help configuring the permissions for hive-metastore, please feel to reach out to D2iQ support by filing a support ticket. Replace the instances of <service-role> with the correct name (<name>-role).
Service name | <service-role> DC/OS 1.13 or older DC/OS 2.0 or newer AND enforceRole=false |
<service-role> DC/OS 2.0 or newer AND enforceRole=true |
---|---|---|
/hive-metastore |
hive-metastore-role |
hive-metastore-role |
/hive-metastore-prod |
hive-metastore-prod-role |
hive-metastore-prod-role |
/team01/hive-metastore |
team01__hive-metastore-role |
team01 |
/team01/prod/hive-metastore |
team01__prod__hive-metastore-role |
team01 |
Permissive
Run these commands with the service account name you created for the service in the Create a Service Account step above. For example we are using hive-metastore
dcos security org users grant hive-metastore dcos:mesos:master:framework:role:<service-role> create --description "Allow registering as a framework of role <service-role> with Mesos master"
dcos security org users grant hive-metastore dcos:mesos:master:reservation:role:<service-role> create --description "Allow creating Mesos resource reservations of role <service-role>"
dcos security org users grant hive-metastore dcos:mesos:master:volume:role:<service-role> create --description "Allow creating Mesos persistent volumes of role <service-role>"
dcos security org users grant hive-metastore dcos:mesos:master:reservation:principal:hive-metastore delete --description "Allow unreserving Mesos resource reservations with principal hive-metastore"
dcos security org users grant hive-metastore dcos:mesos:master:volume:principal:hive-metastore delete --description "Allow deleting Mesos persistent volumes with principal hive-metastore"
Strict
Run these commands with the service account name you created for the service in the Create a Service Account step above. For example we are using hive-metastore
dcos security org users grant hive-metastore dcos:mesos:master:task:user:nobody create --description "Allow running a task as linux user nobody"
dcos security org users grant hive-metastore dcos:mesos:master:framework:role:<service-role> create --description "Allow registering as a framework of role <service-role> with Mesos master"
dcos security org users grant hive-metastore dcos:mesos:master:reservation:role:<service-role> create --description "Allow creating Mesos resource reservations of role <service-role>"
dcos security org users grant hive-metastore dcos:mesos:master:volume:role:<service-role> create --description "Allow creating Mesos persistent volumes of role <service-role>"
dcos security org users grant hive-metastore dcos:mesos:master:reservation:principal:hive-metastore delete --description "Allow unreserving Mesos resource reservations with principal hive-metastore"
dcos security org users grant hive-metastore dcos:mesos:master:volume:principal:hive-metastore delete --description "Allow deleting Mesos persistent volumes with principal hive-metastore"
Using the Secret Store for Passwords
Enterprise DC/OS provides a Secrets store to enable access to sensitive data such as database passwords, private keys, and API tokens. DC/OS manages secure transportation of secret data, access control and authorization, and secure storage of secret content. Detailed information can be found here
All tasks defined in the pod will have access to secret data. If the content of the secret is changed, the relevant pod needs to be restarted so that it can get updated content from the secret store.
We can use secrets in Hive Metastore to store database passwords. We can use the secret store as follows in order to store and use secrets in Hive Metastore service:
-
From the left-side navigation menu, click on
Secrets
. -
From the Secrets page, click on the ‘+’ icon in the top-right corner of the screen to create a new secret key-value pair.
-
In the
ID
field, provide a unique ID for the key-pair we want to create. This ID will be used later to enable secrets. In theValue
field, enter the value of the secret i.e. database password, private key, or API token. Lastly, click onCreate Secret
.
- Now, go to the Hive Metastore’s service configuration page for a fresh deployment of service using secrets. Click on ‘Hive Metastore’ configuration menu to proceed.
- Scroll down and look for the
Enable Secrets
checkbox. Check the box to enable secrets. Now, enter theID
of the secret created earlier in theDatabase Password
field. Click ‘Review & Run’. The service will now be deployed using secrets.
Forwarding DNS and Custom Domain
Every DC/OS cluster has a unique cryptographic ID which can be used to forward DNS queries to that cluster. To securely expose the service outside the cluster, external clients must have an upstream resolver configured to forward DNS queries to the DC/OS cluster of the service as described here.
With only forwarding configured, DNS entries within the DC/OS cluster will be resolvable at <task-domain>.autoip.dcos.<cryptographic-id>.dcos.directory
. However, if you configure a DNS alias, you can use a custom domain. For example, <task-domain>.cluster-1.acmeco.net
. In either case, the DC/OS Hive Metastore service will need to be installed with an additional security option:
{
"service": {
"security": {
"custom_domain": "<custom-domain>"
}
}
}
where <custom-domain>
is one of autoip.dcos.<cryptographic-id>.dcos.directory
or your organization’s specific domain (e.g., cluster-1.acmeco.net
).
As a concrete example, using the custom domain of cluster-1.acmeco.net
the node 0 task would have a host of node-0-server.<service-name>.cluster-1.acmeco.net
.