--- /dev/null
+puppet module for monkeysphere
+
+for information about monkeysphere, see http://web.monkeysphere.info/
+
+To install the monkeypshere module:
+
+* storeconfigs must be enabled in your puppet server. see:
+ http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration#Configuring+basic+storeconfigs
+
+* copy the code to a directory named "monkeysphere" in the modules
+ directory of your puppet install. This will usually be
+ /etc/puppetd/modules/monkeysphere
+
+* add the following line to modules.pp:
+
+ import "monkeysphere"
+
+* in node definitions that should export a ssh host key via
+ monkeyshere, add:
+
+ include monkeysphere::sshserver
+
+A host can be configured as a host you would use to sign the gpg keys by placing:
+
+ include monkeysphere::signer
+
+into the node definition. ON this host, a file will be placed in
+/var/lib/puppet/monkeysphere/hosts for each host configured as a
+sshserver. Each file will contin the gpg id, the gpg fingerprint, and
+the ssh fingerprint of the sshserver.
\ No newline at end of file
--- /dev/null
+*/5 * * * * root /usr/sbin/monkeysphere-authentication update-users
--- /dev/null
+has_hostkey = false
+pgp_fingerprint = ''
+pgp_id = ''
+ssh_fingerprint = ''
+
+if File.exist?('/usr/sbin/monkeysphere-host')
+
+ sk = %x{/usr/sbin/monkeysphere-host show-keys}
+ if $? == 0
+ has_hostkey = true
+ sk.lines.each do |line|
+ m = line.match('^OpenPGP fingerprint:(.*)$')
+ if m
+ pgp_fingerprint = m[1].strip
+ end
+ m = line.match('^uid (.*)$')
+ if m
+ pgp_id = m[1].strip
+ end
+ m = line.match('^ssh fingerprint:(.*)$')
+ if m
+ ssh_fingerprint = m[1].strip
+ end
+ end
+ end
+end
+
+Facter.add("monkeysphere_has_hostkey") do
+ setcode{ has_hostkey }
+end
+
+Facter.add("monkeysphere_pgp_fp") do
+ setcode{ pgp_fingerprint }
+end
+
+Facter.add("monkeysphere_pgp_id") do
+ setcode{ pgp_id }
+end
+
+Facter.add("monkeysphere_ssh_fp") do
+ setcode{ ssh_fingerprint }
+end
--- /dev/null
+class monkeysphere::debian {
+
+case $lsbdistcodename {
+ lenny: {
+ if $monkeysphere_ensure_version == ''
+ {
+ $monkeysphere_ensure_version = '1.4.10-2~bpo50+1'
+ }
+
+ if $gnupg_ensure_version == ''
+ {
+ $gnupg_ensure_version = '0.31-3~bpo50+1'
+ }
+ }
+ }
+}
--- /dev/null
+# monkeysphere module
+class monkeysphere {
+ module_dir { [ "monkeysphere", "monkeysphere/hosts", "monkeysphere/plugins" ]: }
+
+ case $operatingsystem {
+ debian: { include monkeysphere::debian }
+ }
+
+ if $monkeysphere_ensure_version == ''
+ {
+ $monkeysphere_ensure_version = 'installed'
+ }
+
+ if $gnupg_ensure_version == ''
+ {
+ $gnupg_ensure_version = 'installed'
+ }
+
+ package {"gnupg": ensure => $gnupg_ensure_version, }
+ package {"monkeysphere": ensure => $monkeysphere_ensure_version, require => [ Package["gnupg"] ] }
+
+}
--- /dev/null
+class monkeysphere::signer inherits monkeysphere
+{
+ File <<| tag == 'monkeysphere-host' |>>
+}
--- /dev/null
+class monkeysphere::sshserver inherits monkeysphere
+{
+
+ exec {"import.hostkey":
+ command => "/usr/sbin/monkeysphere-host import-key /etc/ssh/ssh_host_rsa_key ssh://${fqdn} && echo Y | /usr/sbin/monkeysphere-host publish-key",
+ unless => "/usr/sbin/monkeysphere-host show-key",
+ user => root,
+ require => [ Package[ "monkeysphere" ] ],
+ }
+
+ if $monkeysphere_has_hostkey {
+ @@file { "/var/lib/puppet/modules/monkeysphere/hosts/${fqdn}":
+ ensure => present,
+ content => template("monkeysphere/host.erb" ),
+ require => [ Package[ "monkeysphere" ] ],
+ tag => 'monkeysphere-host',
+ }
+ }
+
+ file { "/etc/cron.d/update-monkeysphere-auth":
+ ensure => present,
+ source => "puppet:///modules/monkeysphere/etc/cron.d/update-monkeysphere-auth",
+ require => [ Package[ "monkeysphere" ] ],
+ mode => 0644,
+ owner => root,
+ group => root,
+ }
+
+}
--- /dev/null
+class monkeysphere::sshserverdanger inherits monkeysphere::sshserver
+{
+ augeas { "sshd_config":
+ context => "/files/etc/ssh/sshd_config",
+ changes => [
+ "set AuthorizedKeysFile /var/lib/monkeysphere/authorized_keys/%u"
+ ],
+ notify => Service[ "ssh" ],
+ }
+
+}
--- /dev/null
+uid <%= monkeysphere_pgp_id %>
+host_key <%= monkeysphere_ssh_fp %>
+fingerprint <%= monkeysphere_pgp_fp %>