├── .clang-format ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Makefile ├── README.md ├── Rakefile ├── dovecot ├── configuration │ ├── conf.d │ │ ├── 10-auth.conf │ │ ├── 10-director.conf │ │ ├── 10-logging.conf.erb │ │ ├── 10-mail.conf │ │ ├── 10-master.conf.erb │ │ ├── 10-ssl.conf │ │ ├── 15-lda.conf │ │ ├── 15-mailboxes.conf │ │ ├── 20-imap.conf │ │ ├── 20-lmtp.conf │ │ ├── 20-pop3.conf │ │ ├── 90-acl.conf │ │ ├── 90-plugin.conf │ │ ├── 90-quota.conf │ │ ├── 95-mruby.conf │ │ ├── 95-mruby.conf.erb │ │ ├── auth-checkpassword.conf.ext │ │ ├── auth-deny.conf.ext │ │ ├── auth-dict.conf.ext │ │ ├── auth-ldap.conf.ext │ │ ├── auth-master.conf.ext │ │ ├── auth-passwdfile.conf.ext.erb │ │ ├── auth-sql.conf.ext │ │ ├── auth-sql.conf.ext.erb │ │ ├── auth-static.conf.ext │ │ ├── auth-system.conf.ext │ │ └── auth-vpopmail.conf.ext │ ├── dovecot-sql.conf.ext.erb │ ├── dovecot.conf.erb │ ├── mailservice.sqlite │ ├── mruby_handler │ │ ├── command_register.rb │ │ └── pre_post_capability.rb │ └── passwd ├── home │ └── test │ │ └── .gitkeep ├── log │ └── .gitkeep └── script │ ├── mail-filter-out.sh │ └── mail-filter.sh ├── misc ├── apply-clang-format └── update-subtree ├── spec ├── fixtures │ ├── mail-1.eml │ ├── mail-2.eml │ ├── mail-3.eml │ └── mail-4.eml ├── helper.rb ├── integration │ ├── imap_session_spec.rb │ ├── normal_mail_spec.rb │ └── test_spec.rb.tmpl └── lib │ ├── administrator.rb │ ├── database.rb │ ├── mailer.rb │ ├── mailer │ ├── imap.rb │ ├── imap │ │ └── session.rb │ └── lmtp.rb │ └── storage.rb ├── src ├── build_config.rb ├── imap-mruby-plugin-imap.c ├── imap-mruby-plugin-imap.h ├── imap-mruby-plugin-init.c ├── imap-mruby-plugin-init.h ├── imap-mruby-plugin.c ├── imap-mruby-plugin.h └── mruby │ ├── .gitignore │ ├── .gitlab-ci.yml │ ├── .travis.yml │ ├── .yardopts │ ├── AUTHORS │ ├── CONTRIBUTING.md │ ├── LEGAL │ ├── MITL │ ├── Makefile │ ├── NEWS │ ├── README.md │ ├── Rakefile │ ├── TODO │ ├── appveyor.yml │ ├── appveyor_config.rb │ ├── benchmark │ ├── bm_ao_render.rb │ ├── bm_app_lc_fizzbuzz.rb │ ├── bm_fib.rb │ ├── bm_so_lists.rb │ ├── build_config_boxing.rb │ ├── build_config_cc.rb │ └── plot.gpl │ ├── bin │ └── .gitkeep │ ├── build_config.rb │ ├── doc │ ├── guides │ │ ├── compile.md │ │ ├── debugger.md │ │ ├── gc-arena-howto.md │ │ ├── mrbconf.md │ │ └── mrbgems.md │ └── limitations.md │ ├── examples │ ├── mrbgems │ │ ├── c_and_ruby_extension_example │ │ │ ├── README.md │ │ │ ├── mrbgem.rake │ │ │ ├── mrblib │ │ │ │ └── example.rb │ │ │ ├── src │ │ │ │ └── example.c │ │ │ └── test │ │ │ │ └── example.rb │ │ ├── c_extension_example │ │ │ ├── README.md │ │ │ ├── mrbgem.rake │ │ │ ├── src │ │ │ │ └── example.c │ │ │ └── test │ │ │ │ ├── example.c │ │ │ │ └── example.rb │ │ └── ruby_extension_example │ │ │ ├── README.md │ │ │ ├── mrbgem.rake │ │ │ ├── mrblib │ │ │ └── example.rb │ │ │ └── test │ │ │ └── example.rb │ └── targets │ │ ├── build_config_ArduinoDue.rb │ │ ├── build_config_IntelEdison.rb │ │ ├── build_config_IntelGalileo.rb │ │ ├── build_config_RX630.rb │ │ ├── build_config_android_arm64-v8a.rb │ │ ├── build_config_android_armeabi.rb │ │ ├── build_config_android_armeabi_v7a_neon_hard.rb │ │ └── build_config_chipKITMax32.rb │ ├── include │ ├── mrbconf.h │ ├── mruby.h │ └── mruby │ │ ├── array.h │ │ ├── boxing_nan.h │ │ ├── boxing_no.h │ │ ├── boxing_word.h │ │ ├── class.h │ │ ├── common.h │ │ ├── compile.h │ │ ├── data.h │ │ ├── debug.h │ │ ├── dump.h │ │ ├── error.h │ │ ├── gc.h │ │ ├── hash.h │ │ ├── irep.h │ │ ├── istruct.h │ │ ├── khash.h │ │ ├── numeric.h │ │ ├── object.h │ │ ├── opcode.h │ │ ├── proc.h │ │ ├── range.h │ │ ├── re.h │ │ ├── string.h │ │ ├── throw.h │ │ ├── value.h │ │ ├── variable.h │ │ └── version.h │ ├── lib │ ├── mruby-core-ext.rb │ └── mruby │ │ ├── build.rb │ │ ├── build │ │ ├── command.rb │ │ └── load_gems.rb │ │ ├── gem.rb │ │ └── source.rb │ ├── minirake │ ├── mrbgems │ ├── default.gembox │ ├── full-core.gembox │ ├── mruby-array-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── array.rb │ │ ├── src │ │ │ └── array.c │ │ └── test │ │ │ └── array.rb │ ├── mruby-bin-debugger │ │ ├── bintest │ │ │ ├── mrdb.rb │ │ │ └── print.rb │ │ ├── mrbgem.rake │ │ └── tools │ │ │ └── mrdb │ │ │ ├── apibreak.c │ │ │ ├── apibreak.h │ │ │ ├── apilist.c │ │ │ ├── apilist.h │ │ │ ├── apiprint.c │ │ │ ├── apiprint.h │ │ │ ├── cmdbreak.c │ │ │ ├── cmdmisc.c │ │ │ ├── cmdprint.c │ │ │ ├── cmdrun.c │ │ │ ├── mrdb.c │ │ │ ├── mrdb.h │ │ │ ├── mrdbconf.h │ │ │ └── mrdberror.h │ ├── mruby-bin-mirb │ │ ├── bintest │ │ │ └── mirb.rb │ │ ├── mrbgem.rake │ │ └── tools │ │ │ └── mirb │ │ │ └── mirb.c │ ├── mruby-bin-mrbc │ │ ├── mrbgem.rake │ │ └── tools │ │ │ └── mrbc │ │ │ └── mrbc.c │ ├── mruby-bin-mruby-config │ │ ├── mrbgem.rake │ │ ├── mruby-config │ │ └── mruby-config.bat │ ├── mruby-bin-mruby │ │ ├── bintest │ │ │ └── mruby.rb │ │ ├── mrbgem.rake │ │ └── tools │ │ │ └── mruby │ │ │ └── mruby.c │ ├── mruby-bin-strip │ │ ├── bintest │ │ │ └── mruby-strip.rb │ │ ├── mrbgem.rake │ │ └── tools │ │ │ └── mruby-strip │ │ │ └── mruby-strip.c │ ├── mruby-class-ext │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── class.c │ │ └── test │ │ │ └── module.rb │ ├── mruby-compar-ext │ │ ├── mrbgem.rake │ │ └── mrblib │ │ │ └── compar.rb │ ├── mruby-compiler │ │ ├── bintest │ │ │ └── mrbc.rb │ │ ├── core │ │ │ ├── codegen.c │ │ │ ├── keywords │ │ │ ├── lex.def │ │ │ ├── node.h │ │ │ └── parse.y │ │ └── mrbgem.rake │ ├── mruby-enum-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── enum.rb │ │ └── test │ │ │ └── enum.rb │ ├── mruby-enum-lazy │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── lazy.rb │ │ └── test │ │ │ └── lazy.rb │ ├── mruby-enumerator │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── enumerator.rb │ │ └── test │ │ │ └── enumerator.rb │ ├── mruby-error │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── exception.c │ │ └── test │ │ │ ├── exception.c │ │ │ └── exception.rb │ ├── mruby-eval │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── eval.c │ │ └── test │ │ │ └── eval.rb │ ├── mruby-exit │ │ ├── mrbgem.rake │ │ └── src │ │ │ └── mruby-exit.c │ ├── mruby-fiber │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── fiber.c │ │ └── test │ │ │ └── fiber.rb │ ├── mruby-hash-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── hash.rb │ │ ├── src │ │ │ └── hash-ext.c │ │ └── test │ │ │ └── hash.rb │ ├── mruby-inline-struct │ │ ├── mrbgem.rake │ │ └── test │ │ │ ├── inline.c │ │ │ └── inline.rb │ ├── mruby-io │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── include │ │ │ └── mruby │ │ │ │ └── ext │ │ │ │ └── io.h │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ ├── file.rb │ │ │ ├── file_constants.rb │ │ │ ├── io.rb │ │ │ └── kernel.rb │ │ ├── run_test.rb │ │ ├── src │ │ │ ├── file.c │ │ │ ├── file_test.c │ │ │ ├── io.c │ │ │ └── mruby_io_gem.c │ │ └── test │ │ │ ├── file.rb │ │ │ ├── file_test.rb │ │ │ ├── gc_filedes.sh │ │ │ ├── io.rb │ │ │ └── mruby_io_test.c │ ├── mruby-kernel-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── kernel.rb │ │ ├── src │ │ │ └── kernel.c │ │ └── test │ │ │ └── kernel.rb │ ├── mruby-math │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── math.c │ │ └── test │ │ │ └── math.rb │ ├── mruby-method │ │ ├── README.md │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ ├── kernel.rb │ │ │ ├── method.rb │ │ │ └── unbound_method.rb │ │ ├── src │ │ │ └── method.c │ │ └── test │ │ │ └── method.rb │ ├── mruby-numeric-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── numeric_ext.rb │ │ ├── src │ │ │ └── numeric_ext.c │ │ └── test │ │ │ └── numeric.rb │ ├── mruby-object-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── object.rb │ │ ├── src │ │ │ └── object.c │ │ └── test │ │ │ ├── nil.rb │ │ │ └── object.rb │ ├── mruby-objectspace │ │ ├── mrbgem.rake │ │ ├── src │ │ │ └── mruby_objectspace.c │ │ └── test │ │ │ └── objectspace.rb │ ├── mruby-pack │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── mrbgem.rake │ │ ├── packtest.rb │ │ ├── run_test.rb │ │ ├── src │ │ │ └── pack.c │ │ └── test │ │ │ └── pack.rb │ ├── mruby-print │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── print.rb │ │ └── src │ │ │ └── print.c │ ├── mruby-proc-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── proc.rb │ │ ├── src │ │ │ └── proc.c │ │ └── test │ │ │ ├── proc.c │ │ │ └── proc.rb │ ├── mruby-random │ │ ├── mrbgem.rake │ │ ├── src │ │ │ ├── mt19937ar.c │ │ │ ├── mt19937ar.h │ │ │ ├── random.c │ │ │ └── random.h │ │ └── test │ │ │ └── random.rb │ ├── mruby-range-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── range.rb │ │ ├── src │ │ │ └── range.c │ │ └── test │ │ │ └── range.rb │ ├── mruby-socket │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── socket.rb │ │ ├── run_test.rb │ │ ├── src │ │ │ ├── const.cstub │ │ │ ├── const.def │ │ │ ├── gen.rb │ │ │ └── socket.c │ │ └── test │ │ │ ├── addrinfo.rb │ │ │ ├── basicsocket.rb │ │ │ ├── ipsocket.rb │ │ │ ├── socket.rb │ │ │ ├── sockettest.c │ │ │ ├── tcpsocket.rb │ │ │ ├── udpsocket.rb │ │ │ └── unix.rb │ ├── mruby-sprintf │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── string.rb │ │ ├── src │ │ │ ├── kernel.c │ │ │ └── sprintf.c │ │ └── test │ │ │ └── sprintf.rb │ ├── mruby-string-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── string.rb │ │ ├── src │ │ │ └── string.c │ │ └── test │ │ │ └── string.rb │ ├── mruby-struct │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── struct.rb │ │ ├── src │ │ │ └── struct.c │ │ └── test │ │ │ └── struct.rb │ ├── mruby-symbol-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── symbol.rb │ │ ├── src │ │ │ └── symbol.c │ │ └── test │ │ │ └── symbol.rb │ ├── mruby-test │ │ ├── README.md │ │ ├── driver.c │ │ ├── init_mrbtest.c │ │ └── mrbgem.rake │ ├── mruby-time │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ │ └── time.rb │ │ ├── src │ │ │ └── time.c │ │ └── test │ │ │ └── time.rb │ └── mruby-toplevel-ext │ │ ├── mrbgem.rake │ │ ├── mrblib │ │ └── toplevel.rb │ │ └── test │ │ └── toplevel.rb │ ├── mrblib │ ├── 00class.rb │ ├── 10error.rb │ ├── array.rb │ ├── compar.rb │ ├── enum.rb │ ├── float.rb │ ├── hash.rb │ ├── init_mrblib.c │ ├── kernel.rb │ ├── mrblib.rake │ ├── numeric.rb │ ├── range.rb │ └── string.rb │ ├── mruby-source.gemspec │ ├── src │ ├── array.c │ ├── backtrace.c │ ├── class.c │ ├── codedump.c │ ├── compar.c │ ├── crc.c │ ├── debug.c │ ├── dump.c │ ├── enum.c │ ├── error.c │ ├── error.h │ ├── etc.c │ ├── ext │ │ └── .gitkeep │ ├── fmt_fp.c │ ├── gc.c │ ├── hash.c │ ├── init.c │ ├── kernel.c │ ├── load.c │ ├── mruby_core.rake │ ├── numeric.c │ ├── object.c │ ├── opcode.h │ ├── pool.c │ ├── print.c │ ├── proc.c │ ├── range.c │ ├── state.c │ ├── string.c │ ├── symbol.c │ ├── value_array.h │ ├── variable.c │ ├── version.c │ └── vm.c │ ├── tasks │ ├── benchmark.rake │ ├── gitlab.rake │ ├── libmruby.rake │ ├── mrbgems.rake │ └── toolchains │ │ ├── android.rake │ │ ├── clang.rake │ │ ├── gcc.rake │ │ ├── openwrt.rake │ │ └── visualcpp.rake │ ├── test │ ├── assert.rb │ ├── bintest.rb │ ├── report.rb │ └── t │ │ ├── argumenterror.rb │ │ ├── array.rb │ │ ├── basicobject.rb │ │ ├── bs_block.rb │ │ ├── bs_literal.rb │ │ ├── class.rb │ │ ├── codegen.rb │ │ ├── comparable.rb │ │ ├── ensure.rb │ │ ├── enumerable.rb │ │ ├── exception.rb │ │ ├── false.rb │ │ ├── float.rb │ │ ├── gc.rb │ │ ├── hash.rb │ │ ├── indexerror.rb │ │ ├── integer.rb │ │ ├── iterations.rb │ │ ├── kernel.rb │ │ ├── lang.rb │ │ ├── literals.rb │ │ ├── localjumperror.rb │ │ ├── methods.rb │ │ ├── module.rb │ │ ├── nameerror.rb │ │ ├── nil.rb │ │ ├── nomethoderror.rb │ │ ├── numeric.rb │ │ ├── object.rb │ │ ├── proc.rb │ │ ├── range.rb │ │ ├── rangeerror.rb │ │ ├── regexperror.rb │ │ ├── runtimeerror.rb │ │ ├── standarderror.rb │ │ ├── string.rb │ │ ├── superclass.rb │ │ ├── symbol.rb │ │ ├── syntax.rb │ │ ├── true.rb │ │ ├── typeerror.rb │ │ └── unicode.rb │ └── travis_config.rb └── task ├── dovecot.rb ├── lib └── context.rb └── spec.rb /.clang-format: -------------------------------------------------------------------------------- 1 | # requires clang-format >= 3.6 2 | BasedOnStyle: "LLVM" 3 | IndentWidth: 2 4 | ColumnLimit: 120 5 | BreakBeforeBraces: Linux 6 | AllowShortFunctionsOnASingleLine: None 7 | SortIncludes: false 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | .idea 3 | *.log 4 | *.o 5 | Makefile.deploy 6 | sudo.password 7 | attachment.* 8 | dovecot/*.tar.gz 9 | dovecot/*.tar.gz.sig 10 | dovecot/source 11 | dovecot/target 12 | dovecot/run 13 | dovecot/home/test/mail 14 | dovecot/staging 15 | dovecot/configuration/dovecot.conf 16 | dovecot/configuration/mailservice.sqlite 17 | dovecot/configuration/dovecot-sql.conf.ext 18 | dovecot/configuration/conf.d/10-master.conf 19 | dovecot/configuration/conf.d/10-logging.conf 20 | dovecot/configuration/conf.d/80-mailfilter.conf 21 | dovecot/configuration/conf.d/95-mruby.conf 22 | dovecot/configuration/conf.d/auth-passwdfile.conf.ext 23 | dovecot/configuration/conf.d/auth-sql.conf.ext 24 | vendor/ 25 | .bundle/ 26 | GPATH 27 | GRTAGS 28 | GTAGS 29 | 30 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: c 3 | compiler: 4 | - gcc 5 | sudo: false 6 | addons: 7 | apt: 8 | packages: 9 | - g++ 10 | - rake 11 | - bison 12 | - git 13 | - gperf 14 | - automake 15 | - m4 16 | - autoconf 17 | - libtool 18 | - cmake 19 | - pkg-config 20 | - libcunit1-dev 21 | - ragel 22 | script: 23 | - make setup 24 | - make mruby 25 | - make test 26 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 1. Fork it ( http://github.com/matsumotory/dovecot-mruby-plugin/fork ) 2 | 1. Create your feature branch (git checkout -b my-new-feature) 3 | 1. Commit your changes (git commit -am 'Add some feature') 4 | 1. Push to the branch (git push origin my-new-feature) 5 | 1. Create new Pull Request 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rake' 4 | gem 'facter' 5 | 6 | group :test do 7 | gem 'rspec' 8 | gem 'sqlite3' 9 | gem 'bcrypt-ruby' 10 | end 11 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | bcrypt (3.1.11) 5 | bcrypt-ruby (3.1.5) 6 | bcrypt (>= 3.1.3) 7 | diff-lcs (1.3) 8 | facter (2.5.1) 9 | rake (12.3.0) 10 | rspec (3.7.0) 11 | rspec-core (~> 3.7.0) 12 | rspec-expectations (~> 3.7.0) 13 | rspec-mocks (~> 3.7.0) 14 | rspec-core (3.7.1) 15 | rspec-support (~> 3.7.0) 16 | rspec-expectations (3.7.0) 17 | diff-lcs (>= 1.2.0, < 2.0) 18 | rspec-support (~> 3.7.0) 19 | rspec-mocks (3.7.0) 20 | diff-lcs (>= 1.2.0, < 2.0) 21 | rspec-support (~> 3.7.0) 22 | rspec-support (3.7.1) 23 | sqlite3 (1.3.13) 24 | 25 | PLATFORMS 26 | ruby 27 | 28 | DEPENDENCIES 29 | bcrypt-ruby 30 | facter 31 | rake 32 | rspec 33 | sqlite3 34 | 35 | BUNDLED WITH 36 | 1.16.0 37 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | Dir[ File.expand_path('task/*.rb', File.dirname(__FILE__)) ].each do |filename| 2 | p filename 3 | load filename 4 | end 5 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/10-director.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## Director-specific settings. 3 | ## 4 | 5 | # Director can be used by Dovecot proxy to keep a temporary user -> mail server 6 | # mapping. As long as user has simultaneous connections, the user is always 7 | # redirected to the same server. Each proxy server is running its own director 8 | # process, and the directors are communicating the state to each others. 9 | # Directors are mainly useful with NFS-like setups. 10 | 11 | # List of IPs or hostnames to all director servers, including ourself. 12 | # Ports can be specified as ip:port. The default port is the same as 13 | # what director service's inet_listener is using. 14 | #director_servers = 15 | 16 | # List of IPs or hostnames to all backend mail servers. Ranges are allowed 17 | # too, like 10.0.0.10-10.0.0.30. 18 | #director_mail_servers = 19 | 20 | # How long to redirect users to a specific server after it no longer has 21 | # any connections. 22 | #director_user_expire = 15 min 23 | 24 | # TCP/IP port that accepts doveadm connections (instead of director connections) 25 | # If you enable this, you'll also need to add inet_listener for the port. 26 | #director_doveadm_port = 0 27 | 28 | # How the username is translated before being hashed. Useful values include 29 | # %Ln if user can log in with or without @domain, %Ld if mailboxes are shared 30 | # within domain. 31 | #director_username_hash = %Lu 32 | 33 | # To enable director service, uncomment the modes and assign a port. 34 | service director { 35 | unix_listener login/director { 36 | #mode = 0666 37 | } 38 | fifo_listener login/proxy-notify { 39 | #mode = 0666 40 | } 41 | unix_listener director-userdb { 42 | #mode = 0600 43 | } 44 | inet_listener { 45 | #port = 46 | } 47 | } 48 | 49 | # Enable director for the wanted login services by telling them to 50 | # connect to director socket instead of the default login socket: 51 | service imap-login { 52 | #executable = imap-login director 53 | } 54 | service pop3-login { 55 | #executable = pop3-login director 56 | } 57 | 58 | # Enable director for LMTP proxying: 59 | protocol lmtp { 60 | #auth_socket_path = director-userdb 61 | } 62 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/10-ssl.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## SSL settings 3 | ## 4 | 5 | # SSL/TLS support: yes, no, required. 6 | ssl = no 7 | 8 | # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before 9 | # dropping root privileges, so keep the key file unreadable by anyone but 10 | # root. Included doc/mkcert.sh can be used to easily generate self-signed 11 | # certificate, just make sure to update the domains in dovecot-openssl.cnf 12 | #ssl_cert = . %d expands to recipient domain. 7 | postmaster_address = postmaster@posteo.de 8 | 9 | # Hostname to use in various parts of sent mails (e.g. in Message-Id) and 10 | # in LMTP replies. Default is the system's real hostname@domain. 11 | #hostname = 12 | 13 | # If user is over quota, return with temporary failure instead of 14 | # bouncing the mail. 15 | #quota_full_tempfail = no 16 | 17 | # Binary to use for sending mails. 18 | #sendmail_path = /usr/sbin/sendmail 19 | 20 | # If non-empty, send mails via this SMTP host[:port] instead of sendmail. 21 | #submission_host = 22 | 23 | # Subject: header to use for rejection mails. You can use the same variables 24 | # as for rejection_reason below. 25 | #rejection_subject = Rejected: %s 26 | 27 | # Human readable error message for rejection mails. You can use variables: 28 | # %n = CRLF, %r = reason, %s = original subject, %t = recipient 29 | #rejection_reason = Your message to <%t> was automatically rejected:%n%r 30 | 31 | # Delimiter character between local-part and detail in email address. 32 | #recipient_delimiter = + 33 | 34 | # Header where the original recipient address (SMTP's RCPT TO: address) is taken 35 | # from if not available elsewhere. With dovecot-lda -a parameter overrides this. 36 | # A commonly used header for this is X-Original-To. 37 | #lda_original_recipient_header = 38 | 39 | # Should saving a mail to a nonexistent mailbox automatically create it? 40 | lda_mailbox_autocreate = yes 41 | 42 | # Should automatically created mailboxes be also automatically subscribed? 43 | #lda_mailbox_autosubscribe = no 44 | 45 | protocol lda { 46 | # Space separated list of plugins to load (default is global mail_plugins). 47 | #mail_plugins = $mail_plugins 48 | } 49 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/15-mailboxes.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## Mailbox definitions 3 | ## 4 | 5 | # NOTE: Assumes "namespace inbox" has been defined in 10-mail.conf. 6 | namespace inbox { 7 | 8 | #mailbox name { 9 | # auto=create will automatically create this mailbox. 10 | # auto=subscribe will both create and subscribe to the mailbox. 11 | #auto = no 12 | 13 | # Space separated list of IMAP SPECIAL-USE attributes as specified by 14 | # RFC 6154: \All \Archive \Drafts \Flagged \Junk \Sent \Trash 15 | #special_use = 16 | #} 17 | 18 | # These mailboxes are widely used and could perhaps be created automatically: 19 | mailbox Drafts { 20 | special_use = \Drafts 21 | } 22 | mailbox Junk { 23 | special_use = \Junk 24 | } 25 | mailbox Trash { 26 | special_use = \Trash 27 | } 28 | 29 | # For \Sent mailboxes there are two widely used names. We'll mark both of 30 | # them as \Sent. User typically deletes one of them if duplicates are created. 31 | mailbox Sent { 32 | special_use = \Sent 33 | } 34 | mailbox "Sent Messages" { 35 | special_use = \Sent 36 | } 37 | 38 | # If you have a virtual "All messages" mailbox: 39 | #mailbox virtual/All { 40 | # special_use = \All 41 | #} 42 | 43 | # If you have a virtual "Flagged" mailbox: 44 | #mailbox virtual/Flagged { 45 | # special_use = \Flagged 46 | #} 47 | } 48 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/20-lmtp.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## LMTP specific settings 3 | ## 4 | 5 | # Support proxying to other LMTP/SMTP servers by performing passdb lookups. 6 | #lmtp_proxy = no 7 | 8 | # When recipient address includes the detail (e.g. user+detail), try to save 9 | # the mail to the detail mailbox. See also recipient_delimiter and 10 | # lda_mailbox_autocreate settings. 11 | #lmtp_save_to_detail_mailbox = no 12 | 13 | # Verify quota before replying to RCPT TO. This adds a small overhead. 14 | #lmtp_rcpt_check_quota = no 15 | 16 | protocol lmtp { 17 | # Space separated list of plugins to load (default is global mail_plugins). 18 | mail_plugins = $mail_plugins 19 | } 20 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/90-acl.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## Mailbox access control lists. 3 | ## 4 | 5 | # vfile backend reads ACLs from "dovecot-acl" file from mail directory. 6 | # You can also optionally give a global ACL directory path where ACLs are 7 | # applied to all users' mailboxes. The global ACL directory contains 8 | # one file for each mailbox, eg. INBOX or sub.mailbox. cache_secs parameter 9 | # specifies how many seconds to wait between stat()ing dovecot-acl file 10 | # to see if it changed. 11 | plugin { 12 | #acl = vfile:/etc/dovecot/global-acls:cache_secs=300 13 | } 14 | 15 | # To let users LIST mailboxes shared by other users, Dovecot needs a 16 | # shared mailbox dictionary. For example: 17 | plugin { 18 | #acl_shared_dict = file:/var/lib/dovecot/shared-mailboxes 19 | } 20 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/90-plugin.conf: -------------------------------------------------------------------------------- 1 | ## 2 | ## Plugin settings 3 | ## 4 | 5 | # All wanted plugins must be listed in mail_plugins setting before any of the 6 | # settings take effect. See for list of plugins and 7 | # their configuration. Note that %variable expansion is done for all values. 8 | 9 | plugin { 10 | #setting_name = value 11 | 12 | zlib_save_level = 6 13 | zlib_save = gz 14 | } 15 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/95-mruby.conf: -------------------------------------------------------------------------------- 1 | protocol imap { 2 | mail_plugins = $mail_plugins imap_mruby 3 | } 4 | 5 | plugin { 6 | # mruby_pre_${command name} = '${Ruby code}' 7 | # mruby_post_${command name} = '${Ruby code}' 8 | # mruby_pre_${command name}_path = /path/to/pre_code.rb 9 | # mruby_post_${command name}_path = /path/to/post_code.rb 10 | # 11 | # support the following commands 12 | # 13 | # select examine create delete rename subscribe unsubscribe list rlist lsub rlsub 14 | # status check close append expunge search fetch store copy uid noop capability idle 15 | # namespace getquota setquota getquotaroot 16 | 17 | mruby_pre_capability = '"pre #{Dovecot::IMAP.command_name} #{Dovecot::IMAP.username}"' 18 | mruby_post_capability = '"post #{Dovecot::IMAP.command_name} #{Dovecot::IMAP.username}"' 19 | mruby_pre_capability_path = /home/ubuntu/DEV/dovecot-mruby-plugin/dovecot/configuration/mruby_handler/pre_post_capability.rb 20 | mruby_post_capability_path = /home/ubuntu/DEV/dovecot-mruby-plugin/dovecot/configuration/mruby_handler/pre_post_capability.rb 21 | } 22 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/95-mruby.conf.erb: -------------------------------------------------------------------------------- 1 | protocol imap { 2 | mail_plugins = $mail_plugins imap_mruby 3 | } 4 | 5 | plugin { 6 | # mruby_pre_${command name} = '${Ruby code}' 7 | # mruby_post_${command name} = '${Ruby code}' 8 | # mruby_pre_${command name}_path = /path/to/pre_code.rb 9 | # mruby_post_${command name}_path = /path/to/post_code.rb 10 | # 11 | # support the following commands 12 | # 13 | # select examine create delete rename subscribe unsubscribe list rlist lsub rlsub 14 | # status check close append expunge search fetch store copy uid noop capability idle 15 | # namespace getquota setquota getquotaroot 16 | 17 | mruby_pre_capability = '"pre #{Dovecot::IMAP.command_name} #{Dovecot::IMAP.username}"' 18 | mruby_post_capability = '"post #{Dovecot::IMAP.command_name} #{Dovecot::IMAP.username}"' 19 | mruby_pre_capability_path = <%= with_base_directory 'configuration/mruby_handler/pre_post_capability.rb' %> 20 | mruby_post_capability_path = <%= with_base_directory 'configuration/mruby_handler/pre_post_capability.rb' %> 21 | } 22 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-checkpassword.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication for checkpassword users. Included from 10-auth.conf. 2 | # 3 | # 4 | 5 | passdb { 6 | driver = checkpassword 7 | args = /usr/bin/checkpassword 8 | } 9 | 10 | # passdb lookup should return also userdb info 11 | userdb { 12 | driver = prefetch 13 | } 14 | 15 | # Standard checkpassword doesn't support direct userdb lookups. 16 | # If you need checkpassword userdb, the checkpassword must support 17 | # Dovecot-specific extensions. 18 | #userdb { 19 | # driver = checkpassword 20 | # args = /usr/bin/checkpassword 21 | #} 22 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-deny.conf.ext: -------------------------------------------------------------------------------- 1 | # Deny access for users. Included from 10-auth.conf. 2 | 3 | # Users can be (temporarily) disabled by adding a passdb with deny=yes. 4 | # If the user is found from that database, authentication will fail. 5 | # The deny passdb should always be specified before others, so it gets 6 | # checked first. 7 | 8 | # Example deny passdb using passwd-file. You can use any passdb though. 9 | passdb { 10 | driver = passwd-file 11 | deny = yes 12 | 13 | # File contains a list of usernames, one per line 14 | args = /etc/dovecot/deny-users 15 | } 16 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-dict.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication via dict backend. Included from 10-auth.conf. 2 | # 3 | # 4 | 5 | passdb { 6 | driver = dict 7 | 8 | # Path for dict configuration file, see 9 | # example-config/dovecot-dict-auth.conf.ext 10 | args = /etc/dovecot/dovecot-dict-auth.conf.ext 11 | } 12 | 13 | userdb { 14 | driver = dict 15 | args = /etc/dovecot/dovecot-dict-auth.conf.ext 16 | } 17 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-ldap.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication for LDAP users. Included from 10-auth.conf. 2 | # 3 | # 4 | 5 | passdb { 6 | driver = ldap 7 | 8 | # Path for LDAP configuration file, see example-config/dovecot-ldap.conf.ext 9 | args = /etc/dovecot/dovecot-ldap.conf.ext 10 | } 11 | 12 | # "prefetch" user database means that the passdb already provided the 13 | # needed information and there's no need to do a separate userdb lookup. 14 | # 15 | #userdb { 16 | # driver = prefetch 17 | #} 18 | 19 | userdb { 20 | driver = ldap 21 | args = /etc/dovecot/dovecot-ldap.conf.ext 22 | 23 | # Default fields can be used to specify defaults that LDAP may override 24 | #default_fields = home=/home/virtual/%u 25 | } 26 | 27 | # If you don't have any user-specific settings, you can avoid the userdb LDAP 28 | # lookup by using userdb static instead of userdb ldap, for example: 29 | # 30 | #userdb { 31 | #driver = static 32 | #args = uid=vmail gid=vmail home=/var/vmail/%u 33 | #} 34 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-master.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication for master users. Included from 10-auth.conf. 2 | 3 | # By adding master=yes setting inside a passdb you make the passdb a list 4 | # of "master users", who can log in as anyone else. 5 | # 6 | 7 | # Example master user passdb using passwd-file. You can use any passdb though. 8 | passdb { 9 | driver = passwd-file 10 | master = yes 11 | args = /etc/dovecot/master-users 12 | 13 | # Unless you're using PAM, you probably still want the destination user to 14 | # be looked up from passdb that it really exists. pass=yes does that. 15 | pass = yes 16 | } 17 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-passwdfile.conf.ext.erb: -------------------------------------------------------------------------------- 1 | # Authentication for passwd-file users. Included from 10-auth.conf. 2 | # 3 | # passwd-like file with specified location. 4 | # doc/wiki/AuthDatabase.PasswdFile.txt 5 | 6 | passdb { 7 | driver = passwd-file 8 | args = scheme=plain-md5 username_format=%u <%= with_base_directory 'configuration/passwd' %> 9 | } 10 | 11 | userdb { 12 | driver = passwd-file 13 | args = username_format=%u <%= with_base_directory 'configuration/passwd' %> 14 | 15 | # Default fields that can be overridden by passwd-file 16 | #default_fields = quota_rule=*:storage=1G 17 | 18 | # Override fields from passwd-file 19 | override_fields = home=<%= with_base_directory 'home' %>/%u 20 | } 21 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-sql.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication for SQL users. Included from 10-auth.conf. 2 | # 3 | # doc/wiki/AuthDatabase.SQL.txt 4 | 5 | passdb { 6 | driver = sql 7 | 8 | # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext 9 | args = /home/ubuntu/DEV/dovecot-mruby-plugin/dovecot/configuration/dovecot-sql.conf.ext 10 | } 11 | 12 | # "prefetch" user database means that the passdb already provided the 13 | # needed information and there's no need to do a separate userdb lookup. 14 | # doc/wiki/UserDatabase.Prefetch.txt 15 | userdb { 16 | driver = prefetch 17 | } 18 | 19 | userdb { 20 | driver = sql 21 | args = /home/ubuntu/DEV/dovecot-mruby-plugin/dovecot/configuration/dovecot-sql.conf.ext 22 | } 23 | 24 | # If you don't have any user-specific settings, you can avoid the user_query 25 | # by using userdb static instead of userdb sql, for example: 26 | # doc/wiki/UserDatabase.Static.txt 27 | #userdb { 28 | #driver = static 29 | #args = uid=vmail gid=vmail home=/var/vmail/%u 30 | #} 31 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-sql.conf.ext.erb: -------------------------------------------------------------------------------- 1 | # Authentication for SQL users. Included from 10-auth.conf. 2 | # 3 | # doc/wiki/AuthDatabase.SQL.txt 4 | 5 | passdb { 6 | driver = sql 7 | 8 | # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext 9 | args = <%= with_base_directory 'configuration/dovecot-sql.conf.ext' %> 10 | } 11 | 12 | # "prefetch" user database means that the passdb already provided the 13 | # needed information and there's no need to do a separate userdb lookup. 14 | # doc/wiki/UserDatabase.Prefetch.txt 15 | userdb { 16 | driver = prefetch 17 | } 18 | 19 | userdb { 20 | driver = sql 21 | args = <%= with_base_directory 'configuration/dovecot-sql.conf.ext' %> 22 | } 23 | 24 | # If you don't have any user-specific settings, you can avoid the user_query 25 | # by using userdb static instead of userdb sql, for example: 26 | # doc/wiki/UserDatabase.Static.txt 27 | #userdb { 28 | #driver = static 29 | #args = uid=vmail gid=vmail home=/var/vmail/%u 30 | #} 31 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-static.conf.ext: -------------------------------------------------------------------------------- 1 | # Static passdb. Included from 10-auth.conf. 2 | 3 | # This can be used for situations where Dovecot doesn't need to verify the 4 | # username or the password, or if there is a single password for all users: 5 | # 6 | # - proxy frontend, where the backend verifies the password 7 | # - proxy backend, where the frontend already verified the password 8 | # - authentication with SSL certificates 9 | # - simple testing 10 | 11 | #passdb { 12 | # driver = static 13 | # args = proxy=y host=%1Mu.example.com nopassword=y 14 | #} 15 | 16 | #passdb { 17 | # driver = static 18 | # args = password=test 19 | #} 20 | 21 | #userdb { 22 | # driver = static 23 | # args = uid=vmail gid=vmail home=/home/%u 24 | #} 25 | -------------------------------------------------------------------------------- /dovecot/configuration/conf.d/auth-vpopmail.conf.ext: -------------------------------------------------------------------------------- 1 | # Authentication for vpopmail users. Included from 10-auth.conf. 2 | # 3 | # 4 | 5 | passdb { 6 | driver = vpopmail 7 | 8 | # [cache_key=] [webmail=] 9 | args = 10 | } 11 | 12 | userdb { 13 | driver = vpopmail 14 | 15 | # [quota_template=