Sha256: 843f3a28b65f21789d6ed9130da76c49f4e7e3fc8e1b40ba4fdc56c34a5311ab

Contents?: true

Size: 862 Bytes

Versions: 13

Compression:

Stored size: 862 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'fluent/plugin/secure_forward/cert_util'

ca_dir, passphrase = ARGV

unless ca_dir && passphrase
  puts 'USAGE: secure-forward-ca-generate  DIR_PATH  PRIVATE_KEY_PASSPHRASE'
  puts ''
  exit 0
end

FileUtils.mkdir_p(ca_dir)

opt = {
  private_key_length: 2048,
  cert_country:  'US',
  cert_state:    'CA',
  cert_locality: 'Mountain View',
  cert_common_name: 'SecureForward CA',
}
cert, key = Fluent::SecureForward::CertUtil.generate_ca_pair(opt)

key_data = key.export(OpenSSL::Cipher::Cipher.new('aes256'), passphrase)
File.open(File.join(ca_dir, 'ca_key.pem'), 'w') do |file|
  file.write key_data
end
File.open(File.join(ca_dir, 'ca_cert.pem'), 'w') do |file|
  file.write cert.to_pem
end

puts "successfully generated: ca_key.pem, ca_cert.pem"
puts "copy and use ca_cert.pem to client(out_secure_forward)"

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fluent-plugin-secure-forward-0.4.4 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.4.3 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.4.2 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.4.1 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.4.0 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.5pre1 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.4 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.3 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.3dev2 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.3dev1 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.2 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.1 bin/secure-forward-ca-generate
fluent-plugin-secure-forward-0.3.0 bin/secure-forward-ca-generate