Sha256: 1c431ccbf03e75ef9a8bf976642db6ede7bc4a25c76b82241af1bda90915eb48

Contents?: true

Size: 1.58 KB

Versions: 17

Compression:

Stored size: 1.58 KB

Contents

require 'rake_factory'
require 'ruby_easy_rsa'

require_relative '../../mixins/global_parameters'
require_relative '../../mixins/ssl_parameters'
require_relative '../../mixins/algorithm_parameters'
require_relative '../../mixins/encrypt_key_parameters'
require_relative '../../mixins/gitkeep_parameters'
require_relative '../../mixins/easy_rsa_ensure_prerequisite'

module RakeEasyRSA
  module Tasks
    module CA
      class Create < RakeFactory::Task
        include Mixins::GlobalParameters
        include Mixins::SSLParameters
        include Mixins::AlgorithmParameters
        include Mixins::EncryptKeyParameters
        include Mixins::GitkeepParameters
        include Mixins::EasyRSAEnsurePrerequisite

        default_name :create
        default_description "Create the CA certificate for the PKI"

        action do |t|
          puts "Creating CA certificate... "
          RubyEasyRSA.build_ca(t.parameter_values)
          if t.include_gitkeep_files
            [
                'certs_by_serial/.gitkeep',
                'issued/.gitkeep',
                'renewed/certs_by_serial/.gitkeep',
                'renewed/private_by_serial/.gitkeep',
                'renewed/reqs_by_serial/.gitkeep',
                'revoked/certs_by_serial/.gitkeep',
                'revoked/private_by_serial/.gitkeep',
                'revoked/reqs_by_serial/.gitkeep'
            ].each do |gitkeep_file|
              File.open("#{t.pki_directory}/#{gitkeep_file}", 'w') do |f|
                f.write('')
              end
            end
          end
          puts "Done."
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rake_easy_rsa-0.12.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.11.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.6 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.5 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.4 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.3 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.2 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.10.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.9.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.8.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.7.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.6.0.pre.2 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.6.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.5.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.4.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.3.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.2.0.pre.11 lib/rake_easy_rsa/tasks/ca/create.rb