Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-20076

s3-storage-v3 can't connect to a bucket with custom port

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 7.12.5
    • Component/s: S3
    • Labels:
    • Severity:
      High
    • Release Notes:
      Yes

      Description

      By using the JetS3t provider for S3, you could configure Artifactory to work with an S3 compatible bucket which is running on any port.
      This is no longer possible if you wish to use the S3 official SDK.

      This configuration works:

        <config version="2">
            <chain template="s3"/>
            <provider id="s3" type="s3">
               <endpoint>http://RESTRICTED_IP:8333</endpoint>
               <port>8333</port>
               <identity>yourIdentity</identity>
               <credential>yourCredentials</credential>
               <path>path</path>
               <bucketName>arielk</bucketName>
               <httpsOnly>false</httpsOnly>
               <property name="s3service.disable-dns-buckets" value="true"></property>
            </provider>
        </config>
      

      While this doesn't work:

        <config version="2">
            <chain template="s3-storage-v3"/>
            <provider id="s3-storage-v3" type="s3-storage-v3">
               <endpoint>http://RESTRICTED_IP:8333</endpoint>
               <identity>yourIdentity</identity>
               <credential>yourCredentials</credential>
               <path>path</path>
               <bucketName>arielk</bucketName>
               <enablePathStyleAccess>true</enablePathStyleAccess>
            </provider>
        </config>
      

      As seen in the below stacktrace, it will always try to connect via port 443:

      2019-09-08 14:15:05,171 [art-init] INFO  o.a.a.f.t.s.S3ClientBuilder:64 - Connecting to S3 endpoint: 'http://RESTRICTED_IP:8333'
      2019-09-08 14:15:07,094 [art-init] WARN  o.a.s.ArtifactoryApplicationContext:254 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'artifactBuildAddonImpl': Unsatisfied dependency expressed through field 'buildService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'buildServiceImpl': Unsatisfied dependency expressed through method 'setUploadService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'uploadServiceImpl': Unsatisfied dependency expressed through field 'authService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityServiceImpl': Unsatisfied dependency expressed through field 'activePrincipalTokenStore'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'activePrincipalTokenStoreImpl' defined in file [/Users/arielk/devenv/artifactory6/artifactory-oss/backend/core/target/classes/org/artifactory/security/auth/ActivePrincipalTokenStoreImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessServiceImpl': Unsatisfied dependency expressed through method 'setRepositoryService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositoryServiceImpl': Unsatisfied dependency expressed through field 'storageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'storageServiceImpl': Unsatisfied dependency expressed through field 'binaryStore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'binaryServiceImpl': Invocation of init method failed; nested exception is com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to 34.65.33.202:443 [/34.65.33.202] failed: Connection refused (Connection refused)
      2019-09-08 14:15:07,102 [art-init] ERROR o.a.w.s.ArtifactoryContextConfigListener:96 - Application could not be initialized: Connection refused (Connection refused)
      java.lang.reflect.InvocationTargetException: null
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      ...
      Caused by: org.apache.http.conn.HttpHostConnectException: Connect to RESTRICTED_IP:443 [/RESTRICTED_IP] failed: Connection refused (Connection refused)
      
      

      I have ran into this while trying to setup Artifactory with SeaWeedFS.

      Workarounds
      I haven't tried, but I assume setting up a proxy like NGINX to listen to 443 and forward to 8333 would have resolved it.
      (keeping in mind that configuration should point to NGINX)

        Attachments

          Activity

              People

              Assignee:
              volodymyrm Volodymyr Marchev [EXT]
              Reporter:
              arielk Ariel Kabov
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: