Configuring ssl and a certificate

I have followed the instructions for setting up ssl access over https for scm-server. It isn’t seeing that I have a certificate though. I have tried everything. I have a valid cert from my IT department. We have a CA authority and use these certs for other applications. scm-server starts fine but it says not secure. In the /etc/default/scm-server file, the port is set to 8080 by default. I have tried changing it to 8443, and it works but it still says not secure and no cert. Help please?

Could you post your server-config.xml?

cat server-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--

    MIT License

    Copyright (c) 2020-present Cloudogu GmbH and Contributors

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="ScmServer" class="org.eclipse.jetty.server.Server">

  <!--
    This default configuration should match 90% of the use cases,
    if you have to change something ensure you know what you are doing.

    For further information on configuration scm-server have a look at:
    https://www.scm-manager.org/docs/2.23.x/en/administration/scm-server/
  -->

  <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
    <!-- increase header size for mercurial -->
    <Set name="requestHeaderSize">16384</Set>
    <Set name="responseHeaderSize">16384</Set>

    <Call name="addCustomizer">
      <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
    </Call>
  </New>

  <!--
  Connectors
  -->
  <Call name="addConnector">
    <Arg>
      <New class="org.eclipse.jetty.server.ServerConnector">
        <Arg name="server">
          <Ref refid="ScmServer" />
        </Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
            <Item>
              <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                <Arg name="config">
                  <Ref refid="httpConfig" />
                </Arg>
              </New>
            </Item>
          </Array>
        </Arg>
        <Set name="host">
          <SystemProperty name="jetty.host" default="0.0.0.0" />
        </Set>
        <Set name="port">
          <SystemProperty name="jetty.port" default="8080" />
        </Set>
      </New>
    </Arg>
  </Call>

  <New id="scm-webapp" class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/scm</Set>
    <Set name="war">
      <SystemProperty name="basedir" default="."/>/var/webapp/scm-webapp.war
    </Set>
    <!-- disable directory listings -->
    <Call name="setInitParameter">
      <Arg>org.eclipse.jetty.servlet.Default.dirAllowed</Arg>
      <Arg>false</Arg>
    </Call>
    <Set name="tempDirectory">/var/cache/scm/work/webapp</Set>
  </New>

  <New id="docroot" class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/</Set>
    <Set name="baseResource">
      <New class="org.eclipse.jetty.util.resource.ResourceCollection">
        <Arg>
          <Array type="java.lang.String">
            <Item>
              <SystemProperty name="basedir" default="."/>/var/webapp/docroot</Item>
          </Array>
        </Arg>
      </New>
    </Set>
    <Set name="tempDirectory">/var/cache/scm/work/work/docroot</Set>
  </New>

  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.HandlerCollection">
      <Set name="handlers">
        <Array type="org.eclipse.jetty.server.Handler">
          <Item>
            <Ref id="scm-webapp" />
          </Item>
          <Item>
            <Ref id="docroot" />
          </Item>
        </Array>
      </Set>
    </New>
  </Set>

<!-- ssl configuration start -->

<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
  <!--
    path to your keystore, it can be a java keystore or in the pkcs12 format
  -->
  <Set name="KeyStorePath">
    <SystemProperty name="basedir" default="."/>/conf/keystore.pkcs12
  </Set>
  <!--
    use pkcs12 or jks for java keystore
  -->
  <Set name="KeyStoreType">PKCS12</Set>
  <!--
    the password of your keystore
  -->
  <Set name="KeyStorePassword">xxxx</Set>

  <!--
    For a more up to date list of ciphers and protocols, have a look at the mozilla ssl configurator:
    https://ssl-config.mozilla.org/#server=jetty&version=9.4.28&config=intermediate&guideline=5.4
  -->

  <!-- TLS 1.3 requires Java 11 or higher -->
  <Set name="IncludeProtocols">
    <Array type="String">
        <Item>TLSv1.2</Item>
        <Item>TLSv1.3</Item>
    </Array>
  </Set>

  <Set name="IncludeCipherSuites">
    <Array type="String">
      <Item>TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384</Item>
      <Item>TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384</Item>
      <Item>TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256</Item>
      <Item>TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256</Item>
      <Item>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256</Item>
      <Item>TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256</Item>
      <Item>TLS_DHE_RSA_WITH_AES_256_GCM_SHA384</Item>
      <Item>TLS_DHE_RSA_WITH_AES_128_GCM_SHA256</Item>
    </Array>
  </Set>

  <Set name="useCipherSuitesOrder">
    <Property name="jetty.sslContext.useCipherSuitesOrder" default="false" />
  </Set>
</New>

<New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
  <Arg>
    <Ref refid="httpConfig"/>
  </Arg>
  <Call name="addCustomizer">
    <Arg>
      <New class="org.eclipse.jetty.server.SecureRequestCustomizer">
        <Arg name="sniRequired" type="boolean"><Property name="jetty.ssl.sniRequired" default="false"/></Arg>
        <Arg name="sniHostCheck" type="boolean"><Property name="jetty.ssl.sniHostCheck" default="true"/></Arg>
        <Arg name="stsMaxAgeSeconds" type="int"><Property name="jetty.ssl.stsMaxAgeSeconds" default="-1"/></Arg>
        <Arg name="stsIncludeSubdomains" type="boolean"><Property name="jetty.ssl.stsIncludeSubdomains" default="false"/></Arg>
      </New>
    </Arg>
  </Call>
</New>

<Call name="addConnector">
  <Arg>
    <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
      <Arg name="server">
        <Ref refid="ScmServer" />
      </Arg>
      <Arg name="factories">
        <Array type="org.eclipse.jetty.server.ConnectionFactory">
          <Item>
            <New class="org.eclipse.jetty.server.SslConnectionFactory">
              <Arg name="next">http/1.1</Arg>
              <Arg name="sslContextFactory">
                <Ref refid="sslContextFactory"/>
              </Arg>
            </New>
          </Item>
          <Item>
            <New class="org.eclipse.jetty.server.HttpConnectionFactory">
              <Arg name="config">
                <Ref refid="sslHttpConfig" />
              </Arg>
            </New>
          </Item>
        </Array>
      </Arg>
      <!--
        Address to listen 0.0.0.0 means on every interface
      -->
      <Set name="host">
        <SystemProperty name="jetty.host" default="0.0.0.0" />
      </Set>
      <!--
        Port for the https connector
      -->
      <Set name="port">
        <Property name="jetty.ssl.port" default="8443" />
      </Set>
    </New>
  </Arg>
</Call>

<!-- ssl configuration end -->
</Configure>

The config looks good so far. The given configuration should open two ports, one unencrypted (http) on 8080 and one encrypted (https) on 8443. Please ensure that the port variable from /etc/default/scm-server is set to 8080, because it configures only the http port and it conflicts if it is set to 8443.

What happens exactly if you access port 8443?

1 Like

I had the port configured wrong, so once I set the port to 8080 in the default file, I am able to access 8443 and it is secure. Thank you.

~WRD0348.jpg

image001.png

image002.png

image003.png

image004.png

image005.png

image006.jpg

2 Likes