DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
Danny Coates cebd88ffa5 Merge pull request #815 from jrgm/local-email-valid
move valid email checks to local tests
2014-09-29 14:02:30 -07:00
bin basket api notifier 2014-09-28 18:51:53 -07:00
config basket api notifier 2014-09-28 18:51:53 -07:00
crypto Add a limit to the number of in-flight scrypt hashes. 2014-08-16 13:14:39 +10:00
db resolved all custom git dependencies and removed mysql and heap db. 2014-07-23 12:49:59 -07:00
docs Merge pull request #817 from vladikoff/urlFix 2014-09-25 09:28:34 -07:00
routes basket api notifier 2014-09-28 18:51:53 -07:00
scripts exit with the exit code of ./bin/key_server.js 2014-09-19 14:34:34 -07:00
server changed nonceFunc skew logging to trace level 2014-08-08 13:14:40 -07:00
test Merge pull request #815 from jrgm/local-email-valid 2014-09-29 14:02:30 -07:00
tokens added locale to account 2014-07-08 14:54:25 -07:00
.gitignore reorganize test related files and removed unuse code 2014-06-03 12:00:06 -07:00
.jshintrc fixed jshint complaints 2013-11-01 14:29:39 -07:00
.travis.yml workaround for obsolete temp module 0.6 2014-08-06 18:54:48 -07:00
AUTHORS Use Hapi's builtin config for the Strict-Transport-Security header 2014-06-13 22:21:38 +02:00
CHANGELOG train-22 2014-09-28 19:03:16 -07:00
CONTRIBUTING.md Update CONTRIBUTING.md 2014-08-18 15:19:17 -07:00
Gruntfile.js updated lockdown versions 2014-02-24 14:29:26 -08:00
LICENSE Add a proper copy of the MPL 2014-05-16 17:27:17 +12:00
README.md Merge pull request #767 from chilts/more-docs-on-processes 2014-07-23 15:53:40 +12:00
Vagrantfile changed vagrant synced_folder to rsync 2014-03-11 13:53:44 -07:00
bounces.js basket api notifier 2014-09-28 18:51:53 -07:00
customs.js Remove the unimplemented agent when talking to the customs server 2014-09-19 09:12:14 +12:00
error.js Make sure bin/key_server.js checks what the db patch level is 2014-03-19 17:14:15 +13:00
jwks.js additional data in preVerifyToken errors 2014-09-08 15:02:33 -07:00
log.js added a default uid to request.summary lines. fixes #755 2014-08-11 11:08:01 -07:00
mailer.js added 'resume' optional parameter for email sending endpoints 2014-09-04 14:17:52 -07:00
npm-shrinkwrap.json train-22 2014-09-28 19:03:16 -07:00
package.json train-22 2014-09-28 19:03:16 -07:00
pool.js use err.message for pool errors when there's no body. closes #789 2014-09-03 18:32:12 -07:00
preverifier.js jwtError should always return an object for errors 2014-09-08 16:49:07 -07:00
promise.js created promise.js for easy lib switching. 2014-01-09 00:01:04 -08:00
sqs.js basket api notifier 2014-09-28 18:51:53 -07: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

Guidelines for Contributing

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. On some systems running the server as root will cause working directory permissions issues with node. It is recommended that you create a seperate, standard user to ensure a clean and more secure installation.

Clone the git repository and install dependencies:

git clone git://github.com/mozilla/fxa-auth-server.git
cd fxa-auth-server
npm install

To start the server in dev mode (ie. NODE_ENV=dev), run:

npm start

This runs a script scripts/start-local.sh as defined in package.json. This will start up 4 services, three of which listen on the following ports (by default):

  • bin/key_server.js on port 9000
  • test/mail_helper.js on port 9001
  • ./node_modules/fxa-customs-server/bin/customs_server.js on port 7000
  • bin/notifier.js (no port)

When you Ctrl-c your server, all 4 processes will be stopped.

Testing

Run tests with:

npm test
  • Note: stop the auth-server before running tests. Otherwise, they will fail with obscure errors.

Reference Client

https://github.com/mozilla/fxa-js-client

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:587").
    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.

Database Patches

Previously the database patches were contained in this repo and were run when the server started up (in development mode). However, there is a new backend service that this project will use as we go forward. Whilst the database connection and API code is still contained and used in this repo you should take a look at the fxa-auth-db-server repo for the SQL that you should run once you have your database set up, specifically the instructions on Creating the Database. Note where the schema patches live, in case you need them.

As we switch over to the httpdb backend, the instructions here and in the fxa-auth-db-server repo will be updated to clarify this. We know this isn't optimal for now but it is temporary during this transition.

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.

Using with FxOS

By default, FxOS uses the production Firefox Accounts server (api.accounts.firefox.com/v1). If you want to use a different account server on a device, you need to update a preference value identity.fxaccounts.auth.uri.

user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1");
  • ./modPref.sh push prefs.js

License

MPL 2.0