DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
Ryan Kelly 97a7ca0b21 Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
bin Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
client removed callbacks from client lib 2013-12-13 18:27:39 -08:00
config Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
db Fix commit-ordering bug in mysql backend 2013-12-12 15:52:50 +11:00
docs First, rough attempt at internationalization of emails. 2013-12-09 12:53:24 +11:00
loadtest Use valid passwordStretching.salt in loadtest script. 2013-12-12 13:35:09 +11:00
resources/i18n First, rough attempt at internationalization of emails. 2013-12-09 12:53:24 +11:00
routes Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
scripts Merge pull request #406 from chilts/kill-mail-helper 2013-12-10 17:25:08 -08:00
server Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
templates/email First, rough attempt at internationalization of emails. 2013-12-09 12:53:24 +11:00
test add ability to set client time offset to correct time skew 2013-12-11 15:21:39 -08:00
tokens tokenid and tokendata are now Buffers internally 2013-11-26 17:46:19 -07:00
.awsbox.json Simplify and cleanup heka+awsbox setup. 2013-09-23 11:52:48 +10:00
.gitignore first stab at a vagrant setup 2013-12-04 14:56:28 -08:00
.jshintrc fixed jshint complaints 2013-11-01 14:29:39 -07:00
.travis.yml Merry Christmas 2013-12-11 15:39:32 -08:00
Gruntfile.js twerking the tests a bit and converting tabs to [2] spaces 2013-11-21 14:46:14 -08:00
LICENSE Skeleton Hapi app 2013-05-13 17:00:22 -07:00
README.md adding travis badge 2013-11-20 18:14:03 -08:00
Vagrantfile updated vagrant for load testing 2013-12-11 23:45:06 -08:00
error.js Make unknown errors a log.error, not a log.warn 2013-12-10 12:38:10 +11:00
hkdf.js Add missing copyright headers 2013-07-25 18:49:45 -07:00
i18n.js camelCase all the config options 2013-12-09 12:26:41 -08:00
log.js fixed annoying log lines with buffers 2013-12-07 16:20:17 -08:00
mailer.js Send verification code in query string, not url fragment. 2013-12-11 16:01:48 +11:00
memory_monitor.js Add missing copyright headers 2013-07-25 18:49:45 -07:00
noncedb.js Rename NODE_ENV=production to NODE_ENV=prod 2013-12-17 15:36:34 +11:00
package.json updated hapi 2013-12-13 11:41:50 -08:00

README.md

Firefox Accounts Server

Build Status

This project implements the core server-side API for Firefox Accounts. It provides account, device and encryption-key management for the Mozilla Cloud Services ecosystem.

Overview

Detailed design document

Detailed API spec

Prerequisites

  • node 0.10.x or higher
  • npm
  • pgrep
    • Usually available by default on Mac OS X 10.8+ and Linux.
    • On older versions of Mac OS X, get it via: brew install proctools.
  • libgmp
    • On Linux: install libgmp and libgmp-dev packages
    • On Mac OS X: brew install gmp

Install

You'll need node 0.10.x or higher and npm to run the server.

Clone the git repository and install dependencies:

git clone git://github.com/mozilla/fxa-auth-server.git
cd fxa-auth-server
npm install
node ./scripts/gen_keys.js

To start the server, run:

npm start

It will listen on http://localhost:9000 by default.

Testing

Run tests with:

npm test

Reference Client

A node library that implements the client side of the protocol and an example script is located in the /client directory.

Dev Deployment

There is a development server running the moz-svc-dev AWS environment, at the following address:

https://api-accounts.dev.lcip.org/

It is managed using awsbox. You can force-push a particular version of the code by doing:

$> git remote add api-dev-lcip-org app@api-accounts.dev.lcip.org:git
$> git push api-dev-lcip-org HEAD:master

The dev deployment is configured to send emails via Amazon SES. If you need to re-create, or want to stand up a similar server, you will need to:

  1. Obtain the SES SMTP credentials; ping @rfk or @zaach for details.
  2. Deploy the new machine using awsbox.
  3. Configure postfix to use the SES credentials:
    1. Edit /etc/postfix/sasl_passwd to insert the SES credentials.
    2. Run /usr/sbin/postmap /etc/postfix/sasl_passwd to compile them.
    3. Edit /etc/postfix/main.cf to change 'relayhost' to the SES SMTP host (typically "email-smtp.us-east-1.amazonaws.com:25").
    4. Run service postfix restart to restart postfix.

There is also a "bleeding edge" development server that is configured to auto-update itself from the latest github master. It may be useful for testing out new protocol changes, but should be considered unstable for general development use:

https://api-accounts-latest.dev.lcip.org/

Configuration

To set the url of the content server, edit config.json on your deployed instance and add:

"contentServer": {
  "url": "http://your.content.server.org"
}

MySQL setup

Install MySQL

Mac

Installation is easy with homebrew. I use mariadb which is a fork of mysql but either should work.

brew install mariadb

Follow the homebrew instructions for starting the server. I usually just do

mysql.server start

Linux

Install MySQL and start it.

Execution

Our test suite assumes mysql uses it's default configuration. See config/config.js for the override ENV variables if you have different root user password or other user. Now you should be able to run the test suite from the project root directory.

DB_BACKEND=mysql npm test

Or run the local server

DB_BACKEND=mysql npm start

Cleanup

You may want to clear the data from the database periodically. I just drop the database:

mysql -uroot -e"DROP DATABASE fxa"

The server will automatically re-create it on next use.

License

MPL 2.0