incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

huge server支持https吗,如何配置或者。。。

Open dyhyao6 opened this issue 6 years ago • 7 comments

Expected behavior 期望表现

{type something here...} 企业微信截图_20201029105048

Actual behavior 实际表现

{type something here...}

Steps to reproduce the problem 复现步骤

  1. {step 1}
  2. {step 2}
  3. {step 3}

Status of loaded data 数据状态

Vertex/Edge summary 数据量

  • loaded vertices amount: {like 10 million}
  • loaded edges amount: {like 20 million}
  • loaded time: {like 200s}

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

  • hugegraph version: {like v0.7.4}
  • operating system: {like centos 7.4, 32 CPUs, 64G RAM}
  • hugegraph backend: {like cassandra 3.10, cluster with 20 nodes, 3 x 1TB HDD disk each node}

dyhyao6 avatar Oct 29 '20 02:10 dyhyao6

@dyhyao6 从v0.11.2版开始支持https,使用方法请 @shzcore 说明一下。

javeme avatar Oct 29 '20 13:10 javeme

@dyhyao6 从v0.11.2版开始支持https,使用方法请 @shzcore 说明一下。

好的,谢谢。烦请 @shzcore 说明

dyhyao6 avatar Oct 30 '20 01:10 dyhyao6

@dyhyao6

服务端配置: hugegraph-server配置

在conf/rest-server.properties配置文件中设置启用https,默认是http server.protocol=https # http 或者 https 默认https ssl.server_keystore_file=server.keystore # 服务端证书文件 ssl.server_keystore_password=changeit # 服务端证书文件密码

客户端配置 hugegraph-loader配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

hugegraph-tools配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

服务端没有对客户端证书内容做强制校验,证书可以自行生成

shzcore avatar Nov 03 '20 01:11 shzcore

@dyhyao6

服务端配置: hugegraph-server配置

在conf/rest-server.properties配置文件中设置启用https,默认是http server.protocol=https # http 或者 https 默认https ssl.server_keystore_file=server.keystore # 服务端证书文件 ssl.server_keystore_password=changeit # 服务端证书文件密码

客户端配置 hugegraph-loader配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

hugegraph-tools配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

服务端没有对客户端证书内容做强制校验,证书可以自行生成

thanks

dyhyao6 avatar Nov 03 '20 02:11 dyhyao6

@dyhyao6

服务端配置: hugegraph-server配置

在conf/rest-server.properties配置文件中设置启用https,默认是http server.protocol=https # http 或者 https 默认https ssl.server_keystore_file=server.keystore # 服务端证书文件 ssl.server_keystore_password=changeit # 服务端证书文件密码

客户端配置 hugegraph-loader配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

hugegraph-tools配置

--protocol=https # http 或者https --trust-store-file # 客户端证书 --trust-store-password # 客户端证书密码

服务端没有对客户端证书内容做强制校验,证书可以自行生成

启用https是不是得生成证书呀?如何生成。

dyhyao6 avatar Nov 11 '20 01:11 dyhyao6

服务端配置:

在conf/rest-server.properties配置文件中设置启用https,默认是http
server.protocol=https # http 或者 https  默认https
ssl.server_keystore_file=server.keystore # 服务端证书文件
ssl.server_keystore_password=changeit # 服务端证书文件密码

服务端证书文件生成示例代码:

public class KeyStoreCreate {
    private static final String alias = "hugegraph";
    private static final String city = "beijing";
    private static final String commonName = "hugegraph.github.io";
    private static final String country = "beijing";
    private static final String filePath = "cert/server.keystore";
    private static final char[] keyPassword = "123456".toCharArray();
    private static final int keysize = 1024;
    private static final String organization = "hugegraph";
    private static final String organizationalUnit = "IT";
    private static final String state = "beijing";
    private static final long validity = 1096;

    public static void main(String[] args) throws GeneralSecurityException {
        try {

            KeyStore ks = KeyStore.getInstance("pkcs12");
            ks.load(null, null);

            CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null);
            X500Name x500Name = new X500Name(commonName, organizationalUnit, organization, city, state, country);
            keypair.generate(keysize);

            PrivateKey privateKey = keypair.getPrivateKey();
            X509Certificate[] chain = new X509Certificate[1];
            chain[0] = keypair.getSelfCertificate(x500Name, new Date(), (long) validity * 24 * 60 * 60);

            FileOutputStream fos = new FileOutputStream(filePath);
            ks.setKeyEntry(alias, privateKey, keyPassword, chain);
            ks.store(fos, keyPassword);
            fos.close();
            System.out.println("create keystore Success");
        } catch (KeyStoreException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (CertificateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

客户端配置

hugegraph-loader配置

--protocol=https # http 或者https
--trust-store-file # 客户端证书
--trust-store-password # 客户端证书密码

hugegraph-tools配置

--protocol=https # http 或者https
--trust-store-file # 客户端证书
--trust-store-password # 客户端证书密码

客户端文件生成:

可以使用keytool工具生成

示例代码:
keytool -genkeypair -alias certificatekey -keyalg RSA -validity 7 -keystore keystore.jks

注意: 服务端没有对客户端证书内容做强制校验

shzcore avatar Nov 11 '20 03:11 shzcore

服务端配置:

在conf/rest-server.properties配置文件中设置启用https,默认是http
server.protocol=https # http 或者 https  默认https
ssl.server_keystore_file=server.keystore # 服务端证书文件
ssl.server_keystore_password=changeit # 服务端证书文件密码

服务端证书文件生成示例代码:

public class KeyStoreCreate {
    private static final String alias = "hugegraph";
    private static final String city = "beijing";
    private static final String commonName = "hugegraph.github.io";
    private static final String country = "beijing";
    private static final String filePath = "cert/server.keystore";
    private static final char[] keyPassword = "123456".toCharArray();
    private static final int keysize = 1024;
    private static final String organization = "hugegraph";
    private static final String organizationalUnit = "IT";
    private static final String state = "beijing";
    private static final long validity = 1096;

    public static void main(String[] args) throws GeneralSecurityException {
        try {

            KeyStore ks = KeyStore.getInstance("pkcs12");
            ks.load(null, null);

            CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null);
            X500Name x500Name = new X500Name(commonName, organizationalUnit, organization, city, state, country);
            keypair.generate(keysize);

            PrivateKey privateKey = keypair.getPrivateKey();
            X509Certificate[] chain = new X509Certificate[1];
            chain[0] = keypair.getSelfCertificate(x500Name, new Date(), (long) validity * 24 * 60 * 60);

            FileOutputStream fos = new FileOutputStream(filePath);
            ks.setKeyEntry(alias, privateKey, keyPassword, chain);
            ks.store(fos, keyPassword);
            fos.close();
            System.out.println("create keystore Success");
        } catch (KeyStoreException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (CertificateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

客户端配置

hugegraph-loader配置

--protocol=https # http 或者https
--trust-store-file # 客户端证书
--trust-store-password # 客户端证书密码

hugegraph-tools配置

--protocol=https # http 或者https
--trust-store-file # 客户端证书
--trust-store-password # 客户端证书密码

客户端文件生成:

可以使用keytool工具生成

示例代码:
keytool -genkeypair -alias certificatekey -keyalg RSA -validity 7 -keystore keystore.jks

注意: 服务端没有对客户端证书内容做强制校验 感谢,可是这配置的只是restserver,gremlinserver如何配置呢?

dyhyao6 avatar Dec 07 '20 11:12 dyhyao6