Configuring HugeGraphServer to Use HTTPS Protocol
Overview
By default, HugeGraphServer uses the HTTP protocol. However, if you have security requirements for your requests, you can configure it to use HTTPS.
Server Configuration
Modify the conf/rest-server.properties configuration file and change the schema part of restserver.url to https.
The keystore file is not shipped inside the distribution, because it carries no license declaration. When restserver.url
starts with https and conf/hugegraph-server.keystore is missing, bin/start-hugegraph.sh downloads it from the
binary-1.5 branch of the hugegraph-doc repository before starting the server. The password of that file is hugegraph.
Both values are the defaults of ssl.keystore_file and ssl.keystore_password; users can generate their own keystore
file and password and then change the two options.
Client Configuration
Using HTTPS in HugeGraph-Client
When constructing a HugeClient, pass the HTTPS-related configurations. Here’s an example in Java:
Note: Before version 1.9.0, HugeGraph-Client was created directly using the
newkeyword and did not support the HTTPS protocol. Starting from version 1.9.0, it changed to use the builder pattern and supports configuring the HTTPS protocol.
Using HTTPS in HugeGraph-Loader
When starting an import task, add the following options in the command line:
Under the conf directory of hugegraph-loader, there is already a default client certificate file named hugegraph.truststore, and its password is hugegraph.
Using HTTPS in HugeGraph-Tools
When executing commands, add the following options in the command line:
Under the conf directory of hugegraph-tools, there is already a default client certificate file named hugegraph.truststore, and its password is hugegraph.
How to Generate Certificate Files
This section provides an example of generating certificates. If the default certificate is sufficient or if you already know how to generate certificates, you can skip this section.
Server
- Generate the server’s private key and import it into the server’s keystore file. The
server.keystoreis for the server’s use and contains its private key.
During the process, fill in the description information according to your requirements. The description information for the default certificate is as follows:
- Export the server certificate based on the server’s private key.
server.crt is the server’s certificate.
Client
client.truststore is for the client’s use and contains the trusted certificate.