AWS KMS support for pgp-maven-plugin

Extension supporting AWS KMS for decrypting a pgp passphrases for pgp-maven-plugin

License

License

Categories

Categories

AWS Container PaaS Providers Maven Build Tools ASM Application Layer Libs Bytecode Manipulation
GroupId

GroupId

com.lasmanis
ArtifactId

ArtifactId

pgp-maven-plugin-awskms
Last Version

Last Version

0.0.8
Release Date

Release Date

Type

Type

jar
Description

Description

AWS KMS support for pgp-maven-plugin
Extension supporting AWS KMS for decrypting a pgp passphrases for pgp-maven-plugin
Project URL

Project URL

https://github.com/michaellasmanis/pgp-maven-plugin-awskms
Project Organization

Project Organization

Michael Lasmanis
Source Code Management

Source Code Management

https://github.com/michaellasmanis/pgp-maven-plugin-awskms

Download pgp-maven-plugin-awskms

How to add to project

<!-- https://jarcasting.com/artifacts/com.lasmanis/pgp-maven-plugin-awskms/ -->
<dependency>
    <groupId>com.lasmanis</groupId>
    <artifactId>pgp-maven-plugin-awskms</artifactId>
    <version>0.0.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.lasmanis/pgp-maven-plugin-awskms/
implementation 'com.lasmanis:pgp-maven-plugin-awskms:0.0.8'
// https://jarcasting.com/artifacts/com.lasmanis/pgp-maven-plugin-awskms/
implementation ("com.lasmanis:pgp-maven-plugin-awskms:0.0.8")
'com.lasmanis:pgp-maven-plugin-awskms:jar:0.0.8'
<dependency org="com.lasmanis" name="pgp-maven-plugin-awskms" rev="0.0.8">
  <artifact name="pgp-maven-plugin-awskms" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.lasmanis', module='pgp-maven-plugin-awskms', version='0.0.8')
)
libraryDependencies += "com.lasmanis" % "pgp-maven-plugin-awskms" % "0.0.8"
[com.lasmanis/pgp-maven-plugin-awskms "0.0.8"]

Dependencies

compile (3)

Group / Artifact Type Version
org.kohsuke : pgp-maven-plugin jar 1.1
org.codehaus.plexus : plexus-component-annotations jar 1.7.1
com.amazonaws : aws-java-sdk-kms jar 1.11.258

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.9.0
org.mockito : mockito-core jar 2.13.0

Project Modules

There are no modules declared in this project.

AWS KMS support for pgp-maven-plugin

Branch Status
Master Build Status Codecov Maven Central
Develop Build Status Codecov

Overview

This plugin adds support to pgp-maven-plugin for decrypting a pgp passphrase via AWS Key Management Service. It wraps other passphrase loaders with KMS decryption.

Usage

You need to configure your pom.xml to add the pgp-maven-plugin-awskms as a dependency to pgp-maven-plugin.

<plugin>
    <groupId>org.kohsuke</groupId>
    <artifactId>pgp-maven-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.lasmanis</groupId>
            <artifactId>pgp-maven-plugin-awskms</artifactId>
        </dependency>
    </dependencies>
    <configuration>
        <secretkey>SECRET_KEY_SPECIFIER</secretkey>
        <passphrase>PASSPHRASE_SPECIFIER</passphrase>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>sign</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Specifiy the passphrase cipher text as literal text

awskms:literal:ENCRYPTEDPASSPHRASE

This lets you specify the encrypted passphrase inline directly.

Store the passphrase cipher text is a file

awskms:file:PATH/TO/FILE

This lets you specify store the encrypted passphrase in the local filesystem.

Wrapping any PassphraseLoader (including custom loaders)

awskms:SCHEME:PATH/TO/FILE

This lets you call any included PassphraseLoader configured in the pom (built-in and custom).

Generating the Cipher Text

You can use any KMS methods (API, CLI, etc) to generate the cipher text.

Once you have generated a customer master key and add your IAM user as a user of that key, you can generate the cipher text. Using the AWS CLI is the simplist method. The output from the following command is the ENCRYPTEDPASSPHRASE which can be read from a file (via scheme awskms:file:) or used directly (via scheme awskms:literal:):

aws kms encrypt --key-id arn:aws:kms:us-east-1:XXXXXXXXXXXX:key/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  --plaintext "PASSPHRASE" --output text --query CiphertextBlob

In the command above, replace PASSPHRASE with the passphrase for your key and make sure to replace the key-id arn (starts with arn:aws:kms.....) with your key-id (available via the AWS console or CLI 'aws kms list-keys').

NOTE: Do not use the cipher text generated by the AWS Encryption SDK. The cipher text generated is not directly compatible with the KMS service.

AWS Credentials

Currently, the plugin uses the default credential handler from the aws-java-sdk. Configuration and initialization priorities are described here. The ability to supply credentials via the PASSPHRASE_SPECIFIER is coming in a future release.

If you are running within the AWS infrastructure, it is highly recommended to use roles for managing access keys/secrets. The combination of roles and this plugin eliminates the need to have plaintext signing secrets in a non-interactive build environment (like CodePipeline).

Documentation

License

Copyright 2017 Michael Lasmanis.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
0.0.8
0.0.7
0.0.6
0.0.5.1
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1