Class: CfnVpn::Actions::Revoke

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cfnvpn/actions/revoke.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



21
22
23
# File 'lib/cfnvpn/actions/revoke.rb', line 21

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#apply_rekocation_listObject



43
44
45
46
47
# File 'lib/cfnvpn/actions/revoke.rb', line 43

def apply_rekocation_list
  vpn = CfnVpn::ClientVpn.new(@name,@options['region'])
  vpn.put_revoke_list("#{@cert_dir}/crl.pem")
  CfnVpn::Log.logger.info("revoked client #{@options['client_cn']} from #{vpn.endpoint_id}")
end

#revoke_certificateObject



34
35
36
37
38
39
40
41
# File 'lib/cfnvpn/actions/revoke.rb', line 34

def revoke_certificate
  cert = CfnVpn::Certificates.new(@build_dir,@name,@options['easyrsa_local'])
  s3 = CfnVpn::S3.new(@options['region'],@options['bucket'],@name)
  s3.get_object("#{@cert_dir}/ca.tar.gz")
  s3.get_object("#{@cert_dir}/#{@options['client_cn']}.tar.gz")
  CfnVpn::Log.logger.info "Generating new client certificate #{@options['client_cn']} using openvpn easy-rsa"
  CfnVpn::Log.logger.debug cert.revoke_client(@options['client_cn'])
end

#set_directoryObject



29
30
31
32
# File 'lib/cfnvpn/actions/revoke.rb', line 29

def set_directory
  @build_dir = "#{CfnVpn.cfnvpn_path}/#{@name}"
  @cert_dir = "#{@build_dir}/certificates"
end

#set_loglevelObject



25
26
27
# File 'lib/cfnvpn/actions/revoke.rb', line 25

def set_loglevel
  CfnVpn::Log.logger.level = Logger::DEBUG if @options['verbose']
end