cryptserver

command module
v0.0.0-...-6bb6967 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2017 License: MIT Imports: 9 Imported by: 0

README

cryptserver: SHA512, base64-encoded encryption server

Server listening for POST requests containing a password parameter, returns SHA512 hash of password in base64 to / path. Server gracefully handles shutdown requests both from SIGINT signals and POST requests to /shutdown with authorized passwords.

Installation

  • Install Go v1.8
  • go get -u github.com/asgaines/cryptserver/...

Usage

Starting Server
  • cryptserver
  • cryptserver 2> /path/to/logfile
Optional Parameters
  • -port, or --port defines on which port server should listen (default: 8080)
  • -delay, or --delay defines how much time to wait before responding to requests (default: 5s)
  • Note: must include unit (e.g. 3s, 500ms)
Issuing Requests
Retrieving hashes of passwords
  • curl --data "password=<your-password>" http://localhost:<your-port>
Example

Start server:

cryptserver

Issue POST request:

curl --data "password=superSecretPassword1234" http://localhost:8080

After default response time wait, receive:

+PNX5nhK38mR3VJEWOMBweFrgocThl86dbM423y0DOtIsa3xBrUObVwsBnArhv5gFy69uvImsWK74QQogGHeUQ==

Graceful shutdown of server
POST Request
  • curl --data "password=<valid-password>" http://localhost:<your-port>/shutdown
  • Passwords are validated by including a SHA512 hash of them in base 64 in shadow file
  • For quick testing, angryMonkey is configured to work, out of the box. For security purposes, remove this line from the shadow file and replace with new hashes when done testing
  • Create new valid password: curl --data "password=<new-valid-password>" http://localhost:<your-port>/ >> ./etc/shadow
  • Invalid passwords return error
SIGINT (^C)
  • cryptserver catches and handles (nterrupt signal), gracefully shutting down server

Testing

go test ./...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL