Giter Club home page Giter Club logo

conjur-action's Introduction

CyberArk Conjur Secret Fetcher

GitHub Action for secure secrets delivery to your workflow test environment using CyberArk Conjur.

Supports authenticating with CyberArk Conjur using host identity and JWT authentication.

Host Identity

Example

on: [push]

jobs:
  test:
    # ...
    steps:
      # ...
      - name: Import Secrets using CyberArk Conjur Secret Fetcher
        uses: infamousjoeg/[email protected]
        with:
          url: ${{ secrets.CONJUR_URL }}
          account: cyberarkdemo
          host_id: ${{ secrets.CONJUR_USERNAME }}
          api_key: ${{ secrets.CONJUR_API_KEY }}
          secrets: db/sqlusername|sql_username;db/sql_password
      # ...

Arguments

Required

  • url - this is the path to your Conjur instance endpoint. e.g. https://conjur.cyberark.com:8443
  • account - this is the account configured for the Conjur instance during deployment.
  • host_id - this is the Host ID granted to your application by Conjur when created via policy. e.g. host/db/github_action
  • api_key - this is the API key associated with your Host ID declared previously.
  • secrets - a semi-colon delimited list of secrets to fetch. Refer to Secrets Syntax in the README below for more details.

Optional

  • certificate - if using a self-signed certificate, provide the contents for validated SSL.

Not required

  • authn_id - this is the ID of Authn-JWT at Conjur

JWT Authentication

Example

on: [push]

jobs:
  test:
    # ...
    permissions:
      id-token: 'write'
      contents: 'read'
    steps:
      # ...
      - name: Import Secrets using CyberArk Conjur Secret Fetcher
        uses: infamousjoeg/[email protected]
        with:
          url: ${{ secrets.CONJUR_URL }}
          account: cyberarkdemo
          authn_id: ${{ secrets.CONJUR_AUTHN_ID }}
          secrets: db/sqlusername|sql_username;db/sql_password
      # ...

Conjur Setup

JWT Authenticator is required at Conjur server. You may wish to refer to official doc

The sample policy below validates GitHub repository & workflow

  1. Sample authenticator policy
  2. Sample app id policy
  3. Sample secret values and commands:
conjur policy load -f ./policy/github-authn-jwt.yml -b root
conjur policy load -f ./policy/github-app-id.yml -b root

conjur variable set -i conjur/authn-jwt/github/issuer -v "https://token.actions.githubusercontent.com"
conjur variable set -i conjur/authn-jwt/github/jwks-uri -v "https://token.actions.githubusercontent.com/.well-known/jwks"
conjur variable set -i conjur/authn-jwt/github/token-app-property -v "workflow"
conjur variable set -i conjur/authn-jwt/github/enforced-claims -v "workflow,repository"
conjur variable set -i conjur/authn-jwt/github/identity-path -v "/github-apps"

Arguments

Required

  • url - this is the path to your Conjur instance endpoint. e.g. https://conjur.cyberark.com:8443
  • account - this is the account configured for the Conjur instance during deployment.
  • authn_id - this is the ID of Authn-JWT at Conjur
  • secrets - a semi-colon delimited list of secrets to fetch. Refer to Secrets Syntax in the README below for more details.

Optional

  • certificate - if using a self-signed certificate, provide the contents for validated SSL.

Not required

  • host_id - this is the Host ID granted to your application by Conjur when created via policy. e.g. host/db/github_action
  • api_key - this is the API key associated with your Host ID declared previously.

Secrets Syntax

{{ conjurVariable1|envVarName1;conjurVariable2 }}

The secrets argument is a semi-colon (;) delimited list of secrets. Spaces are NOT SUPPORTED. The list can optionally contain the name to set for the environment variable.

Example

db/sqlusername|sql_username;db/sql_password

In the above example, the first secret section is db/sqlusername|sql_username. The | separates the Conjur Variable ID from the environment variable that will contain the value of the Conjur Variable's value.

The second secret section is db/sql_password. When no name is given for the environment variable, the Conjur Variable Name will be used. In this example, the value would be set to SQL_PASSWORD as the environment variable name.

Security

Protecting Arguments

It is recommended to set the URL, Host ID, and API Key values for the Action to function as secrets by going to Settings > Secrets in your GitHub repository and adding them there. These can then be called in your workflows' YAML file as a variable: ${{ secrets.SECRETNAME }}

Masking

The CyberArk Conjur Secret Fetcher GitHub Action utilizes masking prior to setting secret values to the environment. This prevents output to the console and to logs.

Maintainer

Joe Garcia - @infamousjoeg

Quincy Cheng - @quincycheng

Buy me a coffee

License

MIT

conjur-action's People

Contributors

infamousjoeg avatar quincycheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

conjur-action's Issues

permission denied to exec entrypoint.sh

Hello
We get the following error with the action in our environment (customized github runners in AWS)

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/entrypoint.sh": permission denied: unknown.

We solved the issue by adding a chmod +x in the Dockerfile:

FROM alpine:3.15.4
[...]
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

do you think that could be merged to master branch ?

Thanks for the action.

Error on entrypoint.sh

Receiving an error when the action runs. It appears the action is completing, but I'm getting the following error at the end.

/entrypoint.sh: line 83: $GITHUB_ENV: ambiguous redirect

Using GitHub Self-Hosted Runner on AWS EC2

Discussed in #15

Originally posted by infamousjoeg November 22, 2022
If you're using a GitHub Self-Hosted Runner on an AWS EC2 instance with the authn-jwt method of authentication to Conjur, you'll need to ensure you've configured the Amazon Time Sync Service for the EC2 instance. Failure to do so will result in authentication issues with Conjur due to the iat claim of the JWT generated by GitHub to be issued after the current time on the EC2 instance.

Follow this guide in order to configure time sync on the instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.