Class: DmEncrypt

Inherits:
Ec2Script show all
Defined in:
lib/scripts/ec2/dm_encrypt.rb

Overview

Script to Encrypt an EC2 Storage (aka Elastic Block Storage)

Defined Under Namespace

Classes: DmEncryptState, DoneState, InitialState, MountedAndActivatedState, ToolInstalledState

Constant Summary collapse

TOOLS =

dependencies: tools that need to be installed to make things work

["cryptsetup"]
CHECK =

the parameters for which

["cryptsetup"]

Constants inherited from Ec2Script

Ec2Script::CS_AWS_TIMEOUT, Ec2Script::CS_SEC_GRP_DESC, Ec2Script::CS_SEC_GRP_NAME

Instance Method Summary collapse

Methods inherited from Ec2Script

#get_execution_result, #post_message, #register_progress_message_listener, #register_state_change_listener, #start_script

Constructor Details

#initialize(input_params) ⇒ DmEncrypt

Input parameters

  • aws_access_key => the Amazon AWS Access Key (see Your Account -> Security Credentials)

  • aws_secret_key => the Amazon AWS Secret Key

  • ip_address => IP Address of the machine to connect to

  • ssh_username => name of the ssh-user (default = root)

  • ssh_key_file => Path of the keyfile used to connect to the machine (optional, otherwise: ssh_key_data)

  • ssh_key_data => Key information (optional, otherwise: ssh_key_file)

  • device => Path of the device to encrypt

  • device_name => Name of the Device to encrypt

  • storage_path => Path on which the encrypted device is mounted

  • paraphrase => paraphrase used for encryption

  • remote_command_handler => object that allows to connect via ssh and execute commands (optional)

  • ec2_api_handler => object that allows to access the EC2 API (optional)

  • ec2_api_server => server to connect to (option, default is us-east-1.ec2.amazonaws.com)



31
32
33
# File 'lib/scripts/ec2/dm_encrypt.rb', line 31

def initialize(input_params)
  super(input_params)
end

Instance Method Details

#check_input_parametersObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/scripts/ec2/dm_encrypt.rb', line 35

def check_input_parameters()
  if @input_params[:ec2_api_server] == nil
    @input_params[:ec2_api_server] = "us-east-1.ec2.amazonaws.com"
  end
  if @input_params[:remote_command_handler] == nil
    @input_params[:remote_command_handler] = RemoteCommandHandler.new
  end
  if @input_params[:ec2_api_handler] == nil
    @input_params[:ec2_api_handler] = AWS::EC2::Base.new(:access_key_id => @input_params[:aws_access_key],
    :secret_access_key => @input_params[:aws_secret_key], :server => @input_params[:ec2_api_server])
  end
  if @input_params[:ssh_username] == nil
    @input_params[:ssh_username] = "root"
  end
end

#load_initial_stateObject



51
52
53
# File 'lib/scripts/ec2/dm_encrypt.rb', line 51

def load_initial_state()
  DmEncryptState.load_state(@input_params)
end