From 0e1a85533435a725a6d86da0336fa297b0384f01 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 18 Sep 2025 17:11:42 +0100 Subject: [PATCH 1/5] update the ssl config for backup --- .../pages/backup-restore/online-backup.adoc | 31 +++++++++++++++++-- .../ROOT/pages/security/ssl-framework.adoc | 4 +-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/modules/ROOT/pages/backup-restore/online-backup.adoc b/modules/ROOT/pages/backup-restore/online-backup.adoc index 995d65cc7..1754962cf 100644 --- a/modules/ROOT/pages/backup-restore/online-backup.adoc +++ b/modules/ROOT/pages/backup-restore/online-backup.adoc @@ -317,12 +317,39 @@ The SSL configuration policy has the key of `dbms.ssl.policy.backup`. As an example, add the following content to your _neo4j.conf_ and _neo4j-admin.conf_ files: +.Server configuration in _neo4j.conf_ [source, properties] ---- +server.backup.listen_address=0.0.0.0:6362 dbms.ssl.policy.backup.enabled=true -dbms.ssl.policy.backup.tls_versions=TLSv1.2 -dbms.ssl.policy.backup.ciphers=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 +dbms.ssl.policy.backup.base_directory=certificates/backup +dbms.ssl.policy.backup.private_key=private.key +dbms.ssl.policy.backup.public_certificate=public.crt dbms.ssl.policy.backup.client_auth=REQUIRE +dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 +# dbms.ssl.policy.backup.tls_versions=TLSv1.2 +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 +# dbms.ssl.policy.backup.ciphers=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 +# 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 +# dbms.netty.ssl.provider=OPENSSL +dbms.netty.ssl.provider=JDK +---- + +.Client configuration in _neo4j-admin.conf_ +[source, properties] +---- +# Enable SSL backup +dbms.ssl.policy.backup.enabled=true +# dbms.ssl.policy.backup.base_directory=certificates/backup +dbms.ssl.policy.backup.private_key=/path/to/certificates/backup/private.key +dbms.ssl.policy.backup.public_certificate=/path/to/certificates/backup/public.crt +dbms.ssl.policy.backup.client_auth=REQUIRE +dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 +# dbms.ssl.policy.backup.tls_versions=TLSv1.2 +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 +# dbms.netty.ssl.provider=OPENSSL +dbms.netty.ssl.provider=JDK +server.jvm.additional=-Djavax.net.ssl.trustStore=/path/to/certificates/backup/trusted/ ---- [TIP] diff --git a/modules/ROOT/pages/security/ssl-framework.adoc b/modules/ROOT/pages/security/ssl-framework.adoc index ffd78dddb..b54f48a4f 100644 --- a/modules/ROOT/pages/security/ssl-framework.adoc +++ b/modules/ROOT/pages/security/ssl-framework.adoc @@ -928,7 +928,7 @@ The owner/group should be configured to the user/group that will be running the Default user/group is neo4j/neo4j. ==== -. Set the backup SSL configuration in _neo4j.conf_. +. Set the backup SSL configuration in both _neo4j.conf_ and _neo4j-admin.conf_. .. Set the backup SSL policy to `true`: + [source, properties] @@ -1162,7 +1162,7 @@ This means that while new connections will use new certificates, the existing co Even if a certificate expires, active connections remain unaffected because the certificates are only used during the initial connection handshake. . Verify that the intra-cluster communication is still encrypted using external tooling, such as Nmap, described in <>. - + [[ssl-terminology]] == Terminology From 4c4dcf6c8d266115ac878aa6cf0f07865185ac8a Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 24 Sep 2025 17:24:23 +0100 Subject: [PATCH 2/5] apply suggestions from review --- .../pages/backup-restore/online-backup.adoc | 19 --------------- .../ROOT/pages/security/ssl-framework.adoc | 23 ++++++++++++++++++- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/modules/ROOT/pages/backup-restore/online-backup.adoc b/modules/ROOT/pages/backup-restore/online-backup.adoc index 1754962cf..1cad0379e 100644 --- a/modules/ROOT/pages/backup-restore/online-backup.adoc +++ b/modules/ROOT/pages/backup-restore/online-backup.adoc @@ -320,36 +320,17 @@ As an example, add the following content to your _neo4j.conf_ and _neo4j-admin.c .Server configuration in _neo4j.conf_ [source, properties] ---- -server.backup.listen_address=0.0.0.0:6362 -dbms.ssl.policy.backup.enabled=true -dbms.ssl.policy.backup.base_directory=certificates/backup -dbms.ssl.policy.backup.private_key=private.key -dbms.ssl.policy.backup.public_certificate=public.crt dbms.ssl.policy.backup.client_auth=REQUIRE dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 -# dbms.ssl.policy.backup.tls_versions=TLSv1.2 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 -# dbms.ssl.policy.backup.ciphers=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 -# 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 -# dbms.netty.ssl.provider=OPENSSL -dbms.netty.ssl.provider=JDK ---- .Client configuration in _neo4j-admin.conf_ [source, properties] ---- -# Enable SSL backup -dbms.ssl.policy.backup.enabled=true -# dbms.ssl.policy.backup.base_directory=certificates/backup -dbms.ssl.policy.backup.private_key=/path/to/certificates/backup/private.key -dbms.ssl.policy.backup.public_certificate=/path/to/certificates/backup/public.crt dbms.ssl.policy.backup.client_auth=REQUIRE dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 -# dbms.ssl.policy.backup.tls_versions=TLSv1.2 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 -# dbms.netty.ssl.provider=OPENSSL -dbms.netty.ssl.provider=JDK -server.jvm.additional=-Djavax.net.ssl.trustStore=/path/to/certificates/backup/trusted/ ---- [TIP] diff --git a/modules/ROOT/pages/security/ssl-framework.adoc b/modules/ROOT/pages/security/ssl-framework.adoc index b54f48a4f..9542ce04e 100644 --- a/modules/ROOT/pages/security/ssl-framework.adoc +++ b/modules/ROOT/pages/security/ssl-framework.adoc @@ -928,7 +928,7 @@ The owner/group should be configured to the user/group that will be running the Default user/group is neo4j/neo4j. ==== -. Set the backup SSL configuration in both _neo4j.conf_ and _neo4j-admin.conf_. +. Set the backup SSL configuration in the _neo4j.conf_ file. .. Set the backup SSL policy to `true`: + [source, properties] @@ -956,6 +956,27 @@ If the certificate is a different path outside of NEO4J_HOME, then set the absol dbms.ssl.policy.backup.client_auth=REQUIRE ---- +=== Configure the backup client for SSL + +When using `neo4j-admin backup` command, you need to specify the SSL policy to be used by the backup client. +You can do this by setting a matching SSL configuration in the _neo4j.conf_ and _neo4j-admin.conf_ files. +This is crucial for the backup to work properly. +For example, if you have set up the backup SSL policy described in section <>, then you need to set the following in the _neo4j-admin.conf_ file: + +[source, properties] +---- +dbms.ssl.policy.backup.enabled=true +dbms.ssl.policy.backup.base_directory=/path/to/certificates/backup +dbms.ssl.policy.backup.private_key=private.key +dbms.ssl.policy.backup.public_certificate=public.crt +dbms.ssl.policy.backup.client_auth=REQUIRE +---- + +[NOTE] +==== +Keep in mind that if you are a backup client on a different machine from the Neo4j server, you must also ensure that equivalent SSL certs are installed in both places. +==== + [[ssl-other-configs]] === Other configurations for SSL From b30d560f8580489e7cdd47a1d5f8ddd609ed66c4 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 24 Sep 2025 17:26:45 +0100 Subject: [PATCH 3/5] update the note --- modules/ROOT/pages/security/ssl-framework.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/security/ssl-framework.adoc b/modules/ROOT/pages/security/ssl-framework.adoc index 9542ce04e..88ed4c1a4 100644 --- a/modules/ROOT/pages/security/ssl-framework.adoc +++ b/modules/ROOT/pages/security/ssl-framework.adoc @@ -974,7 +974,7 @@ dbms.ssl.policy.backup.client_auth=REQUIRE [NOTE] ==== -Keep in mind that if you are a backup client on a different machine from the Neo4j server, you must also ensure that equivalent SSL certs are installed in both places. +Keep in mind that if the backup client is on a different machine from the Neo4j server, you must install the same SSL certs and keys on the backup client machine as well, so that the backup client can authenticate the server and vice versa. ==== [[ssl-other-configs]] From b0997cdd69e0d189a131e2add80c0b2f87e049d1 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 25 Sep 2025 11:34:13 +0100 Subject: [PATCH 4/5] apply suggestions from review --- modules/ROOT/pages/backup-restore/online-backup.adoc | 2 ++ modules/ROOT/pages/security/ssl-framework.adoc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/ROOT/pages/backup-restore/online-backup.adoc b/modules/ROOT/pages/backup-restore/online-backup.adoc index 1cad0379e..ee1057606 100644 --- a/modules/ROOT/pages/backup-restore/online-backup.adoc +++ b/modules/ROOT/pages/backup-restore/online-backup.adoc @@ -320,6 +320,7 @@ As an example, add the following content to your _neo4j.conf_ and _neo4j-admin.c .Server configuration in _neo4j.conf_ [source, properties] ---- +dbms.ssl.policy.backup.enabled=true dbms.ssl.policy.backup.client_auth=REQUIRE dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 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 @@ -328,6 +329,7 @@ dbms.ssl.policy.backup.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE .Client configuration in _neo4j-admin.conf_ [source, properties] ---- +dbms.ssl.policy.backup.enabled=true dbms.ssl.policy.backup.client_auth=REQUIRE dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 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 diff --git a/modules/ROOT/pages/security/ssl-framework.adoc b/modules/ROOT/pages/security/ssl-framework.adoc index 88ed4c1a4..d3d311291 100644 --- a/modules/ROOT/pages/security/ssl-framework.adoc +++ b/modules/ROOT/pages/security/ssl-framework.adoc @@ -970,6 +970,8 @@ dbms.ssl.policy.backup.base_directory=/path/to/certificates/backup dbms.ssl.policy.backup.private_key=private.key dbms.ssl.policy.backup.public_certificate=public.crt dbms.ssl.policy.backup.client_auth=REQUIRE +dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 +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 ---- [NOTE] From a868e7b96e04c44d0b4286fd1e5b4b5ad6b3868e Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Mon, 29 Sep 2025 14:10:07 +0100 Subject: [PATCH 5/5] apply suggestions from review --- .../ROOT/pages/security/ssl-framework.adoc | 113 +++++++++++------- 1 file changed, 67 insertions(+), 46 deletions(-) diff --git a/modules/ROOT/pages/security/ssl-framework.adoc b/modules/ROOT/pages/security/ssl-framework.adoc index d3d311291..944cae015 100644 --- a/modules/ROOT/pages/security/ssl-framework.adoc +++ b/modules/ROOT/pages/security/ssl-framework.adoc @@ -180,7 +180,7 @@ You can identify them by the line `-----BEGIN RSA PRIVATE KEY-----` at the begin While Neo4j 5.0 can load and use those keys, they are considered deprecated and will be removed in a future version. ==== - +[[ssl-validate-certs]] === Validate the key and the certificate If you need, you can validate the key file and the certificate as follows: @@ -655,22 +655,23 @@ openssl s_client -connect my_domain.com:7473 Intra-cluster encryption is the security solution for the cluster communication. The Neo4j cluster communicates on 3 ports: -* 6000 - Transactions -* 7000 - Raft communications -* 7688 - Server side routing +* `6000` - Transactions +* `7000` - Raft communications +* `7688` - Server side routing + +To configure SSL for intra-cluster communication, create the folder structure and place the key and certificate files under it. +Then, configure the SSL cluster policies in the _neo4j.conf_ file and test that the intra-cluster communication is encrypted. -To set up intra-cluster encryption, on each server create the folder structure and place the key file and the certificates under those. -Then, you need to configure the SSL cluster policies in the _neo4j.conf_ file and test that the intra-cluster communication is encrypted. +==== Set up SSL certificates for intra-cluster communications -. Set up the _cluster_ folder under _certificates_. -.. Create a directory _cluster_ under_/certificates_ folder: +. Create a directory _cluster_ under _/certificates_ folder: + [source, shell] ---- mkdir certificates/cluster ---- -.. Create a directory _trusted_ and _revoked_ under _/certificates/cluster_ folder: +. Create a directory _trusted_ and _revoked_ under _/certificates/cluster_ folder: + [source, shell] ---- @@ -703,9 +704,11 @@ Thus, the servers are able to establish trust relationships with each other. ---- cp /path/to/certs/public.crt certificates/cluster/revoked ---- -+ + +==== Verify the folder structure and permissions + The folder structure should look like this with the right file permissions and the groups and ownerships: -+ + [options="header", cols="3,1,4*m"] |=== | Path @@ -757,21 +760,22 @@ The folder structure should look like this with the right file permissions and t | 0755 | drwxr-xr-x |=== -+ + [TIP] ==== The owner/group should be configured to the user/group that will be running the `neo4j` service. Default user/group is neo4j/neo4j. ==== -. Set the cluster SSL configuration in _neo4j.conf_. -.. Set the cluster SSL policy to `true`: +==== Set the cluster SSL configuration in _neo4j.conf_ + +. Set the cluster SSL policy to `true`: + [source, properties] ---- dbms.ssl.policy.cluster.enabled=true ---- -.. Set the appropriate certificates path and the right key and cert files: +. Set the appropriate certificates path and the right key and cert files: + [source, properties] ---- @@ -785,7 +789,7 @@ dbms.ssl.policy.cluster.public_certificate=public.crt If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory. ==== -.. Set the cluster client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate: +. Set the cluster client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate: + [source, properties] ---- @@ -799,14 +803,16 @@ The actual xref:security/ssl-framework.adoc#term-ssl-cryptographic-objects[crypt The trusted CA certificate will be shared however. ==== -.. Verify that the intra-cluster communication is encrypted. +==== Verify that the intra-cluster communication is encrypted + +Once the intra-cluster encryption is enabled, you can verify that the communication is encrypted. You may use an external tooling, such as Nmap (https://nmap.org/download.html): -+ + [source, shell] ---- nmap --script ssl-enum-ciphers -p ---- -+ + [NOTE] ==== The hostname and port have to be adjusted according to your configuration. @@ -823,24 +829,28 @@ For more details on securing the comunication between the cluster servers, see x [[ssl-backup-config]] === Configure SSL for backup communication -In a single instance, by default the backup communication happens on port `6362`. -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. -These ports are configured by `dbms.backup.listen.address` (port `6362`) and `server.cluster.listen_address` (port `6000`) respectively. -If the intra-cluster encryption is enabled and the backup communication is using port `6000`, then your communication channels are already encrypted. -The following steps assumes that your backup is set up on a different port. +In a single instance, the backup communication happens on port `6362` by default. + +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: -To set up SSL for backup communication, create the folder structure and place the key file and the certificates under those. -Then, you need to configure the SSL backup policies in the _neo4j.conf_ file. +* `dbms.backup.listen.address` (port `6362`) +* `server.cluster.listen_address` (port `6000`) -. Set up the _backup_ folder under _certificates_. -.. Create a directory _backup_ under _/certificates_ folder: +If the <> is enabled and the backup communication uses port `6000`, then the communication channels are already encrypted. +The following steps assume that your backup is set up on a different port. + +==== Set up SSL certificates for backup + +Create the folder structure and place the key and certificate files under it. +Then, configure the SSL backup policies in the _neo4j.conf_ file. + +. Create a directory _backup_ under _/certificates_ folder: + [source, shell] ---- mkdir certificates/backup ---- -.. Create a directory _trusted_ and _revoked_ under _/certificates/backup_ folder: +. Create a directory _trusted_ and _revoked_ under _/certificates/backup_ folder: + [source, shell] ---- @@ -867,9 +877,11 @@ cp /path/to/certs/public.crt certificates/backup/trusted ---- cp /path/to/certs/public.crt certificates/backup/revoked ---- -+ -The folder structure should look like this with the right file permissions and the groups and ownerships: -+ + +==== Verify the backup folder structure and permissions + +The folder structure should look like this with the right file permissions and the groups and ownerships, assuming the `neo4j` user runs the service: + [options="header", cols="3,1,4*m"] |=== | Path @@ -921,21 +933,22 @@ The folder structure should look like this with the right file permissions and t | 0755 | drwxr-xr-x |=== -+ + [TIP] ==== The owner/group should be configured to the user/group that will be running the `neo4j` service. Default user/group is neo4j/neo4j. ==== -. Set the backup SSL configuration in the _neo4j.conf_ file. -.. Set the backup SSL policy to `true`: +==== Set the backup SSL configuration in the _neo4j.conf_ file. + +. Set the backup SSL policy to `true`: + [source, properties] ---- dbms.ssl.policy.backup.enabled=true ---- -.. Set the appropriate certificates path and the right key and cert files: +. Set the appropriate certificates path and the right key and cert files: + [source, properties] ---- @@ -949,7 +962,7 @@ dbms.ssl.policy.backup.public_certificate=public.crt If the certificate is a different path outside of NEO4J_HOME, then set the absolute path for the certificates directory. ==== -.. Set the backup client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate: +. Set the backup client authentication to `REQUIRE` to enable the mutual authentication, which means that both ends of a channel have to authenticate: + [source, properties] ---- @@ -958,15 +971,28 @@ dbms.ssl.policy.backup.client_auth=REQUIRE === Configure the backup client for SSL -When using `neo4j-admin backup` command, you need to specify the SSL policy to be used by the backup client. -You can do this by setting a matching SSL configuration in the _neo4j.conf_ and _neo4j-admin.conf_ files. -This is crucial for the backup to work properly. +When using `neo4j-admin backup` command, the backup client needs to be configured to use SSL as well. +Regardless of which backup port you are targeting (see <>), the backup client uses the SSL policy specified in `dbms.ssl.policy.backup.*`, given the same SSL policy name matches between server and client. + +[NOTE] +==== +If the backup client is on a different machine from the Neo4j server, you must install sympathetic SSL certificates and keys on the backup client machine as well, so that the backup client can authenticate the server and vice versa. +If you want mutual TLS with self-signed certificates, the server must have the client's certificate in its _trusted_dir_, and the client must have the server's certificate in its _trusted_dir_. +If you use a certificate authority (CA) to signs both the client's and server's certificates, the _trusted_dir_ must contain only the CA or intermediate certificates. + +Furthermore, Neo4j does not validate the certificates. +It is your responsibility to ensure that the certificates are valid. +See <> for details. +==== + +Configure the SSL backup policies in the _neo4j-admin.conf_ file on the backup client machine. + For example, if you have set up the backup SSL policy described in section <>, then you need to set the following in the _neo4j-admin.conf_ file: [source, properties] ---- dbms.ssl.policy.backup.enabled=true -dbms.ssl.policy.backup.base_directory=/path/to/certificates/backup +dbms.ssl.policy.backup.base_directory=certificates/backup dbms.ssl.policy.backup.private_key=private.key dbms.ssl.policy.backup.public_certificate=public.crt dbms.ssl.policy.backup.client_auth=REQUIRE @@ -974,11 +1000,6 @@ dbms.ssl.policy.backup.tls_versions=TLSv1.2,TLSv1.3 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 ---- -[NOTE] -==== -Keep in mind that if the backup client is on a different machine from the Neo4j server, you must install the same SSL certs and keys on the backup client machine as well, so that the backup client can authenticate the server and vice versa. -==== - [[ssl-other-configs]] === Other configurations for SSL