Keep your email safe from hackers and trackers. Make an email alias with 1 click, and keep your address to yourself.
Перейти к файлу
groovecoder d90b8458aa for #309: start sns_inbound view 2020-05-21 13:09:12 -05:00
.circleci for #79: pytest on circle 2020-04-07 10:47:26 -05:00
emails for #309: start sns_inbound view 2020-05-21 13:09:12 -05:00
extension Merge pull request #276 from mozilla/use-modal-for-extension-errors 2020-05-07 13:08:50 -05:00
phones use same proxy number for 2nd participant 2019-12-30 11:41:53 -06:00
privaterelay for #309: start sns_inbound view 2020-05-21 13:09:12 -05:00
static Merge branch 'master' into open-waitlist-271 2020-05-13 13:33:37 -05:00
.dockerignore for #79: pytest on circle 2020-04-07 10:47:26 -05:00
.env-dist for #309: start sns_inbound view 2020-05-21 13:09:12 -05:00
.gitignore for #79: pytest on circle 2020-04-07 10:47:26 -05:00
Dockerfile --no-input and verbose collectstatic output 2020-04-07 17:41:04 -05:00
Procfile initial commit 2019-06-05 04:40:03 -05:00
README.md fix #153: update npm commands and READMEs 2020-04-14 16:31:59 -05:00
gunicorn.conf use PORT env var for gunicorn binding 2020-03-05 12:10:53 -06:00
manage.py initial commit 2019-06-05 04:40:03 -05:00
pytest.ini for #79: pytest on circle 2020-04-07 10:47:26 -05:00
requirements.txt for #309: start sns_inbound view 2020-05-21 13:09:12 -05:00
runtime.txt use python 3.7.x on heroku 2020-04-10 09:18:13 -05:00

README.md

Private Relay

Private Relay provides generated email addresses to use in place of personal email addresses.

Recipients will still receive emails, but Private Relay keeps their personal email address from being harvested, and then bought, sold, traded, or combined with other data to personally identify, track, and/or target them.

Development

Requirements

Install and Run the Site Locally

  1. Clone and change to the directory:

    git clone git@github.com:mozilla/fx-private-relay.git
    cd fx-private-relay
    
  2. Create and activate a virtual environment:

    virtualenv env
    source env/bin/activate
    
  3. Install requirements:

    pip install -r requirements.txt
    
  4. Copy .env file for decouple config:

    cp .env-dist .env
    
  5. Add a SECRET_KEY value to .env:

    SECRET_KEY=secret-key-should-be-different-for-every-install
    
  6. Migrate DB:

    python manage.py migrate
    
  7. Create superuser:

    python manage.py createsuperuser
    
  8. Run it:

    python manage.py runserver
    

Next you'll need to enable Firefox Accounts auth ...

Enable Firefox Accounts Auth

To enable Firefox Accounts authentication on your local server, you can use the "private-relay (local)" OAuth app on oauth-stable.dev.lcip.org.

To do so:

  1. Set ADMIN_ENABLED=True in your .env file

  2. Go to the django admin page to change the default site.

  3. Change example.com to 127.0.0.1:8000 and click Save.

  4. Go to the django-allauth social app admin page, sign in with the superuser account you created above, and add a social app for Firefox Accounts:

    • Provider: Firefox Accounts
    • Name: oauth-stable.dev.lcip.org
    • Client id: 7477974d5019bdaf
    • Secret key: ping groovecoder for this
    • Sites: 127.0.0.1:8000 -> Chosen sites

Now you can sign into http://127.0.0.1:8000/ with an FxA. Remember: you'll need to use an account on oauth-stable.dev.lcip.org, not the production accounts.firefox.com.

Enable SocketLabs Inbound API

If you want to enable SocketLabs Inbound API to deliver email messages to your local server, you will need a domain where you can set MX records, and something like ngrok to forward public URLs to your local server.

  1. In your DNS, add an MX record

    • Priority: 10
    • Value: mx.socketlabs.com
  2. In your SocketLabs account, add a new server. ("Free" includes 500 messages per month.)

  3. Under "Injection API", copy the Injection API Key into your SOCKETLABS_API_KEY env var

  4. Under "For Developers", choose "Inbound API", and enable Inbound Parsing.

  5. Copy the Secret Key into your SOCKETLABS_SECRET_KEY env var

  6. Copy the Validation Key into your SOCKETLABS_VALIDATION_KEY env var

  7. Restart your runserver process

  8. With your server running on 127.0.0.1:8000, use ngrok to forward a public domain to it:

    • ngrok http 127.0.0.1:8000
      • You should see output like Forwarding https://bec216e2.ngrok.io -> http://127.0.0.1:8000
  9. On the Inbound API screen, set the Endpoint URL to your ngrok domain, followed by /emails/inbound (e.g., https://bec216e2.ngrok.io/emails/inbound), and click "Validate".

    • It should say "Your Endpoint URL is valid"
  10. At the "Add Address/Domains" prompt, enter your domain where you set the MX records.

    • @domain should show up under "Current Entries"
  11. Click "Update"

  12. Test sending an email to test@domain

    • You should see SocketLabs send the request to your local runserver process thru your public ngrok URL.

Install and run the add-on locally

The add-on adds Firefox UI to generate and auto-fill email addresses. You may want to build the add-on so that it communicates with your 127.0.0.1:8000 server instead of the production relay.firefox.com server:

  1. In the extension/ directory, run npm install and then npm run build

  2. Use about:debugging to install the resulting static/downloads/addon/latest/private_relay.zip file.

Production Environments

Requirements

In addition to the requirements for dev, production environments should use:

Environment Variables

Production environments should also set some additional environment variables:

DATABASE_URL=postgresql://<username>:<password>@<host>:<port>/<database>
DJANGO_SECURE_HSTS_SECONDS=15768000
DJANGO_SECURE_SSL_REDIRECT=True