ARTIFACTORY: Solution to use AES256 encryption with Artifactory
AES256 is an encryption algorithm, whereas AWS KMS is a service that helps you manage encryption keys. When using AWS KMS, AES256 may be the algorithm used to encrypt the data, but KMS handles the key management aspects.
If you are using AES256 as a method of encryption you might get the following error:
Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 7XH8CC0xxxxxx; S3 Extended Request ID: xxxxxx+q/dI3wLV+xxxxxx+psVKQYxrgj8Sh8=)
Which can cause Artifactory not able to access information on the S3.
What is the solution for this?
The quickest way to solve this problem is to turn AES256 to KMS on S3 side and once done you can add the following to the Binarystore.xml located at $JFROG_HOME/artifactory/var/etc/artifactory:
<server-side-encryption-aws-kms>true</server-side-encryption-aws-kms>
keep in mind that If set to true, S3 encrypts artifacts on the server based on the default KMS key. For example it will look something like the following:
<config version="2"> <chain> <!--template="s3-storage-v3-direct"--> <provider id="cache-fs" type="cache-fs"> <provider id="s3-storage-v3" type="s3-storage-v3"/> </provider> </chain> <provider id="cache-fs" type="cache-fs"> <maxCacheSize>500000000000</maxCacheSize> // The maximum size of the cache in bytes <cacheProviderDir></cacheProviderDir> // The cache location </provider> <provider id="s3-storage-v3" type="s3-storage-v3"> <endpoint></endpoint> <region>eu-west-2</region> <bucketName></bucketName> <useInstanceCredentials>true</useInstanceCredentials> <server-side-encryption-aws-kms>true</server-side-encryption-aws-kms> </provider> </config>
As reference you can find more information regarding this via link.