Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Wild Duck is an IMAP server built with Node.js, MongoDB and Redis. Node.js runs the application, MongoDB is used as the mail store and Redis is used for ephemeral actions like publish/subscribe and caching.
NB! Wild Duck is currently in beta. You should not use it in production.
Wild Duck IMAP server supports the following IMAP standards:
\Recent
flag as it does not provide any real value, only makes things more complicated. RENAME works a bit differently than spec describes.Yes, it does. You can run the server and get a working IMAP server for mail store, LMTP and/or SMTP servers for pushing messages to the mail store and HTTP API server to create new users. All handled by Node.js and MongoDB, no additional dependencies needed.
Yes, historically it has been considered a bad practice to store emails in a database. And for a good reason. The data model of relational databases like MySQL does not work well with tree like structures (email mime tree) or large blobs (email source).
Notice the word "relational"? In fact document stores like MongoDB work very well with emails. Document store is great for storing tree-like structures and while GridFS is not as good as "real" object storage, it is good enough for storing the raw parts of the message.
Not yet exactly. Even though on some parts Wild Duck is already fast, there are still some important improvements that need to be done:
Whenever a message is received Wild Duck parses it into a tree-like structure based on the MIME tree and stores this tree to MongoDB. Larger attachments (anything above 50kB) are removed from the tree and stored separately in GridStore. If a message needs to be loaded then Wild Duck fetches the tree structure first, if needed loads attachments from GridStore and then compiles it back into the original RFC822 message. The result should be identical to the original messages unless the original message used unix newlines, these might be partially replaced with windows newlines.
Wild Duck tries to keep minimal state for sessions to be able to distribute sessions between different hosts. Whenever a mailbox is opened the entire message list is loaded as an array of UID values. The first UID in the array element points to the message #1 in IMAP, second one points to message #2 etc.
Actual update data (information about new and deleted messages, flag updates and such) is stored to a journal log and an update beacon is propagated through Redis pub/sub whenever something happens. If a session detects that there have been some changes in the current mailbox and it is possible to notify the user about it (eg. a NOOP call was made), journaled log is loaded from the database and applied to the UID array one action at a time. Once all journaled updates have applied then the result should match the latest state. If it is not possible to notify the user (eg a FETCH call was made), then journal log is not loaded and the user continues to see the old state.
The problem with quota counters is that the actions (store message + increment counter for mailbox or delete message + decerement counter for mailbox) are not transactional, so if something fails, the counter might end up in an invalid state. An easy fix would be to use fake transactions - set up a transaction with mailbox and counter data by storing a transaction entry, then process required actions and finally remove the transaction entry. If something fails and transaction is not completed, then the mailbox would be marked for reindexing which would mean that the mailbox quota is entirely re-calculcated and quota counters are reset.
Assuming you have MongoDB and Redis running somewhere.
$ git clone git://github.com/wildduck-email/wildduck.git
$ cd wildduck
Install dependencies from npm
$ npm install --production
You can either modify the default config file or alternatively generate an environment related config file that gets merged with the default values. Read about the config module here
Run the index queries in MongoDB (optional, the app would work without it as indexes only become relevant once you have more than few messages stored)
There's a helper script that you can run from the command line to add/updated indexes in the database provided by the configuration file
$ npm run indexes
Or if you want to use mongo settings from environment related config file, eg from production.js
, run the following
$ NODE_ENV=production npm run indexes
To use the default config file, run the following
npm start
Or if you want to use environment related config file, eg from production.js
, run the following
NODE_ENV=production npm start
See see below for details about creating new user accounts
Users can be created with HTTP requests
Arguments
Example
curl -XPOST "http://localhost:8080/user/create" -H 'content-type: application/json' -d '{
"username": "username@example.com",
"password": "secretpass"
}'
The response for successful operation should look like this:
{
"success": true,
"id": "58bd6815dddb5ac5063d3590",
"username": "username@example.com"
}
After you have created an user you can use these credentials to log in to the IMAP server. Additionally the LMTP and SMTP servers starts accepting mail for this email address.
Create an email account and use your IMAP client to connect to it. To send mail to this account, run the example script:
node examples/push-mail.js username@example.com
This should "deliver" a new message to the INBOX of username@example.com by using the built-in SMTP maildrop interface. If your email client is connected then you should promptly see the new message.
Wild Duck Mail Agent is licensed under the European Union Public License 1.1.
FAQs
IMAP/POP3 server built with Node.js and MongoDB
The npm package wildduck receives a total of 306 weekly downloads. As such, wildduck popularity was classified as not popular.
We found that wildduck demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.