Skip to content

Commit 9655801

Browse files
jdestefano-mongojwilliams-mongo
authored andcommitted
DOCSP-5714 - X.509 user management. (#48)
* DOCSP-5714 - X.509 user management. * DOCSP-5714 - Review edits. * DOCSP-5714 - Tech review feedback. * DOCSP-5714 - Add redirect for older versions that don't have the X.509 user management page.
1 parent c23b30f commit 9655801

File tree

5 files changed

+191
-0
lines changed

5 files changed

+191
-0
lines changed

config/redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ raw: kubernetes-operator/release-notes -> ${base}/stable/release-notes
2828

2929
# v0.11 and earlier
3030
[*-v0.11]: kubernetes-operator/${version}/reference/k8s-op-exclusive-settings -> ${base}/${version}/tutorial/edit-deployment
31+
[*-v0.11]: kubernetes-operator/${version}/tutorial/manage-database-users-x509 -> ${base}/${version}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
title: "Copy the following example |k8s-configmap|."
3+
level: 4
4+
stepnum: 1
5+
ref: copy-k8s-user-configmap
6+
content: |
7+
8+
.. literalinclude:: /reference/k8s/example-user.yaml
9+
:language: yaml
10+
:emphasize-lines: 5,7-8,11-12
11+
12+
---
13+
title: "Open your preferred text editor and paste the example ConfigMap into a new text file."
14+
stepnum: 2
15+
level: 4
16+
ref: paste-k8s-configmap
17+
---
18+
title: "Change the five highlighted lines."
19+
level: 4
20+
stepnum: 3
21+
ref: change-k8s-user-configmap
22+
content: |
23+
24+
Use the following table to guide you through changing the highlighted
25+
lines in the ConfigMap:
26+
27+
.. list-table::
28+
:widths: 20 20 40 20
29+
:header-rows: 1
30+
31+
* - Key
32+
- Type
33+
- Description
34+
- Example
35+
36+
* - ``metadata.name``
37+
- string
38+
- The name of the database user resource.
39+
- ``mms-user-1``
40+
41+
* - ``spec.username``
42+
- string
43+
- The subject line of the x509 client certificate signed
44+
by the |k8s| |certauth| (Kube CA).
45+
46+
.. important::
47+
48+
The username must comply with the
49+
`RFC 2253 <https://tools.ietf.org/html/rfc2253>`__
50+
LDAPv3 Distinguished Name standard.
51+
52+
To get the subject line of the X.509 certificate, run the
53+
following command:
54+
55+
.. code-block:: sh
56+
57+
openssl x509 -noout \
58+
-subject -in <my-cert.pem> \
59+
-nameopt RFC2253
60+
61+
- ``CN=mms-user,U=My Organizational Unit,O=My Org,L=New York,ST=New York,C=US``
62+
63+
* - ``spec.project``
64+
- string
65+
- The name of the project containing the MongoDB database
66+
where user will be added.
67+
- ``my-project``
68+
69+
* - ``spec.roles.db``
70+
- string
71+
- The database the :ref:`role <roles>` can act on.
72+
- ``admin``
73+
74+
* - ``spec.roles.name``
75+
- string
76+
- The name of the :ref:`role <roles>` to grant the database
77+
user. The role name can be any
78+
:ref:`built-in MongoDB role <built-in-roles>` or
79+
:opsmgr:`custom role </tutorial/manage-mongodb-roles>` that exists
80+
in |com|.
81+
- ``readWriteAnyDatabase``
82+
---
83+
title: "Add any additional roles for the user to the ConfigMap."
84+
level: 4
85+
stepnum: 3
86+
ref: add-additional-roles-k8s-user
87+
content: |
88+
You may grant additional roles to this user using the format defined
89+
in the following example:
90+
91+
.. code-block:: yaml
92+
:copyable: false
93+
:emphasize-lines: 10-14
94+
95+
---
96+
apiVersion: mongodb.com/v1
97+
kind: MongoDBUser
98+
metadata:
99+
name: mms-user-1
100+
spec:
101+
username: CN=mms-user,U=My Organizational Unit,O=My Org,L=New York,ST=New York,C=US
102+
project: my-project
103+
db: "$external"
104+
roles:
105+
- db: admin
106+
name: backup
107+
- db: admin
108+
name: restore
109+
...
110+
111+
---
112+
title: "Create the user."
113+
level: 4
114+
stepnum: 4
115+
ref: create-k8s-user
116+
content: |
117+
118+
Invoke the following |k8s| command to create your database user:
119+
120+
.. code-block:: sh
121+
122+
kubectl apply -f <database-user-conf>.yaml
123+
---
124+
title: "View the newly created user in |com|."
125+
level: 4
126+
stepnum: 5
127+
ref: view-k8s-user
128+
content: |
129+
130+
You can view the newly-created user in |com|:
131+
132+
1. From the Project's :guilabel:`Deployment` view, click
133+
the :guilabel:`Security` tab.
134+
135+
#. Click the :guilabel:`MongoDB Users` nested tab.
136+
137+
...

source/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ the rest of the application services. DBAs can work within the familiar
4242

4343
Installation </installation>
4444
Database Deployment </deploy>
45+
User Management </tutorial/manage-database-users-x509>
4546
/reference
4647
/specification
4748
Release Notes </release-notes>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: mongodb.com/v1
3+
kind: MongoDBUser
4+
metadata:
5+
name: <resource-name>
6+
spec:
7+
username: <rfc2253-subject>
8+
project: <my-configmap> # Should match metadata.name in your project's ConfigMap.
9+
db: "$external"
10+
roles:
11+
- db: <database-name>
12+
name: <role-name>
13+
...
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
:noprevnext:
2+
3+
===========================================
4+
Manage Database Users for X.509 Deployments
5+
===========================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
The |k8s-op-short| supports managing database users for deployments
16+
running with |tls| and X.509 internal cluster authentication enabled.
17+
18+
Prerequisites
19+
-------------
20+
21+
Before managing database users, you must deploy a
22+
:doc:`replica set <deploy-replica-set>` or
23+
:doc:`sharded cluster <deploy-sharded-cluster>` with |tls| and X.509
24+
enabled.
25+
26+
Add a Database User
27+
-------------------
28+
29+
.. include:: /includes/steps/add-database-user.rst
30+
31+
Delete a Database User
32+
----------------------
33+
34+
To delete a database user, pass the ``metadata.name`` from the user
35+
|k8s-configmap| to the following command:
36+
37+
.. code-block:: sh
38+
39+
kubectl delete mdbu <metadata.name>

0 commit comments

Comments
 (0)