monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Monotone passphrases lua hook


From: Matthew A. Nicholson
Subject: [Monotone-devel] Monotone passphrases lua hook
Date: Fri, 10 Mar 2006 03:49:04 -0600
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

Greetings,

Here is a monotonerc file implmenting the get_passphrase hook. It reads a file from the conf dir for the passphrases and expects them to be formatted as follows:

address@hidden "This is the passphrase"

It should support multiple passphrases. This was developed for use with my monotone-server debian package, but it should prove useful other places as well. Perhaps this could join the new permissions hooks as the default.

P.S. Make sure your passphrases file is only readable by your user (or the user you run monotone as) for security reasons.
--
Matthew A. Nicholson
matt-land.com
-- monotone hooks file
-- vim: set ft=lua sw=3 noet:

-- This hook reads the passphrases file in the confdir (/etc/monotone)
function get_passphrase (keypair_id)
   local permfile = io.open(get_confdir() .. "/passphrases", "r")
   if (permfile == nil) then
      return false
   end
   local line = permfile:read()
   while (line ~= nil) do
      local _, _, key, passphrase = string.find(line, 
"%s*([^%s]*)%s*\"(.*)\"%s*")
      if keypair_id == key then return passphrase end
      line = permfile:read()
   end
   io.close(permfile)
   return false
end


reply via email to

[Prev in Thread] Current Thread [Next in Thread]