Skip to content

Commit f92c786

Browse files
committed
further improvements
1 parent ba22956 commit f92c786

File tree

1 file changed

+66
-73
lines changed

1 file changed

+66
-73
lines changed

modules/ROOT/pages/database-administration/aliases/remote-database-alias-configuration.adoc

Lines changed: 66 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The user needs to be logged in with an identity provider supporting OIDC.
1818
1919
By creating a remote database alias, you define:
2020

21-
* Which user credentials of the remote DBMS can access the remote database alias.
21+
* Which user can access the remote database alias.
2222
* Where the remote database is located.
2323
* How to connect to the remote database using driver settings.
2424
@@ -46,10 +46,9 @@ In this example, _Alice_ is an administrator of *DBMS A*, _Bob_ is an administra
4646
image::remote-alias-overview.svg[title="Overview of the required remote database alias setup when using stored native credentials", role="middle"]
4747

4848
A remote database alias is only accessible to users with appropriate privileges.
49-
In this example, _Bob_ is the administrator responsible for deciding which database (`db1` or `db2`) the remote aliases can write and/or read.
49+
In this example, _Bob_ is the administrator responsible for deciding which database (`db1` or `db2`) the remote alias can write and/or read.
5050
Meanwhile, _Alice_ is the administrator that assigns who has access to the privileges set by _Bob_.
5151
In the example, _Alice_ assigns that access to _Carol_.
52-
5352
See xref:authentication-authorization/dbms-administration/index.adoc[DBMS privileges] for more information.
5453

5554

@@ -77,7 +76,7 @@ CREATE USER alias_user SET PASSWORD 'secretpassword'
7776
----
7877
CREATE ROLE remote_access
7978
----
80-
. Grant the necessary privileges on `db1` to the custom role and assign the role to the user profile created for the remote database alias:
79+
. Grant the `remote_access` role access to `db1` and assign the role to the user profile created for the remote database alias, `alias_user`:
8180
+
8281
[source, Cypher]
8382
----
@@ -103,7 +102,6 @@ dbms.ssl.policy.bolt.client_auth=NONE
103102
server.bolt.tls_level=REQUIRED
104103
----
105104
. Securely transmit the credentials to _Alice_, setting up the link to database `db1`.
106-
It is recommended to create a custom role to track all users shared on a remote connection, so that they remain trackable.
107105

108106
[[remote-alias-config-DBMS_admin-A]]
109107
=== Configure the local DBMS A and grant access to Carol (_Alice_)
@@ -116,7 +114,7 @@ In this example, you create a remote database alias, called `db1-remote-alias`,
116114
==== Generate an encryption key
117115

118116
First, you need to generate an encryption key.
119-
In this case, the credentials of a user of *DBMS B* are reversibly encrypted and stored in the `system` database of *DBMS A*.
117+
In this case, the credentials of the user `alias_user` of *DBMS B* are reversibly encrypted and stored in the `system` database of *DBMS A*.
120118
Since the algorithm used is AES/GCM, you must provide an AES encryption key of length 256 and store it in a password-protected keystore in the PKCS12 format.
121119

122120
The key can be generated by using the following keytool command in your terminal, which is included in link:https://docs.oracle.com/en/java/javase/11/tools/keytool.html[Java Platform, Standard Edition]:
@@ -197,13 +195,13 @@ However, if you want to disable the secure URL scheme, you can set the driver se
197195
CREATE ALIAS `db1-remote-alias` FOR DATABASE `db1` AT "neo4j+s://location:7687" USER alias_user PASSWORD 'secretpassword'
198196
----
199197

200-
. Grant access to the remote database alias to the `remote_access` role and assign it to _Carol_.
198+
. Grant the `remote_access` role access to the remote database alias and assign it to _Carol_.
201199
See xref:authentication-authorization/database-administration.adoc#access-control-database-administration-access[`ACCESS` privileges] for more information.
202200
+
203201
[source, Cypher]
204202
----
205203
GRANT ACCESS ON DATABASE `db1-remote-alias` TO remote_access
206-
GRANT ROLE remote_access TO Carol
204+
GRANT ROLE remote_access TO carol
207205
----
208206

209207
[NOTE]
@@ -251,73 +249,13 @@ Crucially, if the OIDC configuration settings differ between the local DBMS and
251249
This configuration independence can lead to privilege inconsistency (e.g., over-privileging or unexpected access denial).
252250
====
253251

254-
=== Configure the remote DBMS B (_Bob_)
255-
256-
As _Bob_, you are responsible for setting up the remote *DBMS B*.
257-
You can create and delete users and grant or deny privileges on the databases managed by *DBMS B*.
258-
259-
In this example, you need to ensure that _Carol_ can access `db1` on *DBMS B* using OIDC credential forwarding.
260-
261-
. Set up SSO for the identity provider _Carol_ uses and map the identity provider groups to the Neo4j roles as done on the local *DBMS A*.
262-
For details, see the xref:tutorial/tutorial-sso-configuration.adoc[SSO configuration tutorial] and xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
263-
//If you do not want specific users to access `db2`, here is where you set it.
264-
+
265-
[parameters]
266-
----
267-
# OIDC settings - these should be the same on both DBMSs
268-
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
269-
<...>
270-
dbms.security.oidc.<provider>.claims.groups=groups
271-
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
272-
"collaborators" = reader; \
273-
"remote_users" = remote_access
274-
----
275-
276-
. Set up the link:https://neo4j.com/docs/operations-manual/current/security/ssl-framework/[SSL framework] and check whether the database accepts non-local connections if required.
277-
+
278-
[parameters]
279-
----
280-
# accept non-local connections
281-
server.default_listen_address=0.0.0.0
282-
283-
# configure ssl for bolt
284-
dbms.ssl.policy.bolt.enabled=true
285-
dbms.ssl.policy.bolt.base_directory=certificates/bolt
286-
dbms.ssl.policy.bolt.private_key=private.key
287-
dbms.ssl.policy.bolt.public_certificate=public.crt
288-
dbms.ssl.policy.bolt.client_auth=NONE
289-
290-
# enforcing ssl connection
291-
server.bolt.tls_level=REQUIRED
292-
----
293-
294252
=== Configure the local DBMS A and grant access to Carol (_Alice_)
295253

296254
As _Alice_, you are responsible for setting up the local *DBMS A*.
297255
You can create and delete database aliases and grant or deny users' access to them.
298256

299257
In this case, you need to set up a remote database alias that connects to `db1` on *DBMS B* using OIDC credential forwarding and grant _Carol_ access to it.
300258

301-
==== Set up SSO on the local DBMS and map the identity provider groups to the Neo4j roles
302-
303-
In order for _Carol_ to get access to the remote database alias, she needs to be in an identity provider group that is mapped to a Neo4j role that is granted access to that alias.
304-
305-
You set up SSO on the local *DBMS A* and map the identity provider groups to the Neo4j roles that match those on the remote *DBMS B*.
306-
For details on how to map identity provider groups to Neo4j roles, see xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
307-
308-
[parameters]
309-
----
310-
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
311-
<...>
312-
dbms.security.oidc.<provider>.claims.groups=groups
313-
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
314-
"collaborators" = reader; \
315-
"remote_users" = remote_access
316-
----
317-
+
318-
This is where the permission to use the remote database alias is set.
319-
See the xref:tutorial/tutorial-sso-configuration.adoc[SSO configuration tutorial] for more details.
320-
321259
==== Create the remote database alias and grant access to Carol
322260

323261
You create the remote database alias using xref:database-administration/aliases/manage-aliases-standard-databases.adoc[alias administrative commands].
@@ -338,18 +276,17 @@ CREATE ALIAS `db1-remote-alias` FOR DATABASE `db1` AT "neo4j+s://location:7687"
338276
----
339277

340278
. Create a custom role to track all users shared on a remote connection, so that they remain trackable:
341-
See the xref:authentication-authorization/database-administration.adoc#access-control-database-administration-access[`ACCESS` privileges] for more information.
342279
+
343280
[source, Cypher]
344281
----
345282
CREATE ROLE remote_access
346283
----
347-
. Grant access to the remote database alias to the `remote_access` role and assign it to _Carol_.
284+
. Grant the `remote_access` role access to the remote database alias and assign the role to _Carol_:
348285
+
349286
[source, Cypher]
350287
----
351288
GRANT ACCESS ON DATABASE `db1-remote-alias` TO remote_access
352-
GRANT ROLE remote_access TO Carol
289+
GRANT ROLE remote_access TO carol
353290
----
354291
+
355292
[NOTE]
@@ -358,6 +295,62 @@ If a transaction modifies an alias (e.g. changing the database targeted on *DBMS
358295
This prevents issues such as a transaction executing against multiple target databases for the same alias.
359296
====
360297

298+
==== Set up SSO on the local DBMS and map the identity provider groups to the Neo4j roles
299+
300+
In order for _Carol_ to get access to the remote database alias, she needs to be in an identity provider group that is mapped to a Neo4j role that is granted access to that alias.
301+
302+
You set up SSO on the local *DBMS A* and map the identity provider groups to the Neo4j roles.
303+
For details, see the xref:tutorial/tutorial-sso-configuration.adoc[SSO configuration tutorial] and xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
304+
305+
[parameters]
306+
----
307+
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
308+
<...>
309+
dbms.security.oidc.<provider>.claims.groups=groups
310+
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
311+
"collaborators" = reader; \
312+
"remote_users" = remote_access
313+
----
314+
315+
=== Configure the remote DBMS B (_Bob_)
316+
317+
As _Bob_, you are responsible for setting up the remote *DBMS B*.
318+
You can create and delete users and grant or deny privileges on the databases managed by *DBMS B*.
319+
320+
In this example, you need to ensure that _Carol_ can access `db1` on *DBMS B* using OIDC credential forwarding.
321+
322+
. Set up SSO on the remote *DBMS B* and map the identity provider groups to the Neo4j roles.
323+
The configuration must match the one on the local *DBMS A*.
324+
For details, see the xref:tutorial/tutorial-sso-configuration.adoc[SSO configuration tutorial] and xref:authentication-authorization/sso-integration.adoc#auth-sso-map-idp-roles[Map the identity provider groups to the Neo4j roles].
325+
//If you do not want specific users to access `db2`, here is where you set it.
326+
+
327+
[parameters]
328+
----
329+
dbms.security.oidc.<provider>.well_known_discovery_uri=http://example.com/.well-known/discovery
330+
<...>
331+
dbms.security.oidc.<provider>.claims.groups=groups
332+
dbms.security.oidc.<provider>.authorization.group_to_role_mapping= "engineers" = admin; \
333+
"collaborators" = reader; \
334+
"remote_users" = remote_access
335+
----
336+
337+
. Set up the link:https://neo4j.com/docs/operations-manual/current/security/ssl-framework/[SSL framework] and check whether the database accepts non-local connections if required.
338+
+
339+
[parameters]
340+
----
341+
# accept non-local connections
342+
server.default_listen_address=0.0.0.0
343+
344+
# configure ssl for bolt
345+
dbms.ssl.policy.bolt.enabled=true
346+
dbms.ssl.policy.bolt.base_directory=certificates/bolt
347+
dbms.ssl.policy.bolt.private_key=private.key
348+
dbms.ssl.policy.bolt.public_certificate=public.crt
349+
dbms.ssl.policy.bolt.client_auth=NONE
350+
351+
# enforcing ssl connection
352+
server.bolt.tls_level=REQUIRED
353+
----
361354

362355
== Connect to remote database aliases
363356

@@ -372,12 +365,12 @@ USE `db1-remote-alias` MATCH (n) RETURN *
372365
----
373366

374367
* Connecting to a remote database alias as a home database.
375-
This needs to be set by an administrator.
368+
This needs to be set by an administrator, in this case _Alice_.
376369
See xref:authentication-authorization/dbms-administration/dbms-user-management-privileges.adoc[User Management] for more information.
377370
+
378371
[source, Cypher]
379372
----
380-
ALTER USER alice SET HOME DATABASE `db1-remote-alias`
373+
ALTER USER carol SET HOME DATABASE `db1-remote-alias`
381374
----
382375

383376
== Important notes

0 commit comments

Comments
 (0)