data-8/restuser

Name: restuser

Owner: Data Science 8

Description: null

Created: 2016-01-20 08:04:44.0

Updated: 2016-01-20 08:04:45.0

Pushed: 2015-01-12 20:58:33.0

Homepage: null

Size: 120

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RESTUser

A minimal REST API on HTTP + Unix sockets for creating users.

POST http+unix:[/path/to/restuser.sock]/username

to create a new user. Reply is a JSON dict of the pwd struct:


r": "/home/foo",
d": 1000,
me": "foo",
ell": "/bin/bash",
d": 1000

Run with:

sudo mkdir /var/run/restuser
sudo python restuser.py --socket=restuser.sock

Mount the socket in a docker container with:

docker run -v restuser.sock:/var/run/restuser.sock -t yourimage

This will mount the host's restuser.sock as /var/run/restuser.sock on the container, giving the container permission to create users on the host machine.

Test

You can test both the server and a client in docker containers.

Build the images:

docker build -t restuser .
docker build -t restuser-test test

Run the server:

docker run --name users -d -t restuser

Run the test client:

docker run --volumes-from=users -it restuser-test

Verify the new users:

docker exec -it users tail -n 5 /etc/passwd

Finally, violently destroy the server:

docker rm -f users

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.