【问题标题】:How to setup Apache Archiva to use HTTPS instead of HTTP如何设置 Apache Archiva 使用 HTTPS 而不是 HTTP
【发布时间】:2015-06-16 14:48:28
【问题描述】:

在默认配置中,Apache Archiva 2.2 使用 HTTP,official documentation 不告诉如何将其更改为 HTTPS。

我认为这可以通过修改conf/jetty.xml 文件来完成,但是当我尝试这样做时,如Jetty documentation 中所述,它只会给我这样的错误:

java.lang.NoSuchMethodException: class org.eclipse.jetty.util.ssl.SslContextFactory.setTrustStorePath(class java.lang.String)

可以这样做吗?

【问题讨论】:

  • 我对 Jetty 不清楚,也许 Jetty 文档没有更新或者我们使用的版本太旧。我使用 Apache httpd 服务器代理对 Archiva 实例的请求,因此很容易管理 https HTH奥利维尔
  • 谢谢。我还考虑过使用 Apache 代理作为解决方法。当我弄清楚时,我会尝试用确切的配置写答案。

标签: https archiva


【解决方案1】:

我使用 Apache 作为 HTTPS 代理,配置新的虚拟主机:

Listen 8081

<VirtualHost *:8081>
        ServerName archiva.example.com

        SSLEngine On
        SSLCertificateFile    /path/to/apache_certs/cert.pem
        SSLCertificateKeyFile /path/to/apache_certs/cert.key

        ProxyRequests     Off
        ProxyPass         /  http://localhost:8080/
        ProxyPassReverse  /  http://localhost:8080/
        <Proxy http://localhost:8080/*>
                Order allow,deny
                Allow from all
        </Proxy>
        ProxyPreserveHost on
</VirtualHost>

不要忘记启用运行此程序所需的两个 apache 模块:

sudo a2enmod proxy proxy_http

【讨论】:

    【解决方案2】:

    我将以下内容添加到 jetty.xml 并且它起作用了:

    <Call class="java.lang.System" name="setProperty"><Arg>jdk.tls.ephemeralDHKeySize</Arg><Arg>2048</Arg></Call>
    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
                <Arg>
                    <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
                        <Set name="keyStore"><SystemProperty name="jetty.home" default="." />/conf/tomcat.keystore</Set>
                        <Set name="keyStorePassword">changeit</Set>
                        <Set name="ExcludeProtocols">
                            <Array type="java.lang.String">
                                <Item>SSLv3</Item>
                            </Array>
                        </Set>
                    </New>
                </Arg>
                <Set name="port">8843</Set>
                <Set name="maxIdleTime">30000</Set>
                <Set name="Acceptors">2</Set>
                <Set name="statsOn">false</Set>
                <Set name="lowResourcesConnections">5000</Set>
                <Set name="lowResourcesMaxIdleTime">5000</Set>
                <Set name="IncludeCipherSuites">
                    <Array type="java.lang.String">
                        <Item>TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384</Item>
                        <Item>TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_256_GCM_SHA384</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_128_GCM_SHA256</Item>
                        <Item>TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384</Item>
                        <Item>TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_256_CBC_SHA256</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_128_CBC_SHA256</Item>
                        <Item>TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA</Item>
                        <Item>TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_256_CBC_SHA</Item>
                        <Item>TLS_DHE_RSA_WITH_AES_128_CBC_SHA</Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-07
      • 1970-01-01
      • 2015-08-23
      • 1970-01-01
      • 1970-01-01
      • 2022-12-16
      • 2017-08-22
      相关资源
      最近更新 更多