Skip to content

Commit df4e05a

Browse files
(DOCSP-11364)(DOCSP-11343): atlas dbuser certs create | list (#175)
* (DOCSP-11364)(DOCSP-11343): atlas dbuser certs create | list * (DOCSP-11364)(DOCSP-11343): tech review feedback
1 parent a6e909d commit df4e05a

File tree

5 files changed

+300
-0
lines changed

5 files changed

+300
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:widths: 30 70
4+
5+
* - Field
6+
- Description
7+
8+
* - ``certificate``
9+
- The PEM-encoded X.509 certificate that |service| created for the
10+
user.
11+
12+
* - ``monthsUntilExpiration``
13+
- Months until the X.509 certificate expires. Maximum value is
14+
``24``. Defaults to ``3``.
15+
16+
* - ``username``
17+
- Username for whom |service| generated the x.509 certificate.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:widths: 30 70
4+
5+
* - Field
6+
- Description
7+
8+
* - ``id``
9+
- Serial number of the certificate.
10+
11+
* - ``createdAt``
12+
- |iso8601-time| when |service| created this X.509 certificate.
13+
14+
* - ``groupId``
15+
- Unique identifier of the |service| project to which this
16+
certificate belongs.
17+
18+
* - ``notAfter``
19+
- |iso8601-time| when this certificate expires.
20+
21+
* - ``subject``
22+
- Full distinguished name of the database user to which this
23+
certificate belongs. To learn more, see
24+
`RFC 2253 <https://tools.ietf.org/html/rfc2253>`_.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
.. _mcli-atlas-dbuser-certs-create-command:
2+
3+
==================================
4+
mongocli atlas dbuser certs create
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 ``dbuser certs create`` command creates an |service|\-managed X.509
16+
certificate for the specified MongoDB database user who authenticates
17+
using X.509 certificates. You can also create an |service|\-managed
18+
X.509 certificate for a MongoDB database user through the |service|
19+
:atlas:`UI </security-add-mongodb-users/>` or
20+
:atlas:`API </reference/api/x509-configuration-create-certificate/>`.
21+
22+
.. important::
23+
24+
You cannot use the ``dbuser certs create`` command to list certificates
25+
for MongoDB database users if
26+
27+
- You are managing your own Certificate Authority (CA) in
28+
:atlas:`Self-Managed X.509 mode
29+
</security-self-managed-x509/#self-managed-x509>`. You must
30+
generate certificates for database users using your own CA.
31+
- The user you specify does not authenticate using X.509
32+
certificates.
33+
34+
.. _dbuser-certs-create-syntax:
35+
36+
Syntax
37+
------
38+
39+
.. code-block:: text
40+
41+
mongocli atlas dbuser certs create
42+
[ --monthsUntilExpiration <number of months until certificate expires> ]
43+
[ --profile|-P <profile-name> ]
44+
[ --projectId <project-ID> ]
45+
--username <name-of-user>
46+
47+
.. include:: /includes/fact-command-line-help.rst
48+
49+
.. _dbuser-certs-create-options:
50+
51+
Options
52+
-------
53+
54+
.. list-table::
55+
:header-rows: 1
56+
:widths: 29 8 55 7
57+
58+
* - Option
59+
- Type
60+
- Description
61+
- Required?
62+
63+
* - ``--monthsUntilExpiration``
64+
- integer
65+
- Months until the X.509 certificate expires. Maximum value is
66+
``24``. Defaults to ``3``.
67+
- no
68+
69+
* - ``--profile``, ``-P``
70+
- string
71+
- Name of the profile where the public and private
72+
keys for the project are saved. If omitted, uses the
73+
{+default-profile+}. To learn more about creating a
74+
profile, see :ref:`mcli-configure`.
75+
- no
76+
77+
* - ``--projectId``
78+
- string
79+
- Unique identifier of the project that contains the MongoDB
80+
database user. If omitted, uses the project ID in the profile or
81+
:ref:`environment variable <mcli-env-var>`.
82+
- no
83+
84+
* - ``--username``
85+
- string
86+
- Username for whom you want to create a X.509 certificate.
87+
- yes
88+
89+
.. _dbuser-certs-create-command-output:
90+
91+
Output
92+
------
93+
.. include:: /includes/command-output-intro.rst
94+
95+
.. include:: /includes/atlas-dbuser-certs-create-output-fields.rst
96+
97+
.. _dbuser-certs-create-examples:
98+
99+
Example
100+
--------
101+
102+
The following example uses the ``mongocli atlas dbuser certs create``
103+
command to create an |service|\-managed X.509 certificate for a MongoDB
104+
database user ``dbuser``. It uses the {+default-profile+} to access
105+
|service| and generate the X.509 certificate.
106+
107+
.. code-block:: sh
108+
:copyable: false
109+
110+
mongocli atlas dbuser certs create --username dbuser --monthsUntilExpiration 3 --projectId 5e2211c17a3e5a48f5497de3
111+
112+
The previous command prints the following fields
113+
to the terminal. To learn more about these fields, see
114+
:ref:`Output <dbuser-certs-create-command-output>`.
115+
116+
.. code-block:: json
117+
:copyable: false
118+
119+
{
120+
"username": "dbuser",
121+
"monthsUntilExpiration": 3,
122+
"certificate": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
123+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
.. _mcli-atlas-dbuser-certs-list-command:
2+
3+
================================
4+
mongocli atlas dbuser certs list
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 ``dbuser certs list`` command retrieves the list of unexpired
16+
|service|\-managed X.509 certificates for the specified MongoDB database
17+
user who authenticates using X.509 certificates. You can also list the
18+
|service|\-managed X.509 certificates for a MongoDB database user
19+
through the |service| :atlas:`UI </security-add-mongodb-users/>` or
20+
:atlas:`API </reference/api/x509-configuration-get-certificates/>`.
21+
22+
.. important::
23+
24+
You cannot use the ``dbuser certs list`` command to list certificates
25+
for MongoDB database users if:
26+
27+
- You are managing your own Certificate Authority (CA) in
28+
:atlas:`Self-Managed X.509 mode
29+
</security-self-managed-x509/#self-managed-x509>`, or
30+
- The user you specify does not authenticate using X.509
31+
certificates.
32+
33+
.. _dbuser-certs-list-syntax:
34+
35+
Syntax
36+
------
37+
38+
.. code-block:: text
39+
40+
mongocli atlas dbuser certs list|ls <username>
41+
[ --profile|-P <profile-name> ]
42+
[ --projectId <project-ID> ]
43+
44+
.. include:: /includes/fact-command-line-help.rst
45+
46+
.. _dbuser-certs-list-options:
47+
48+
Options
49+
-------
50+
51+
.. list-table::
52+
:header-rows: 1
53+
:widths: 20 10 60 10
54+
55+
* - Option
56+
- Type
57+
- Description
58+
- Required?
59+
60+
* - ``--profile``, ``-P``
61+
- string
62+
- Name of the profile where the public and private
63+
keys for the project are saved. If omitted, uses the
64+
{+default-profile+}. To learn more about creating a
65+
profile, see :ref:`mcli-configure`.
66+
- no
67+
68+
* - ``--projectId``
69+
- string
70+
- Unique identifier of the project that contains the MongoDB
71+
database user. If omitted, uses the project ID in the profile or
72+
:ref:`environment variable <mcli-env-var>`.
73+
- no
74+
75+
* - ``<username>``
76+
- string
77+
- Username for whom you want to list |service|\-managed X.509
78+
certificates.
79+
- yes
80+
81+
.. _dbuser-certs-list-command-output:
82+
83+
Output
84+
------
85+
.. include:: /includes/command-output-intro.rst
86+
87+
.. include:: /includes/atlas-dbuser-certs-list-output-fields.rst
88+
89+
.. _dbuser-certs-list-examples:
90+
91+
Example
92+
--------
93+
94+
The following example uses the ``mongocli atlas dbuser certs list``
95+
command to retrieve the list of unexpired |service|\-managed X.509
96+
certificates for the MongoDB database user ``dbuser``. It uses the
97+
{+default-profile+} to access |service| and retrieve the list of X.509
98+
certificates.
99+
100+
.. code-block:: sh
101+
:copyable: false
102+
103+
mongocli atlas dbuser certs list dbuser --projectId 5e2211c17a3e5a48f5497de3
104+
105+
The previous command prints the following fields
106+
to the terminal. To learn more about these fields, see
107+
:ref:`Output <dbuser-certs-list-command-output>`.
108+
109+
.. code-block:: json
110+
:copyable: false
111+
112+
[
113+
{
114+
"_id": 7410558049103803930,
115+
"createdAt": "2020-08-04T14:52:31Z",
116+
"groupId": "5e2211c17a3e5a48f5497de3",
117+
"notAfter": "2020-11-04T15:52:31Z",
118+
"subject": "CN=dbuser"
119+
},
120+
{
121+
"_id": 3226318451840077148,
122+
"createdAt": "2020-08-04T14:53:35Z",
123+
"groupId": "5e2211c17a3e5a48f5497de3",
124+
"notAfter": "2020-11-04T15:53:35Z",
125+
"subject": "CN=dbuser"
126+
},
127+
{
128+
"_id": 8138860319637071322,
129+
"createdAt": "2020-08-04T16:55:06Z",
130+
"groupId": "5e2211c17a3e5a48f5497de3",
131+
"notAfter": "2020-11-04T17:55:06Z",
132+
"subject": "CN=dbuser"
133+
}
134+
]

source/reference/atlas/dbuser-commands.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ Atlas ``dbuser`` Commands
1414
Create a Database User </reference/atlas/dbuser-create>
1515
Modify a Database User </reference/atlas/dbuser-update>
1616
Delete a Database User </reference/atlas/dbuser-delete>
17+
List |service|\-Managed X.509 Certificates Created for a Database User </reference/atlas/dbuser-certs-list>
18+
Create an |service|\-Managed X.509 Certificate for a Database User </reference/atlas/dbuser-certs-create>

0 commit comments

Comments
 (0)