Giter Club home page Giter Club logo

trustedcore-ra's Introduction

Trusted Core: RA

A custom registration authority client to be used with the ISC CertAgent RAMI API, which allows for the automated generation of single or bulk x.509 certificates. This script assumes the user has some familiarity with manual operation of ISC CertAgent, is familiar with the RAMI API and its client certificates and trustchains.

Prerequisites

Client

  • Bash
  • OpenSSL
  • Curl

Certificate Authority / Server

  • ISC CertAgent 7.0.9.x
  • RAMI API Configured

References

  • ISC CertAgent 7.0.9.x Installation Guide
  • RFC 5280

Installation

This script requires no root privileges and is designed to be run from the user's home directory.

  1. Clone latest from Github:
$ cd ~
$ git clone https://github.com/acavella/trustedcore-ra.git
  1. Copy ca trust and client (RAMI) certificates to your home directory:
$ cp ca-root.pem ~
$ cp rami-client.pfx ~
  1. Using OpenSSL, convert the client PKCS12 certificate to PEM format:
$ openssl pkcs12 -in <p12 file> -out <install directory>/cert/client.pem -nodes
  1. Using OpenSSL, convert the trustchain from DER to PEM format (if trustchain is already PEM this can be skipped):
$ openssl x509 –inform der –in <root cert> -out <install directory>/cert/ca-trust.pem
  1. Edit <install-directory>/conf/local.conf and set parameters to match your local environment:
local.conf

clientcert="<install directory>/cert/client.pem"
cacert="<install directory>/cert/ca-trust.pem"

caecc="https://tlsldc405.example.com/ca/x11"
ecdsaprofile="x11ecdsa"
ecdhprofile="x11ecdh"

carsa="https://tlsldc405.example.com/ca/x11"
rsaprofile="x11rsa"

Usage

This script is meant to be operated directly from CLI; all options are specified as inline arguments. The first argument is an input file which consists of a lists of Common Names (CN) to be used in the generation of PKCS#10 Certificate Signing Requests (CSR). The input file can be any plain-text file which lists a single CN per line, an example can be found in the input directory.

The second argument is certificate specification (ECDSA, ECDH, RSA), which are based on specifications in CNSSP 15 (Use of Public Standards for Secure Information Sharing). The third argument specifies whether the script interacts with the RAMI API and submits the certificate signing request to the CA. If not specified, the script creates a private key and certificate signing request in an offline only mode; allowing the operator to manually submit / sign the generated CSRs. All files generated will be saved within <install-directory>/output/<named dir>.

$ ./tcra.sh <input-file> [ecdsa|ecdh|rsa] [sign]

Trusted Core: RA Bulk Generation of Keys and CSRS Bulk RSA CSR & Private Key Generation

License & Credits

Author

Tony Cavella

License

MIT License

Copyright (c) 2022 Tony Cavella

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.

trustedcore-ra's People

Contributors

acavella avatar

Stargazers

 avatar

Watchers

 avatar  avatar

trustedcore-ra's Issues

Ut8string used for CN

CSR generates CN as utf8string and remaining parameter's as printablestring. CertAgent CA subject is printableString and therefore expects submitted CN to be printableString

Log lines displaying carriage return at eol

printf lines have visible carriage return at end of line \n

2022-12-31T17:09:59Z 166414 [info] Trusted Core: RA v0.9.1 started\n
2022-12-31T17:09:59Z 166414 [info] Configuration file loaded sucessfully, /home/acavella/test2/trustedcore-ra-develop/conf/local.conf
2022-12-31T17:09:59Z 166414 [info] Input file is valid\n
2022-12-31T17:09:59Z 166414 [info] Completed reading input file, 54 bytes, input/input-example.txt\n

Implement Curl Client Authentication via PKCS12

Is your feature request related to a problem? Please describe.
Current operation of curl requires encrypted PKCS12 be decrypted and presented as PEM to authenticate to RAMI API, leaving the private key exposed on the system.

Describe the solution you'd like
Utilize PKCS12 for curl client authentication, decrypt PKCS12 on the fly. Either prompt user for PKCS12 password or store secret securely.

Additional context

Replace echo w/ printf

Describe the problem as it relates to the enhancement:
echo acts inconsistently across distributions and shells.

Describe the solution:
Replace echo statements with printf throughout.

Additional context:
n/a

OpenSSL can't find distinguished name in config

Versions

TrustedCore-RA ver. 1.0.0

Platform

  • OS and version: CentOS 7.9
  • Additional: OpenSSL 1.0.2k-fips

Expected behavior

Generate CSR from private key.

Actual behavior / bug

OpenSSL errors during CSR process.

Additional context

2023-01-03T23:22:15Z 24352 [info] Generated RSA private key, /home/acavella/trustedcore-ra/output/YXAVJJ4OPQ/YXAVJJ4OPQ.key with a subject YXAVJJ4OPQ
unable to find 'distinguished_name' in config
problems making Certificate Request
139865373415312:error:0E06D06C:configuration file routines:NCONF_get_string:no value:conf_lib.c:324:group=req name=distinguished_name

openssl not found

./tcra.sh: line 96: 0: command not found
2022-12-31T17:05:44Z 166089 [error] Command openssl was not found, exiting\n

Add debug output

Describe the problem as it relates to the enhancement:
Collecting version information and output necessary for debugging requires the user to provide these details based on their own knowledge/understanding.

Describe the solution:
Add "--debug" argument to command.

Debug output should provide:

  • TrustedCore-RA Version
  • Operating System and Version
  • Requirement Versions
    • OpenSSL
    • sed
    • etc...

Additional context:
n/a

Unbound variable ${i}

2022-12-31T17:08:28Z 166367 [info] Generating private key and csr for each subject\n
./tcra.sh: line 113: i: unbound variable

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.