Skip to content

Commit ea8618d

Browse files
authored
Update the ssl config for backup (#2610) (#2710)
1 parent 41436f3 commit ea8618d

File tree

2 files changed

+129
-49
lines changed

2 files changed

+129
-49
lines changed

modules/ROOT/pages/backup-restore/online-backup.adoc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,19 +310,32 @@ When using the `neo4j-admin database backup` command, you can configure the back
310310
For more information on how to configure SSL in Neo4j, see xref:security/ssl-framework.adoc[SSL framework].
311311

312312
Configuration for the backup server should be added to the _neo4j.conf_ file and configuration for backup client to the _neo4j-admin.conf_ file.
313-
SSL settings should be set identically between both to ensure compatibility.
313+
The easiest way to ensure compatibility is to use the same SSL policy configuration for both the server and the client.
314+
For production environments, it is recommended to use Certificate Authorities (CAs) to sign certificates rather than self-signed certificates.
315+
316+
314317

315318
The default backup port is 6362, configured with key `server.backup.listen_address`.
316319
The SSL configuration policy has the key of `dbms.ssl.policy.backup`.
317320

318321
As an example, add the following content to your _neo4j.conf_ and _neo4j-admin.conf_ files:
319322

323+
.Server configuration in _neo4j.conf_
324+
[source, properties]
325+
----
326+
dbms.ssl.policy.backup.enabled=true
327+
dbms.ssl.policy.backup.client_auth=REQUIRE
328+
dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3
329+
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
330+
----
331+
332+
.Client configuration in _neo4j-admin.conf_
320333
[source, properties]
321334
----
322335
dbms.ssl.policy.backup.enabled=true
323-
dbms.ssl.policy.backup.tls_versions=TLSv1.2
324-
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
325336
dbms.ssl.policy.backup.client_auth=REQUIRE
337+
dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3
338+
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
326339
----
327340

328341
[TIP]

modules/ROOT/pages/security/ssl-framework.adoc

Lines changed: 113 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ You can identify them by the line `-----BEGIN RSA PRIVATE KEY-----` at the begin
230230
While Neo4j 5.0 can load and use those keys, they are considered deprecated and will be removed in a future version.
231231
====
232232

233-
233+
[[ssl-validate-certs]]
234234
=== Validate the key and the certificate
235235

236236
If you need, you can validate the key file and the certificate as follows:
@@ -267,6 +267,11 @@ The SSL policies are configured by assigning values to parameters of the followi
267267
* `scope` is the name of the communication channel, such as `bolt`, `https`, `cluster`, and `backup`.
268268
* `setting-suffix` can be any of the following:
269269
+
270+
[NOTE]
271+
====
272+
Neo4j does not validate the `setting-suffix` and if it is misspelled or incorrectly set, it will be ignored.
273+
====
274+
+
270275
[options="header"]
271276
|===
272277
| Setting suffix | Description | Default value
@@ -448,7 +453,7 @@ dbms.ssl.policy.bolt.public_certificate=public.crt
448453
+
449454
[TIP]
450455
====
451-
If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory.
456+
If the certificate is located outside of `NEO4J_HOME`, then set the absolute path for the certificates directory.
452457
====
453458

454459
.. Set the Bolt client authentication to `NONE` to disable the mutual authentication:
@@ -676,7 +681,7 @@ dbms.ssl.policy.https.public_certificate=public.crt
676681
+
677682
[TIP]
678683
====
679-
If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory.
684+
If the certificate is located outside of `NEO4J_HOME`, then set the absolute path for the certificates directory.
680685
====
681686

682687
.. Set the HTTPS client authentication to `NONE` to disable the mutual authentication:
@@ -707,23 +712,24 @@ openssl s_client -connect my_domain.com:7473
707712
Intra-cluster encryption is the security solution for the cluster communication.
708713
The Neo4j cluster communicates on 4 ports:
709714

710-
* 5000 - Discovery management
711-
* 6000 - Transactions
712-
* 7000 - Raft communications
713-
* 7688 - Server side routing
715+
* `5000` - Discovery management
716+
* `6000` - Transactions
717+
* `7000` - Raft communications
718+
* `7688` - Server side routing
719+
720+
To configure SSL for intra-cluster communication, create the folder structure and place the key and certificate files under it.
721+
Then, configure the SSL cluster policies in the _neo4j.conf_ file and test that the intra-cluster communication is encrypted.
714722

715-
To set up intra-cluster encryption, on each server create the folder structure and place the key file and the certificates under those.
716-
Then, you need to configure the SSL cluster policies in the _neo4j.conf_ file and test that the intra-cluster communication is encrypted.
723+
==== Set up SSL certificates for intra-cluster communications
717724

718-
. Set up the _cluster_ folder under _certificates_.
719-
.. Create a directory _cluster_ under_<NEO4J_HOME>/certificates_ folder:
725+
. Create a directory _cluster_ under _<NEO4J_HOME>/certificates_ folder:
720726
+
721727
[source, shell]
722728
----
723729
mkdir certificates/cluster
724730
----
725731

726-
.. Create a directory _trusted_ and _revoked_ under _<NEO4J_HOME>/certificates/cluster_ folder:
732+
. Create a directory _trusted_ and _revoked_ under _<NEO4J_HOME>/certificates/cluster_ folder:
727733
+
728734
[source, shell]
729735
----
@@ -756,9 +762,11 @@ Thus, the servers are able to establish trust relationships with each other.
756762
----
757763
cp /path/to/certs/public.crt certificates/cluster/revoked
758764
----
759-
+
765+
766+
==== Verify the folder structure and permissions
767+
760768
The folder structure should look like this with the right file permissions and the groups and ownerships:
761-
+
769+
762770
[options="header", cols="3,1,4*m"]
763771
|===
764772
| Path
@@ -810,21 +818,22 @@ The folder structure should look like this with the right file permissions and t
810818
| 0755
811819
| drwxr-xr-x
812820
|===
813-
+
821+
814822
[TIP]
815823
====
816824
The owner/group should be configured to the user/group that will be running the `neo4j` service.
817825
Default user/group is neo4j/neo4j.
818826
====
819827

820-
. Set the cluster SSL configuration in _neo4j.conf_.
821-
.. Set the cluster SSL policy to `true`:
828+
==== Set the cluster SSL configuration in _neo4j.conf_
829+
830+
. Set the cluster SSL policy to `true`:
822831
+
823832
[source, properties]
824833
----
825834
dbms.ssl.policy.cluster.enabled=true
826835
----
827-
.. Set the appropriate certificates path and the right key and cert files:
836+
. Set the appropriate certificates path and the right key and cert files:
828837
+
829838
[source, properties]
830839
----
@@ -835,10 +844,10 @@ dbms.ssl.policy.cluster.public_certificate=public.crt
835844
+
836845
[TIP]
837846
====
838-
If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory.
847+
If the certificate is located outside of `NEO4J_HOME`, then set the absolute path for the certificates directory.
839848
====
840849

841-
.. Set the cluster client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate:
850+
. Set the cluster client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate:
842851
+
843852
[source, properties]
844853
----
@@ -852,14 +861,16 @@ The actual xref:security/ssl-framework.adoc#term-ssl-cryptographic-objects[crypt
852861
The trusted CA certificate will be shared however.
853862
====
854863

855-
.. Verify that the intra-cluster communication is encrypted.
864+
==== Verify that the intra-cluster communication is encrypted
865+
866+
Once the intra-cluster encryption is enabled, you can verify that the communication is encrypted.
856867
You may use an external tooling, such as Nmap (https://nmap.org/download.html):
857-
+
868+
858869
[source, shell]
859870
----
860871
nmap --script ssl-enum-ciphers -p <port> <hostname>
861872
----
862-
+
873+
863874
[NOTE]
864875
====
865876
The hostname and port have to be adjusted according to your configuration.
@@ -876,24 +887,47 @@ For more details on securing the comunication between the cluster servers, see x
876887
[[ssl-backup-config]]
877888
=== Configure SSL for backup communication
878889

879-
In a single instance, by default the backup communication happens on port `6362`.
880-
In a cluster topology, it is possible to take a backup from any server, and each server has two configurable ports capable of serving a backup.
881-
These ports are configured by `dbms.backup.listen.address` (port `6362`) and `server.cluster.listen_address` (port `6000`) respectively.
882-
If the intra-cluster encryption is enabled and the backup communication is using port `6000`, then your communication channels are already encrypted.
883-
The following steps assumes that your backup is set up on a different port.
890+
In a single instance, the backup communication happens on port `6362` by default. +
891+
In a cluster topology, it is possible to take a backup from any server, and each server has two configurable ports capable of serving a backup:
892+
893+
* `dbms.backup.listen.address` (port `6362`)
894+
* `server.cluster.listen_address` (port `6000`)
895+
896+
If the <<ssl-cluster-config, intra-cluster encryption>> is enabled and the backup communication uses port `6000`, then the communication channels are already encrypted.
897+
898+
However, if your backup communication uses a different port, you need to enable SSL for it by creating a separate SSL policy.
899+
900+
When setting up SSL for backup communication, you can choose between two options for certificates:
901+
902+
* self-signed certificates -- This is typically the case where you control both ends of the connection, and the distribution of certificates can be automated and secured.
903+
However, self-signed certificates do not verify the identity of the server, so they cannot be trusted by clients and are vulnerable to man-in-the-middle attacks.
904+
* certificates signed by a certificate authority (CA) -- more secure option, because a known trusted authority verifies the identity of the server, ensuring authenticity and preventing impersonation.
905+
906+
907+
You can configure SSL for backup communication in one of the following ways:
908+
909+
* Use the same certificates in the _trusted_dir_ on both the backup server and client. +
910+
This approach is simpler to configure but less secure, as both ends share the same identity and trust the same certificate.
911+
912+
* Mirror the certificates on the backup server and client to achieve mutual authentication. +
913+
Add the server certificate to the client's _trusted_dir_ and the client certificate to the server's _trusted_dir_.
914+
This way, the server validates the client's certificate in addition to the typical normal TLS where only the client validates the server's certificate.
915+
916+
* Use a certificate authority (CA) to sign both the client's and server's certificates.
917+
In this case, the _trusted_dir_ must contain only the CA or intermediate certificates.
884918

885-
To set up SSL for backup communication, create the folder structure and place the key file and the certificates under those.
886-
Then, you need to configure the SSL backup policies in the _neo4j.conf_ file.
919+
==== Set up SSL certificates for backup
887920

888-
. Set up the _backup_ folder under _certificates_.
889-
.. Create a directory _backup_ under _<NEO4J_HOME>/certificates_ folder:
921+
Create the folder structure and place the key and certificate files under it.
922+
923+
. Create a directory _backup_ under _<NEO4J_HOME>/certificates_ folder:
890924
+
891925
[source, shell]
892926
----
893927
mkdir certificates/backup
894928
----
895929

896-
.. Create a directory _trusted_ and _revoked_ under _<NEO4J_HOME>/certificates/backup_ folder:
930+
. Create a directory _trusted_ and _revoked_ under _<NEO4J_HOME>/certificates/backup_ folder:
897931
+
898932
[source, shell]
899933
----
@@ -920,9 +954,11 @@ cp /path/to/certs/public.crt certificates/backup/trusted
920954
----
921955
cp /path/to/certs/public.crt certificates/backup/revoked
922956
----
923-
+
924-
The folder structure should look like this with the right file permissions and the groups and ownerships:
925-
+
957+
958+
==== Verify the backup folder structure and permissions
959+
960+
The folder structure should look like this with the right file permissions and the groups and ownerships, assuming the `neo4j` user runs the service:
961+
926962
[options="header", cols="3,1,4*m"]
927963
|===
928964
| Path
@@ -974,21 +1010,23 @@ The folder structure should look like this with the right file permissions and t
9741010
| 0755
9751011
| drwxr-xr-x
9761012
|===
977-
+
1013+
9781014
[TIP]
9791015
====
9801016
The owner/group should be configured to the user/group that will be running the `neo4j` service.
9811017
Default user/group is neo4j/neo4j.
9821018
====
9831019

984-
. Set the backup SSL configuration in _neo4j.conf_.
985-
.. Set the backup SSL policy to `true`:
1020+
[ssl-backup-server-config]
1021+
==== Set the backup SSL configuration in the _neo4j.conf_ file.
1022+
1023+
. Set the backup SSL policy to `true`:
9861024
+
9871025
[source, properties]
9881026
----
9891027
dbms.ssl.policy.backup.enabled=true
9901028
----
991-
.. Set the appropriate certificates path and the right key and cert files:
1029+
. Set the appropriate certificates path and the right key and cert files:
9921030
+
9931031
[source, properties]
9941032
----
@@ -999,16 +1037,45 @@ dbms.ssl.policy.backup.public_certificate=public.crt
9991037
+
10001038
[TIP]
10011039
====
1002-
If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory.
1040+
If the certificate is located outside of `NEO4J_HOME`, then set the absolute path for the certificates directory.
10031041
====
10041042

1005-
.. Set the backup client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate:
1043+
. Set the backup client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate:
10061044
+
10071045
[source, properties]
10081046
----
10091047
dbms.ssl.policy.backup.client_auth=REQUIRE
10101048
----
10111049

1050+
[NOTE]
1051+
====
1052+
Neo4j does not validate the `setting-suffix` and if it is misspelled or incorrect, it will be ignored.
1053+
See <<ssl-configuration, Configuration>> for more details.
1054+
====
1055+
1056+
[ssl-backup-client-config]
1057+
=== Configure the backup client for SSL
1058+
1059+
When using `neo4j-admin backup` command, the backup client needs to be configured to use SSL as well.
1060+
Regardless of which backup port you are targeting (see <<ssl-backup-config>>), the backup client uses the SSL policy specified in `dbms.ssl.policy.backup.*`, given the same SSL policy name matches between server and client.
1061+
1062+
If the backup client is on a different machine from the backup server, you must install SSL certificates and keys on the backup client machine as well, so that the backup client can authenticate the server and vice versa.
1063+
1064+
The following steps assume that you have already set up the SSL certificates and keys on the backup server machine and you are using the self-signed certificates.
1065+
1066+
For example, if you have set up the backup SSL policy described in section <<ssl-backup-config>>, then you need to set the following in the _neo4j-admin.conf_ file on the backup client machine:
1067+
1068+
[source, properties]
1069+
----
1070+
dbms.ssl.policy.backup.enabled=true
1071+
dbms.ssl.policy.backup.base_directory=certificates/backup
1072+
dbms.ssl.policy.backup.private_key=private.key
1073+
dbms.ssl.policy.backup.public_certificate=public.crt
1074+
dbms.ssl.policy.backup.client_auth=REQUIRE
1075+
dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3
1076+
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
1077+
----
1078+
10121079
[[ssl-other-configs]]
10131080
=== Other configurations for SSL
10141081

@@ -1104,25 +1171,25 @@ Note that the use of the following CBC-based ciphers are deprecated from Neo4j 5
11041171
.Bolt
11051172
[source, properties]
11061173
----
1107-
dbms.ssl.policy.bolt.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
1174+
dbms.ssl.policy.bolt.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA3844
11081175
----
11091176

11101177
.HTTPS
11111178
[source, properties]
11121179
----
1113-
dbms.ssl.policy.https.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
1180+
dbms.ssl.policy.https.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA3844
11141181
----
11151182

11161183
.Intra-cluster encryption
11171184
[source, properties]
11181185
----
1119-
dbms.ssl.policy.cluster.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
1186+
dbms.ssl.policy.cluster.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA3844
11201187
----
11211188

11221189
.Backup
11231190
[source, properties]
11241191
----
1125-
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
1192+
dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA3844
11261193
----
11271194

11281195
[[ssl-ocsp-config]]

0 commit comments

Comments
 (0)