Re: subscribing to folders

2004-07-28 Thread Alexander Brill
On Tue, 2004-07-27 at 17:42, Alexander Brill wrote:
> On Tue, 2004-07-27 at 16:26, Luca Olivetti wrote:
> > Alexander Brill wrote:
> > 
> > > On Fri, 2004-07-23 at 15:46, Rob Siemborski wrote:
> > > 
> > >>On Thu, 22 Jul 2004, Alexander Brill wrote:
> > >>
> > >>
> > >>>Is it possible to force subscribtion of a folder to another user by
> > >>>using the admin-user? I couldn't find any info about it in the docs and
> > >>>RFCs.
> > >>
> > >>If you use proxy authentication, then you can authenticate as the admin 
> > >>but authorize as the user, and then subscribe them to the folder.
> > > 
> > > 
> > > Could you reference me to some rfc's or other docs on the subject? I
> > > tried the PROXYAUTH-command (comes with python imaplib), but it wasn't
> > > recognized as a command on my server.
> > 
> > PROXYAUTH is a non standard command:
> > http://www.washington.edu/imap/listarch/2000/msg00215.html
> > (follow the thread).
> > 
> > The right thing to do is use the authenticate method, unfortunately it's 
> > not implemented in python imaplib. I don't understand why the imaplib 
> > developer(s) implemented the nonstandard command instead of the standard 
> > one.
> > 
> 
> The newest python imaplib has authenticate implemented, finally. But I
> have to wrap it around TLS as well, so I'll have to look into that.
> There goes my quick and dirty hack to force people to subscribe to a
> folder.

Ok, I wrote an extension to python imaplib to handle starttls, if more
are interested you can find it here:
http://projects.brill.no/python/tlsimap.py

Example of usage:
import imaptls
imap = imaptls.IMAP4('hostname')
imap.starttls(keyfile=None, certfile=None)

# create a simple function for our PLAIN login
def sendAuth(response):
return "user\0auth\0password"

typ, data = imap.authenticate("PLAIN", sendAuth)

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view



signature.asc
Description: This is a digitally signed message part


Re: subscribing to folders

2004-07-27 Thread Alexander Brill
On Tue, 2004-07-27 at 16:26, Luca Olivetti wrote:
> Alexander Brill wrote:
> 
> > On Fri, 2004-07-23 at 15:46, Rob Siemborski wrote:
> > 
> >>On Thu, 22 Jul 2004, Alexander Brill wrote:
> >>
> >>
> >>>Is it possible to force subscribtion of a folder to another user by
> >>>using the admin-user? I couldn't find any info about it in the docs and
> >>>RFCs.
> >>
> >>If you use proxy authentication, then you can authenticate as the admin 
> >>but authorize as the user, and then subscribe them to the folder.
> > 
> > 
> > Could you reference me to some rfc's or other docs on the subject? I
> > tried the PROXYAUTH-command (comes with python imaplib), but it wasn't
> > recognized as a command on my server.
> 
> PROXYAUTH is a non standard command:
> http://www.washington.edu/imap/listarch/2000/msg00215.html
> (follow the thread).
> 
> The right thing to do is use the authenticate method, unfortunately it's 
> not implemented in python imaplib. I don't understand why the imaplib 
> developer(s) implemented the nonstandard command instead of the standard 
> one.
> 

The newest python imaplib has authenticate implemented, finally. But I
have to wrap it around TLS as well, so I'll have to look into that.
There goes my quick and dirty hack to force people to subscribe to a
folder.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view


signature.asc
Description: This is a digitally signed message part


Re: subscribing to folders

2004-07-27 Thread Alexander Brill
On Tue, 2004-07-27 at 16:12, Rob Siemborski wrote:
> On Tue, 27 Jul 2004, Alexander Brill wrote:
> 
> >> Huh?  You just use the IMAP AUTHENTICATE command and a SASL mechanism that
> >> supports separate authroization and authentication IDs. (see -a and -u
> >> options to imtest, for example)
> >
> > I tried fiddling around a bit with the AUTHENTICATE-command. But for
> > some reason I don't have an AUTH field in my CAPABILITES response, so
> > therefore I couldn't examine it further (odd?).
> 
> Do you only support plaintext mechanisms?  These won't be advertised 
> unless you are under a TLS layer.

Yes, I am, cyrus.conf:
sasl_mech_list: PLAIN

But when I try to 'AUTHENTICATE PLAIN', I receive 'NO, no mechanism
available'. What am I missing here?

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view



signature.asc
Description: This is a digitally signed message part


Re: subscribing to folders

2004-07-27 Thread Alexander Brill
On Tue, 2004-07-27 at 14:59, Rob Siemborski wrote:
> On Tue, 27 Jul 2004, Alexander Brill wrote:
> 
> > On Fri, 2004-07-23 at 15:46, Rob Siemborski wrote:
> >> On Thu, 22 Jul 2004, Alexander Brill wrote:
> >>
> >>> Is it possible to force subscribtion of a folder to another user by
> >>> using the admin-user? I couldn't find any info about it in the docs and
> >>> RFCs.
> >>
> >> If you use proxy authentication, then you can authenticate as the admin
> >> but authorize as the user, and then subscribe them to the folder.
> >
> > Could you reference me to some rfc's or other docs on the subject? I
> > tried the PROXYAUTH-command (comes with python imaplib), but it wasn't
> > recognized as a command on my server.
> 
> Huh?  You just use the IMAP AUTHENTICATE command and a SASL mechanism that 
> supports separate authroization and authentication IDs. (see -a and -u 
> options to imtest, for example)

I tried fiddling around a bit with the AUTHENTICATE-command. But for
some reason I don't have an AUTH field in my CAPABILITES response, so
therefore I couldn't examine it further (odd?).


-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view



signature.asc
Description: This is a digitally signed message part


Re: subscribing to folders

2004-07-27 Thread Alexander Brill
On Fri, 2004-07-23 at 15:46, Rob Siemborski wrote:
> On Thu, 22 Jul 2004, Alexander Brill wrote:
> 
> > Is it possible to force subscribtion of a folder to another user by
> > using the admin-user? I couldn't find any info about it in the docs and
> > RFCs.
> 
> If you use proxy authentication, then you can authenticate as the admin 
> but authorize as the user, and then subscribe them to the folder.

Could you reference me to some rfc's or other docs on the subject? I
tried the PROXYAUTH-command (comes with python imaplib), but it wasn't
recognized as a command on my server.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view



signature.asc
Description: This is a digitally signed message part


subscribing to folders

2004-07-22 Thread Alexander Brill
Is it possible to force subscribtion of a folder to another user by
using the admin-user? I couldn't find any info about it in the docs and
RFCs.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view


signature.asc
Description: This is a digitally signed message part


Re: delivering to all users

2003-10-29 Thread Alexander Brill
On Wed, 2003-10-29 at 16:24, Rob Siemborski wrote:
> On Wed, 29 Oct 2003, Alexander Brill wrote:
> 
> > Is there an easy way to deliver a message to all my users? Would be
> > handy in sending out system messages.
> 
> This is an MTA level thing, but there are a few ways to generate a list of
> all your users to mail to.
> 
> (one is to log into cyrus as an admin, and issue 'x LIST "" "user.%"')
> 
> You can probably do this with a simple cyradm script to get the results
> you need.


Yeah.. I wrote a quick python-script to do it all. I attached it in case
anyone else would like the same thing.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view
import imaplib, sys
"""
A script to get all mailboxes and deliver a message to them. Useful for sending out system messages.

Alexander Brill <[EMAIL PROTECTED]>
"""


class Imap:
	def __init__(self, username, password, host):
		self.imap = imaplib.IMAP4(host)
		self.imap.login(username,password)

	def getUsers(self):
		""" Returns a list of users. """
		users = []
		status, data = self.imap.list(pattern='"user.\%"')
		if not status == "OK":
			return None
		for user in data:
			users.append(user.split()[2].replace('"',"").replace("user.",""))
		return users

	def append(self, user, message):
		""" Append message to the user's mailbox"""
		user = "user.%s" % user
		status, data = self.imap.append(user, None, None, message)
		return status,data

if __name__ == "__main__":
	if not len(sys.argv) == 5:
		print "Usage: %s" % sys.argv[0]
		sys.exit(1)
	username = sys.argv[1]
	password = sys.argv[2]
	hostname = sys.argv[3]
	msg = open(sys.argv[4], "r").read()
	imap = Imap(username, password, hostname)
	users = imap.getUsers()
	if users:
		print "Sending message to %d users:" % len(users)
		for user in users:
			status, data = imap.append(user, msg)
			if status == "OK":
data = ""
			print user, status, data


signature.asc
Description: This is a digitally signed message part


delivering to all users

2003-10-29 Thread Alexander Brill
Is there an easy way to deliver a message to all my users? Would be
handy in sending out system messages.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/firma/Library/PGP/alex_pgp/view


signature.asc
Description: This is a digitally signed message part


Re: sieve vacation problems

2003-07-05 Thread Alexander Brill
On Thu, 2003-07-03 at 13:41, Alexander Brill wrote:
> I am having some problems related to sieve and its vacation module. It
> just won't send out to the right recipient, but it tries to send it to
> [EMAIL PROTECTED] This is what I get in my logs:

I solved the problem by using LMTP as the transport.

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/pgp/alexander.brill.asc


signature.asc
Description: This is a digitally signed message part


sieve vacation problems

2003-07-03 Thread Alexander Brill
I am having some problems related to sieve and its vacation module. It
just won't send out to the right recipient, but it tries to send it to
[EMAIL PROTECTED] This is what I get in my logs:

Jul  3 10:48:25 tarkan postfix/smtpd[13027]: 15CEB3FA05: client=localhost[127.0.0.1]
Jul  3 10:48:25 tarkan postfix/cleanup[13046]: 15CEB3FA05: message-id=<[EMAIL 
PROTECTED]>
Jul  3 10:48:25 tarkan postfix/smtpd[13027]: disconnect from localhost[127.0.0.1]
Jul  3 10:48:25 tarkan postfix/qmgr[14206]: 15CEB3FA05: from=<>, size=1436, nrcpt=1 
(queue active)
Jul  3 10:48:25 tarkan amavis[12936]: (12936-01) Passed, (?) -> <[EMAIL PROTECTED]>, 
Message-I
D: <[EMAIL PROTECTED]>
Jul  3 10:48:25 tarkan postfix/smtp[13022]: 9215E3FB50: to=<[EMAIL PROTECTED]>, 
orig_to=, relay=127.0.0.1[127.0.0.1], delay=1, status=sent (250 2.6.0 Ok, 
id=12936-01, from MTA: 250 Ok
: queued as 15CEB3FA05)
Jul  3 10:48:26 tarkan postfix/smtp[13050]: 15CEB3FA05: to=<[EMAIL PROTECTED]>, 
relay=mail.onl
ine.no[148.122.161.36], delay=1, status=sent (250 KAA05768 Message accepted for 
delivery)

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/pgp/alexander.brill.asc


signature.asc
Description: This is a digitally signed message part


Re: internaldate

2003-04-04 Thread Alexander Brill
On Wed, 2003-04-02 at 16:55, Ken Murchison wrote:
> Alexander Brill wrote:
> > 
> > I am trying to set the internaldate for a message, but it doesn't store
> > properly.
> > 
> > This is what I try (using python)
> > imap.store(1,"+FLAGS","INTERNALDATE 22-Mar-2003 02:10:31 +0100")
> > > ('OK', ['1 (FLAGS (INTERNALDATE 22-Mar-2003 02:10:31 +0100))'])
> > It replies with an OK (prefixed with an >), and that the INTERNALDATE
> > has been altered.
> > 
> > But when I try to fetch the same message it tells me that the
> > INTERNALDATE is:
> > ('OK', ['1 (INTERNALDATE "25-Mar-2003 02:10:31 +0100")'])
> > 
> > So it doesn't store the values, even though it returns an OK. Any hints?
> 
> You can't change INTERNALDATE with STORE, only flags can be changed (see
> sec 6.4.6 of RFC 3501).  Typically, INTERNALDATE is a read-only
> attribute which is set when a message gets stored in a mailbox, either
> by SMTP/LMTP, COPY or APPEND (see sec 2.3.3 of RFC 3501).

Is there some other way of setting it then? I have a bunch of mails
dated the 25 of March :)

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://www.nettstudio.no/pgp/alexander.brill.asc


signature.asc
Description: This is a digitally signed message part


internaldate

2003-04-02 Thread Alexander Brill
I am trying to set the internaldate for a message, but it doesn't store
properly.

This is what I try (using python)
imap.store(1,"+FLAGS","INTERNALDATE 22-Mar-2003 02:10:31 +0100")
> ('OK', ['1 (FLAGS (INTERNALDATE 22-Mar-2003 02:10:31 +0100))'])
It replies with an OK (prefixed with an >), and that the INTERNALDATE
has been altered.

But when I try to fetch the same message it tells me that the
INTERNALDATE is:
('OK', ['1 (INTERNALDATE "25-Mar-2003 02:10:31 +0100")'])

So it doesn't store the values, even though it returns an OK. Any hints?

-- 
Alexander Brill <[EMAIL PROTECTED]>
http://www.project23.no
PGP-key: http://alexb.egil.org/key.pub


signature.asc
Description: This is a digitally signed message part