mozilla/fxa-auth-server — pull request #678 by dannycoates (2014-04-11 00:10:08+00:00)
Title: phase 1 of ses bounce processing

This adds a new process `/bin/email_bouncer.js`

## Functionality

When a bounce or complaint is received from SES if the account is unverified and the bounce is "Permenent" or the complaint is "abuse" (spam) the account associated with that email address will be deleted.

If the account is verified no action will be taken. This may change in a future release.

## Log additions

@kparlante

Bounces are handled in a separate process with `"name":"email-bouncer"`.

Normal messages include:

* `"op":"handleBounces", "email":"an@example.com", "bounce": true`
* `"op":"accountDeleted", "uid":"1234", "email":"an@example.com"`

Error messages include:

* `"op":"databaseError", "email": "an@example.com", "err": {}`
* `"op":"fetch": "url":"https://sqs.something.something", "err": {}`

## Ops additions

@gene1wood @mostlygeek @jrgm

The bouncer process logs to a different file than the auth server. Bouncer logs should get sent to heka for processing.

`bin/email_bouncer.js` requires 2 new SNS topics and 2 SQS queues. The SNS topics need to be attached to SES bounce and complaint notifications and sent to the corresponding SQS queues.

### Config additions

Needs to be added to `puppet-config`

```json
{
"bounces": {
"region": "us-west-2",
"bounceQueueUrl": "https://sqs..amazonaws.com//",
"complaintQueueUrl": "https://sqs..amazonaws.com//"
}
}
```

If the process is not configured properly or the SQS queues aren't available the bouncer will continue to run but log errors every 2 seconds as it attempts to read from the queues.

## See Also

* https://github.com/mozilla-services/puppet-config/pull/335
* https://bugzilla.mozilla.org/show_bug.cgi?id=994207
* https://github.com/mozilla/fxa-auth-server/issues/649

@rfk code r?