This file is indexed.

/usr/share/mcollective/plugins/mcollective/agent/centralrpclog-mongodb.rb is in mcollective-plugins-centralrpclog 0.0.0~git20120507.df2fa81-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module MCollective
  module Agent
    # An agent that receives and logs RPC Audit messages sent from the accompanying Audit plugin
    #
    # It stores them in MongoDB, you can configure the mongo parameters:
    #
    #   plugin.centralrpclog.mongohost = localhost
    #   plugin.centralrpclog.mongodb = mcollective
    #   plugin.centralrpclog.collection = rpclog
    #
    # These are the defaults.  You need the mongo gem installed.
    class Centralrpclog
      attr_reader :timeout, :meta

      def initialize
        @timeout = 1

        @config = Config.instance

        @meta = {:license => "Apache 2",
          :author => "R.I.Pienaar <rip@devco.net>",
          :url => "https://github.com/puppetlabs/mcollective-plugins"}

        require 'mongo'

        @mongohost = @config.pluginconf["centralrpclog.mongohost"] || "localhost"
        @mongodb = @config.pluginconf["centralrpclog.mongodb"] || "mcollective"
        @collection = @config.pluginconf["centralrpclog.collection"] || "rpclog"

        Log.instance.debug("Connecting to mongodb @ #{@mongohost} db #{@mongodb} collection #{@collection}")

        @dbh = Mongo::Connection.new(@mongohost).db(@mongodb)
        @coll = @dbh.collection(@collection)
      end

      def handlemsg(msg, connection)
        request = msg[:body]
        
        log = request.to_hash.merge({:senderid => msg[:senderid], :requestid => request.uniqid, :caller => "#{request.caller}@#{request.sender}", :time => Time.now.to_i})

        @coll.save(log)

        # never reply
        nil
      end

      def help
        <<-EOH
                EOH
      end
    end
  end
end

# vi:tabstop=2:expandtab:ai:filetype=ruby