Sha256: 55b43fc38101d5a56771dde2edb7b1d3aad94549956942a33485815ba5afbe04

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Pvcglue
  class Packages
    class AuthorizedKeys < Pvcglue::Packages
      def installed?
        false
      end

      def post_install_check?
        true
      end

      def install!
        # TODO:  Safety check to see if user is locking himself out.  :)
        data = minion.get_root_authorized_keys_data
        if data.count == 0
          raise('No authorized keys found for root users!')
          # TODO:  work out system for pvc-manager access
          data = [`cat ~/.ssh/id_rsa.pub`.strip]
        end
        connection.write_to_file(:root, data.join("\n"), '/root/.ssh/authorized_keys')

        connection.mkdir_p(:root, "/home/#{user_name}/.ssh", user_name, user_name, '0700')
        data = minion.get_users_authorized_keys_data
        if data.count == 0
          raise('No authorized keys found for users!')
          # TODO:  work out system for pvc-manager access
          data = [`cat ~/.ssh/id_rsa.pub`.strip]
        end
        connection.write_to_file(:root, data.join("\n"), "/home/#{user_name}/.ssh/authorized_keys", user_name, user_name, '0644')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pvcglue-0.9.3 lib/pvcglue/packages/authorized_keys.rb
pvcglue-0.9.2 lib/pvcglue/packages/authorized_keys.rb
pvcglue-0.9.1 lib/pvcglue/packages/authorized_keys.rb
pvcglue-0.9.0 lib/pvcglue/packages/authorized_keys.rb