debian_install

in chef/cookbooks/cpe_crowdstrike_falcon_sensor/resources/cpe_crowdstrike_falcon_sensor.rb [92:121]


  def debian_install(cid, reg_token, falconctl_path = falcon_agent_prefs['falconctl_path'])
    
    file_name = "#{node['cpe_crowdstrike_falcon_sensor']['pkg']['app_name']}-"\
      "#{node['cpe_crowdstrike_falcon_sensor']['pkg']['version']}.deb"
    deb_path = ::File.join(Chef::Config[:file_cache_path], file_name)
    cpe_remote_file node['cpe_crowdstrike_falcon_sensor']['pkg']['app_name'] do
      backup 1
      file_name file_name
      checksum node['cpe_crowdstrike_falcon_sensor']['pkg']['checksum']
      path deb_path
      mode '0644'
    end
    
    dpkg_package file_name do
      source deb_path
      version node['cpe_crowdstrike_falcon_sensor']['pkg']['dpkg_version']
      action :install
    end
    
    execute 'Setting Crowdstrike Falcon registration token' do
      command "#{falconctl_path} -s --cid=#{reg_token}"
      only_if { ::File.exists?(falconctl_path) }
      only_if { check_falconctl_registration(falconctl_path) != cid }
    end
    
    service 'falcon-sensor' do
      action %i[enable start]
    end
  end