Commit 512eb061 authored by Joanne Hugé's avatar Joanne Hugé

WIP: lua

parent abf49ff3
# Dovecot
# https://doc.dovecot.org/
[buildout]
extends =
../lua/buildout.cfg
[dovecot]
recipe = slapos.recipe.cmmi
url = https://dovecot.org/releases/2.3/dovecot-2.3.20.tar.gz
......@@ -10,5 +14,11 @@ configure-options =
--prefix=${:location}
--exec-prefix=${:location}
--with-systemd=no
--with-lua=yes
environment =
PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${lua:location}/lib/pkgconfig
LUA_LIBS="-L${lua:location}/lib -Wl,-rpath=${lua:location}/lib -llua -lm"
LUA_CFLAGS="-I${lua:location}/include"
make-targets = install
post-install = cp -r ${:location}/share/doc/dovecot/example-config/* ${:location}/etc/dovecot/
......@@ -28,3 +28,27 @@ pc =
Version: $${version}
Libs: -L$${libdir} -llua
Cflags: -I$${includedir}
[lua5.2]
recipe = slapos.recipe.cmmi
shared = true
url = http://www.lua.org/ftp/lua-5.2.3.tar.gz
md5sum = dc7f94ec6ff15c985d2d6ad0f1b35654
configure-command = true
make-options =
"$(uname -sr 2>/dev/null|grep -Eq '^Linux' && echo linux || echo posix)"
MYCFLAGS="-I${readline:location}/include -fPIC"
MYLDFLAGS="-L${readline:location}/lib -Wl,-rpath=${readline:location}/lib"
INSTALL_TOP=@@LOCATION@@
post-install =
mkdir -p %(location)s/lib/pkgconfig
{
make pc INSTALL_TOP=%(location)s
echo '%(pc)s'
} > %(location)s/lib/pkgconfig/lua.pc
pc =
Name: Lua
Description: Lua language engine
Version: $${version}
Libs: -L$${libdir} -llua
Cflags: -I$${includedir}
......@@ -15,22 +15,25 @@
[template]
filename = instance.cfg.in
md5sum = 5ded78c210ad723606f808165fe10be6
md5sum = 06e676a14d64c2aa394bab2849aff687
[template-default]
_update_hash_filename_ = instance-default.cfg.in
md5sum = 5c478f96bfb447059f8599bca65745e3
md5sum = 8b5f29e2ae0b6ae846530e6f170d8868
[dovecot.jinja2.conf]
_update_hash_filename_ = dovecot.jinja2.conf
md5sum = abfb5606d5af39b1a6682919129708d0
md5sum = 9bf03ace9c104b8d566e782a6578561e
[dovecot-passwd.jinja2]
_update_hash_filename_ = dovecot-passwd.jinja2
md5sum = b4f2be65faad8194fd0a1e5ccb157c8e
md5sum = 9e895c044984534a330328329b8b8462
[dovecot-passdb.jinja2.lua]
_update_hash_filename_ = dovecot-passdb.jinja2.lua
md5sum = 72dbac7b1c282c83ab761efd0770082e
[postfix_main.jinja2.cf]
_update_hash_filename_ = postfix_main.jinja2.cf
md5sum = 6f13224d48a8d7a3e865142ec99bd2ea
md5sum = ab88b1d1661d9ae9f7a2032101bdef75
[postfix_master.jinja2.cf]
_update_hash_filename_ = postfix_master.jinja2.cf
md5sum = 7752a8b4af5c18dc404e0a862af89272
......
function auth_passdb_lookup(req)
if req.user == "alpha" then
return dovecot.auth.PASSDB_RESULT_OK, "password=pass"
end
return dovecot.auth.PASSDB_RESULT_USER_UNKNOWN, "no such user"
end
function script_init()
return 0
end
function script_deinit()
end
function auth_userdb_iterate()
return {"alpha"}
end
alpha:{PLAIN}ors123
bravo:{PLAIN}ors123
charlie:{PLAIN}ors123
delta:{PLAIN}ors123
......@@ -78,9 +78,13 @@ namespace inbox {
ssl = no
# passdb {
# args = {{ dovecot_passwd }}
# driver = passwd-file
# }
passdb {
args = {{ dovecot_passwd }}
driver = passwd-file
driver = lua
args = file={{ dovecot_passdb_lua }} blocking=yes
}
userdb {
driver = static
......
......@@ -68,6 +68,7 @@ url = {{ dovecot_conf_template }}
output = ${directory:etc}/dovecot.conf
extra-context =
key dovecot_passwd dovecot-passwd:output
key dovecot_passdb_lua dovecot-passdb-lua:output
raw postfix_auth ${directory:var-spool-postfix-private}/auth
raw postfix_dovecot_lmtp ${directory:var-spool-postfix-private}/dovecot-lmtp
......@@ -75,6 +76,10 @@ extra-context =
<= config-base
url = {{ dovecot_passwd_template }}
output = ${directory:etc}/dovecot-passwd
[dovecot-passdb-lua]
<= config-base
url = {{ dovecot_passdb_lua_template }}
output = ${directory:etc}/dovecot-passdb.lua
[userinfo]
recipe = slapos.cookbook:userinfo
......
......@@ -23,6 +23,7 @@ context =
raw template_monitor ${monitor2-template:output}
raw dovecot_conf_template ${dovecot.jinja2.conf:target}
raw dovecot_passwd_template ${dovecot-passwd.jinja2:target}
raw dovecot_passdb_lua_template ${dovecot-passdb.jinja2.lua:target}
raw dovecot_binary ${dovecot:location}/sbin/dovecot
raw postfix_main_template ${postfix_main.jinja2.cf:target}
raw postfix_master_template ${postfix_master.jinja2.cf:target}
......
......@@ -34,6 +34,8 @@ filename = ${:_buildout_section_name_}
< = copy-to-instance
[dovecot-passwd.jinja2]
< = copy-to-instance
[dovecot-passdb.jinja2.lua]
< = copy-to-instance
[postfix_main.jinja2.cf]
< = copy-to-instance
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment