Throttling outbound emails with Mailman & Exim

Many ISPs have limits on the amount of emails received in a period of time, not respecting this will reduce the reputation of the sender.

Mailman 2 doesn’t support throttling, though there’re some patches in the wild adding this feature. Exim supports rate limiting incoming emails, but not emails going out, though it may be possible to do this with some convoluted configuration.

The easy solution is to rate limit emails coming from Mailman to Exim, so Mailman will retry them later.

This is the Mailman configuration:

DELIVERY_RETRY_WAIT = minutes(15)

Here we tell Mailman to retry sending delayed emails every 15 minutes, this is the minimum possible time, because the retry process only runs every 15 minutes. The default value is 1 hour.

This is the Exim configuration:

acl_smtp_rcpt = acl_check_rcpt

[...]

acl_check_rcpt:
  [...]
  defer hosts = +relay_from_hosts
        ratelimit = 75 / 15m / per_rcpt / $domain
        message = Rate limit exceeded for $domain: \
                  $sender_rate/$sender_rate_period \
                  (max $sender_rate_limit)

Here we’re telling Exim to accept no more than 75 emails every 15 minutes for any given domain. As seen above 15 minutes is the minimum possible for Mailman. The value 75 depends on how many emails you’re sending: look at the exim logs, pick up the domain you’re sending the most emails, and adjust this value accordingly.

Pygit2 0.26.4 adds support for worktrees

See the full list of changes.

Thanks to Raphael Medaer, Mikhail Yushkovskiy, Brandon Milton, Erik Johnson, Peter-Yi Zhang, Natanael Arndt, Nick Hynes, Andrey Trubachev, CJ Harries, Mark Adams and Remy Suen.

Resources:

Enjoy!

Pygit2 0.26.0 update for libgit2 0.26, drops support for Python 3.2

This release drops support for Python 3.2, adds support for latest cffi, and requires the new libigit2 0.26

New revert and branch features, several bugs fixed.

See the full list of changes. Thanks to Lukas Fleischer, Carlos Martín Nieto, Mark Adams and Nick Hynes.

Resources:

Enjoy!

Pygit2 0.25.1 adds support for stash, and more

This release adds a number of new features and improved API, including:

  • new stash methods,
  • improved support for submodules,
  • a friendlier API for branches & references,
  • support for custom backends.

See the full list of changes. Thanks to Nick Hynes, Tamir Bahar, Jason Ziglar and Matthaus Woolard.

Resources:

Enjoy!

The system-ui font

Imagine:

font-family: system-ui, sans-serif;

Enabled by default in Chrome 56, system-ui is a special font name, that tells Chrome to use the system font (be it Cantarell in Gnome, San Francisco in macOS, etc.)

But system-ui is something new, as far as I know available only in the latest versions of Blink based browsers. So what to do as of today? This is from Bootstrap 4:

font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

Safari and Firefox on Mac will recognize -apple-system and use the Mac system font, just as system-ui, but not standard. Then comes the standard system-ui, but only available in Chrome 56. Older versions of Chrome, on Mac only, will interpret the same with BlinkMacSystemFont. Now comes Segoe UI, unlike the first three this is a real font name, the one used in Windows since Windows Vista. Now comes: Roboto for Android, Helvetica Neue for some versions of macOS, and Arial for old Windows.

But, but, where is Gnome’s font, you insensitive clod?

font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Helvetica Neue", Arial, Helvetica, sans-serif;

Ah that looks better, just added Oxygen for KDE, Ubuntu for.. (I let you guess this one), Cantarell for Gnome, and Helvetica because… well I don’t know why.

If you want, you can still add Droid Sans for old Android, Fira Sans for Firefox OS,  and maybe Lucida Grande for some old versions of macOS. Okey, the list is long but you only have to type it once. You can also define the list using @font-face

Make your own list, decide which platforms you don’t care about, and use it as default in your projects. But don’t be insensitive and include Cantarell in the list!

Of course, if your site tries to sell something or to send a message, and if you care enough, then consider choosing a nice font (adjust letter spacing bla bla). To make it short, maybe something like:

font-family: "My nice font", system-ui, sans-serif;

Check Font Squirrel

HTTP Strict Transport Security (hsts)

Just learned about HSTS and started using it. First let me explain HSTS with my own words.

Scenario without hsts:
  1. The user types the domain name in the URL bar without the protocol, such as “example.com”, and the browser automatically adds the “http://” prefix. This first request is vulnerable to Man In The Middle (MITM) attacks.
  2. The server replies with a redirection to the secure “https://example.com”. From the rest of the interaction communication is secure.
  3. The next day the user types again “example.com” in the URL bar. The browser sends again an insecure HTTP request.
Scenario with hsts:
  1. The user types the domain name in the URL bar without the protocol, such as “example.com”, and the browser automatically adds the “http://” prefix. This first request is vulnerable to Man In The Middle (MITM) attacks.
  2. The server replies with a redirection to the secure “https://example.com”. From the rest of the interaction communication is secure. And, the server adds the response header:
    Strict-Transport-Security: max-age=31536000

    This response header instructs the browser to use HTTPS, and asks him to do so for the next 31.536.000 seconds (1 year).

  3. The next day, the user types again “example.com” in the URL bar. But, the browser remembers, and it uses HTTPS instead of HTTP. And will do so even if the user includes explicitly the prefix “http://example.com”.
Closing

So with HSTS the user will only be vulnerable the first time, and not every time she starts a session.

After learning this I have added support for HSTS to my Ansible role for Django deployment. See commit, and I encourage you to start using HSTS too.

Links:

Have a nice secure day!

 

 

Pygit2 0.25.0 released, upgrades to libgit2 0.25

This release requires the recently released libgit2 0.25.0; see the full list of changes.

Thanks to Carlos Martín Nieto, Szucs Krisztian and Guillermo Pérez.

Resources:

Enjoy!

Pygit2 0.24.2 improves support for Windows

Now unit tests pass on Windows. Integration with AppVeyor. Wheels available on Pypi. See the full list of changes.

Thanks to Matthias Bartelmeß, Anatoly Techtonik, Robert Hölzl and Carlos Martín Nieto.

Resources:

Enjoy!