Sha256: 7f975399e03b7feb5d89d623b977e6bd11d8174c7764e9d183a0936bbe597f09

Contents?: true

Size: 1.77 KB

Versions: 18

Compression:

Stored size: 1.77 KB

Contents

module Puppet
  newtype(:sshkey) do
    @doc = "Installs and manages ssh host keys.  At this point, this type
      only knows how to install keys into `/etc/ssh/ssh_known_hosts`.  See 
      the `ssh_authorized_key` type to manage authorized keys."

    ensurable

    newproperty(:type) do
      desc "The encryption type used.  Probably ssh-dss or ssh-rsa."

      newvalue("ssh-dss")
      newvalue("ssh-rsa")
      aliasvalue(:dsa, "ssh-dss")
      aliasvalue(:rsa, "ssh-rsa")
    end

    newproperty(:key) do
      desc "The key itself; generally a long string of hex digits."
    end

    # FIXME This should automagically check for aliases to the hosts, just
    # to see if we can automatically glean any aliases.
    newproperty(:host_aliases) do
      desc 'Any aliases the host might have.  Multiple values must be
        specified as an array.'

      attr_accessor :meta

      def insync?(is)
        is == @should
      end
      # We actually want to return the whole array here, not just the first
      # value.
      def should
        defined?(@should) ? @should : nil
      end

      validate do |value|
        if value =~ /\s/
          raise Puppet::Error, "Aliases cannot include whitespace"
        end
        if value =~ /,/
          raise Puppet::Error, "Aliases cannot include whitespace"
        end
      end
    end

    newparam(:name) do
      desc "The host name that the key is associated with."

      isnamevar
    end

    newproperty(:target) do
      desc "The file in which to store the ssh key.  Only used by
        the `parsed` provider."

      defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
        @resource.class.defaultprovider.default_target
        else
          nil
        end
      }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/type/sshkey.rb
puppet-2.6.17 lib/puppet/type/sshkey.rb
puppet-2.6.16 lib/puppet/type/sshkey.rb
puppet-2.6.15 lib/puppet/type/sshkey.rb
puppet-2.6.14 lib/puppet/type/sshkey.rb
puppet-2.6.13 lib/puppet/type/sshkey.rb
puppet-2.6.12 lib/puppet/type/sshkey.rb
puppet-2.6.11 lib/puppet/type/sshkey.rb
puppet-2.6.10 lib/puppet/type/sshkey.rb
puppet-2.6.9 lib/puppet/type/sshkey.rb
puppet-2.6.8 lib/puppet/type/sshkey.rb
puppet-2.6.7 lib/puppet/type/sshkey.rb
puppet-2.6.6 lib/puppet/type/sshkey.rb
puppet-2.6.5 lib/puppet/type/sshkey.rb
puppet-2.6.4 lib/puppet/type/sshkey.rb
puppet-2.6.3 lib/puppet/type/sshkey.rb
puppet-2.6.2 lib/puppet/type/sshkey.rb
puppet-2.6.1 lib/puppet/type/sshkey.rb