Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] E-mail address hiding service

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Vlad Glagolev <stealth AT tiberian.ru>
  • To: Source Mage Discussion <sm-discuss AT lists.ibiblio.org>
  • Subject: [SM-Discuss] E-mail address hiding service
  • Date: Wed, 15 Apr 2015 18:58:25 +0300

Hello all!

As I told earlier[0], we have a huge spam traffic to our distro mail
addresses. Personally I get like 80-100 spam e-mails daily, especially
recently (maybe 2 or 3 weeks), which is *not* good. And our filtering
system seems to be non-existent, really.

I've decided to write a tiny service I mentioned in the previous mail
in February. And here it is.

I'm pleased to introduce the MAGE[1]: Mail Address GEneration service.
*sigh*

It does the following:

1. Gets a query string containing base64-encoded data
2. Checks for its length (currently max size is 100 chars)
3. Decodes it
4. If everything's fine, it generates an RGB image in PNG representing
original e-mail address according to the website's style[1].

There are several cases when it's not possible to generate a picture:
- wrong base64 data: decoding error is returned
- some internal error occured if rendering is not possible: rendering
error is returned (which is a simple pre-rendered error.png file
sitting on fs)
- wrong or no data is provided (i.e. GET /): usage message is returned

I've converted our Developers page[3] as an example.
It uses :Mage: alias[4] for that, so you can simply use this string:

{{:Mage:...}}

to insert the image somewhere on the site.

And the string generation is pretty simple, too:

$ printf "%s\n" `echo -n user AT domain.tld | base64 -w0`
(or whatever way you prefer)

The only issue I see here is the problem of displaying these addresses
in text browsers like lynx, but how many such visitors do we have?

The service is a bit more than 1.5KB of Python code and actually is a
pure WSGI application. The only dependencies are:

- flup[5]
- pil[6] or pillow[7] (PIL is used on the server atm, but that will
switch to Pillow on the next upgrade)
- DejaVu fonts (dejavu-ttf spell) -- DejaVuSans-Bold.ttf is used here
- freetype2 (sure, how would you work with truetype another way?)

Special notes:
- speedy C version of StringIO (cStringIO) is used
- Cache-Control header for one hour is applied on the server

And finally: I really dislike the situation with our abandoned and
ancient mail system/service and I'm thinking about dropping my distro
email address in favour of something at one of my own domains if nothing
will be changed anytime soon.

But well.. any notes, suggestions and questions are welcome.

[0] https://lists.ibiblio.org/sympa/arc/sm-discuss/2015-February/021885.html
[1] http://beta.mage.sourcemage.ru/
[2] http://beta.sourcemage.ru/style.css
[3] http://beta.sourcemage.ru/Developers
[4] http://beta.sourcemage.ru/Alias
[5] http://www.saddi.com/software/flup/
[6] http://www.pythonware.com/products/pil/
[7] https://python-pillow.github.io/

--
Vlad Glagolev <stealth AT tiberian.ru>

Attachment: pgprn3ckcAGFF.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page