summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rwxr-xr-xpkg/mx.tac84
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.pubbin2779 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.secbin5453 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.pubbin2779 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.secbin5453 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.pubbin2779 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.secbin5453 -> 0 bytes
-rw-r--r--pkg/utils/gpg-keys/gpg-batch-key-script45
8 files changed, 84 insertions, 45 deletions
diff --git a/pkg/mx.tac b/pkg/mx.tac
new file mode 100755
index 0000000..cdebba7
--- /dev/null
+++ b/pkg/mx.tac
@@ -0,0 +1,84 @@
+# -*- encoding: utf-8 -*-
+# mx.tac
+# Copyright (C) 2013 LEAP
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import ConfigParser
+
+from functools import partial
+
+from leap.mx import couchdbhelper
+from leap.mx.mail_receiver import MailReceiver
+from leap.mx.alias_resolver import AliasResolverFactory
+from leap.mx.check_recipient_access import CheckRecipientAccessFactory
+
+try:
+ from twisted.application import service, internet
+ from twisted.internet import inotify
+ from twisted.internet.endpoints import TCP4ServerEndpoint
+ from twisted.python import filepath, log
+ from twisted.python import usage
+except ImportError, ie:
+ print "This software requires Twisted>=12.0.2, please see the README for"
+ print "help on using virtualenv and pip to obtain requirements."
+
+config_file = "/etc/leap/mx.conf"
+
+config = ConfigParser.ConfigParser()
+config.read(config_file)
+
+user = config.get("couchdb", "user")
+password = config.get("couchdb", "password")
+
+server = config.get("couchdb", "server")
+port = config.get("couchdb", "port")
+
+alias_port = config.getint("alias map", "port")
+check_recipient_port = config.getint("check recipient", "port")
+
+cdb = couchdbhelper.ConnectedCouchDB(server,
+ port=port,
+ dbName="users",
+ username=user,
+ password=password)
+
+
+application = service.Application("LEAP MX")
+
+# Alias map
+alias_map = internet.TCPServer(alias_port, AliasResolverFactory(couchdb=cdb))
+alias_map.setServiceParent(application)
+
+# Check recipient access
+check_recipient = internet.TCPServer(check_recipient_port,
+ CheckRecipientAccessFactory(couchdb=cdb))
+check_recipient.setServiceParent(application)
+
+# Mail receiver
+mail_couch_url_prefix = "http://%s:%s@%s:%s" % (user,
+ password,
+ server,
+ port)
+directories = []
+for section in config.sections():
+ if section in ("couchdb", "alias map", "check recipient"):
+ continue
+ to_watch = config.get(section, "path")
+ recursive = config.getboolean(section, "recursive")
+ directories.append([to_watch, recursive])
+
+mr = MailReceiver(mail_couch_url_prefix, cdb, directories)
+mr.setServiceParent(application)
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.pub b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.pub
deleted file mode 100644
index 1c8fd34..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.pub
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.sec b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.sec
deleted file mode 100644
index 97a60e7..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-001.sec
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.pub b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.pub
deleted file mode 100644
index 1cbf8d8..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.pub
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.sec b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.sec
deleted file mode 100644
index f89cd97..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-002.sec
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.pub b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.pub
deleted file mode 100644
index bc0ac12..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.pub
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.sec b/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.sec
deleted file mode 100644
index 397f44a..0000000
--- a/pkg/utils/gpg-keys/generated-2013-02-15_19-15-003.sec
+++ /dev/null
Binary files differ
diff --git a/pkg/utils/gpg-keys/gpg-batch-key-script b/pkg/utils/gpg-keys/gpg-batch-key-script
deleted file mode 100644
index 7e48db0..0000000
--- a/pkg/utils/gpg-keys/gpg-batch-key-script
+++ /dev/null
@@ -1,45 +0,0 @@
-%echo Generating keypair 001/003...
-Key-Type: RSA
-Key-Length: 4096
-Subkey-Type: RSA
-Subkey-Length: 4096
-Name-Real: Louis Lingg
-Name-Email: blackhole@leap.se
-Name-Comment: Test Key 001/003
-Expire-Date: 2013-03-15
-Passphrase: leap
-%pubring generated-2013-02-15_19-15-001.pub
-%secring generated-2013-02-15_19-15-001.sec
-%commit
-%echo done. 001 keys out of 003 completed.
-
-%echo Generating keypair 002/003...
-Key-Type: RSA
-Key-Length: 4096
-Subkey-Type: RSA
-Subkey-Length: 4096
-Name-Real: Louis Lingg
-Name-Email: blackhole@leap.se
-Name-Comment: Test Key 002/003
-Expire-Date: 2013-03-15
-Passphrase: leap
-%pubring generated-2013-02-15_19-15-002.pub
-%secring generated-2013-02-15_19-15-002.sec
-%commit
-%echo done. 002 keys out of 003 completed.
-
-%echo Generating keypair 003/003...
-Key-Type: RSA
-Key-Length: 4096
-Subkey-Type: RSA
-Subkey-Length: 4096
-Name-Real: Louis Lingg
-Name-Email: blackhole@leap.se
-Name-Comment: Test Key 003/003
-Expire-Date: 2013-03-15
-Passphrase: leap
-%pubring generated-2013-02-15_19-15-003.pub
-%secring generated-2013-02-15_19-15-003.sec
-%commit
-%echo done. 003 keys out of 003 completed.
-