Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Cross platform Desktop app #85

Merged
merged 34 commits into from
Apr 8, 2017
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
76b4823
First commit desktop app
Mar 2, 2017
87f93f5
Enable electron packager
Mar 2, 2017
8d2c32c
Copy paste support
Mar 3, 2017
3afd503
Use separate index files
Mar 30, 2017
1983fc4
Use window property for in-code web app detection
Mar 30, 2017
a83d91a
Unify history navigation between web and desktop
Mar 30, 2017
f0605c6
Dual webpack build target
Mar 30, 2017
29bfd0a
Desktop Protocol Handler
Mar 30, 2017
62604df
Custom icon, URL protocol integration
Mar 31, 2017
e663aff
Bundle flexgrid and fonticon
Mar 31, 2017
ff7360b
fix release name and version
Mar 31, 2017
ddb0fa5
Unify index page for web/desktop. Create /vaultui endpoint
Mar 31, 2017
d740295
Remove unused scripts
Mar 31, 2017
645a0ef
Reorganise webpack configs
Mar 31, 2017
8344b98
Fix welcome message styling
Mar 31, 2017
546e358
Remove unused code
Mar 31, 2017
602268d
Fix scripts
Mar 31, 2017
16b5c48
Prune node modules after webpacking
Mar 31, 2017
435ec64
Cleanup and Reorganize dependencies
Mar 31, 2017
1d117a9
Use node:alpine to reduce image size
Mar 31, 2017
114edc0
Quiet down docker build logs
Mar 31, 2017
6d0de48
fix index.html packaging
Mar 31, 2017
f676365
Rework readme
Mar 31, 2017
10c81a5
Remove unused image
Mar 31, 2017
18fc7cc
Merge branch 'master' into experimental/desktop
msessa Apr 3, 2017
64e8b08
Separate index pages again to workaround electron quirks on absolute …
Apr 4, 2017
9e0a86a
Merge master
Apr 4, 2017
751280b
Improved TLS error handling in both web and desktop
Apr 4, 2017
1f09f98
Add TLS listener in development mode
Apr 4, 2017
e9e79a7
Disable TLS verification for dev mode
Apr 4, 2017
e5dadab
Fix app name and includes
Apr 4, 2017
e246875
Spell check
Apr 8, 2017
d2908a8
Fix improper timeout handling
Apr 8, 2017
29de789
Bundle desktop under different name
Apr 8, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
node_modules/
release/
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/*
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
FROM node:slim
FROM node:alpine

MAINTAINER Vault-UI Contributors

ADD package.json /tmp/package.json
RUN cd /tmp && npm install --silent && mkdir -p /app/ && mv /tmp/node_modules /app/

RUN npm install --silent -g webpack

ADD . /app
WORKDIR /app

RUN npm run build
RUN npm install --silent && npm run build-web && npm prune --silent --production

EXPOSE 8000

Expand Down
123 changes: 73 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,106 @@
# Vault-UI
<a href="https://github.com/djenriquez/vault-ui">
<img src="http://svgshare.com/i/177.svg" alt="Vault-UI Logo"
title="Vault-UI" width="64px" align="right" />
</a>

[![](https://images.microbadger.com/badges/image/djenriquez/vault-ui.svg)](https://microbadger.com/images/djenriquez/vault-ui)
[![Run Status](https://api.shippable.com/projects/581e7826fbc68c0f00deb0ca/badge?branch=master)](https://app.shippable.com/projects/581e7826fbc68c0f00deb0ca)

A beautiful way to manage your secrets in Vault
![Landing Page](images/Landing.png)
# Vault-UI

A beautiful way to manage your Hashicorp Vault

![](http://i.imgur.com/COBxk3m.gif)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome gif!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Features

- Easy to deploy as Web App
- Desktop version works on Mac, Linux and Windows
- Material UI Design
- Integrated JSON Editor
- Written in React

## Configuration
Configuration is accessed by clicking on the configuration cog on the login page.
## Installation

<img src="images/AuthConfig.png" height="280">
### Desktop Version

### Vault Endpoint
Users can enter in the full endpoint to Vault, including scheme. When running the docker image, it is possible to
set the following environment variables to pre-configure authentication settings:
Vault-UI Desktop is available for the following operating systems:
- Windows
- MacOS
- Linux (32bit and 64bit AppImage)

Download the latest version from the release page and install/run the software

### Web Version

Vault-UI can be deployed as a shared web app for your organization

Docker images are automatically built using an [automated build on Docker Hub](https://hub.docker.com/r/djenriquez/vault-ui/builds/).
We encourage that versioned images are used for production.

To run Vault-UI using the latest Docker image:
```bash
docker run -d \
-p 8000:8000 \
--name vault-ui \
djenriquez/vault-ui
```

#### Advanced configuration options

By default, connection and authentication parameters must be configured by clicking on the configuration cog on the login page.
Using environement variables (via docker), an administrator can pre-configure those parameters.

Example command to pre-configure the Vault server URL and authentication method
```bash
docker run -d \
-p 8000:8000 \
-e VAULT_URL_DEFAULT=http://vault.server.org:8200
-e VAULT_AUTH_DEFAULT=GITHUB
--name vault-ui \
djenriquez/vault-ui
```

Supported environment variables:
- `NODE_TLS_REJECT_UNAUTHORIZED` disable TLS server side validation (ex. vault deployed with self-signed certificate)
- `VAULT_URL_DEFAULT` will set the default vault endpoint.
- `VAULT_AUTH_DEFAULT` will set the default authentication method type. See below for supported authentication methods.
- `VAULT_AUTH_BACKEND_PATH` will set the default backend path. Useful when multiple backends of the same type are mounted on the vault file system.
- `VAULT_SUPPLIED_TOKEN_HEADER` will instruct Vault-UI to attempt authentication using a token provided by the client in the specified HTTP request header.

This defaults can be overridden if the user fills out the endpoint and auth method manually.

## Authentication

Currently supported authentication methods:
- `GITHUB` : When using the [GitHub](https://www.vaultproject.io/docs/auth/github.html) backend
- `USERNAMEPASSWORD` : When using the [Username & Password](https://www.vaultproject.io/docs/auth/userpass.html) or [RADIUS](https://www.vaultproject.io/docs/auth/radius.html) backends
- `LDAP` : When using the [LDAP](https://www.vaultproject.io/docs/auth/ldap.html) backend
- `TOKEN` : When using the [Tokens](https://www.vaultproject.io/docs/auth/token.html) backend

### Token authentication by header (SSO)

In some cases, users might want to use middleware to authenticate into Vault-UI for purposes like SSO. In this case, the `VAULT_SUPPLIED_TOKEN_HEADER` may be populated with the name of the header that contains a token to be used for authentication.

## Secrets
![Secrets Management](images/Home.png)

## Usage

### Secrets
Secrets are now managed using the graphical [josdejong/jsoneditor](https://github.com/josdejong/jsoneditor) JSON editor. Schema validation is enforced on policies to aid the operator in writing correct syntax.
<img src="images/NewSecret.png" height="500">

Secrets also are accessible directly by key from a browser by navigating to the URI `/secrets/<mount>/<namespace>/key`. For example, if you have a generic secret key of /hello/world/vault using the generic mount `secret`, one can navigate to this directly through http://vault-ui.myorg.com/secrets/secret/hello/world/vault.
Secrets also are accessible directly by key from a browser by navigating to the URI `/secrets/<backendtype>/<mountpoint>/key`. For example, if you have a generic secret key of /hello/world/vault using the _generic_ mount `secret/`, one can navigate to this directly through http://vault-ui.myorg.com/secrets/secret/hello/world/vault.

### Root key bias
#### Root key bias
By default, secrets will display as their raw JSON value represented by the `data` field in the HTTP GET response metadata. However, users can apply a "Root Key" bias to the secrets through the settings page. The "Root Key" will be used when reading, creating and updating secrets such that the value displayed in the UI is the value stored at the "Root Key". For example, if the secret at `secret/hello` is `{ "value": "world" }`, setting the "Root Key" to `value` will update the UI such that the secret will display as simply "world" instead of `{ "value": "world" }`.

<img src="images/RootKey.png" height="180">

## Policies
### Policies
Policies are managed also using the [josdejong/jsoneditor](https://github.com/josdejong/jsoneditor) JSON editor. Currently, GitHub and raw Tokens are the only supported authentication backends for associated policies.

## Token Management
<img src="images/TokenManagement.png" height="500">

Users now have the ability to create and revoke tokens.
<img src="images/NewToken.png" height="500">

## Response Wrapping
Vault-UI supports response-wrapping raw values. It currently does not support wrapping of existing secrets.
<img src="images/ResponseWrapping.png" height="500">
### Token Management
Users have the ability to create and revoke tokens, manage token roles and list accesors.

## Run
Vault-UI Docker images are automatically built using an [automated build on Docker Hub](https://hub.docker.com/r/djenriquez/vault-ui/builds/). We encourage that versioned images are used for production.
To run Vault-UI using the latest Docker image:
```bash
docker run -d \
-p 8000:8000 \
--name vault-ui \
djenriquez/vault-ui
```
### Response Wrapping
Vault-UI supports response-wrapping of secrets in _generic_ backends. Wrapping custom JSON data is also supported.

### Skip TLS Verification
In the case that you need to skip TLS verification, say for self-signed certs, you can run Vault-UI with the environment variable `NODE_TLS_REJECT_UNAUTHORIZED=0`:
```
docker run -d \
-p 8000:8000 \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
--name vault-ui \
djenriquez/vault-ui
```

## Development

Expand All @@ -92,12 +119,8 @@ The following will spin up a Vault UI server only. It will not set up
Vault for you:
```sh
npm install

# If you do not have webpack installed globally
npm install -g webpack

npm run dev-pack &
npm start
webpack -w
```

# Licensing
Expand Down
28 changes: 25 additions & 3 deletions app/App.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react'
import axios from 'axios';
import ReactDOM from 'react-dom';
import Login from './components/Login/Login.jsx';
import { Router, Route, browserHistory } from 'react-router'
import { Router, Route } from 'react-router'
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import { history } from './components/shared/VaultUtils.jsx';
import App from './components/App/App.jsx';
import SecretsGeneric from './components/Secrets/Generic/Generic.jsx';
import PolicyManager from './components/Policies/Manage.jsx';
Expand All @@ -16,6 +18,10 @@ import GithubAuthBackend from './components/Authentication/Github/Github.jsx';
import RadiusAuthBackend from './components/Authentication/Radius/Radius.jsx';
import SecretUnwrapper from './components/shared/Wrapping/Unwrapper';

// Load here to signal webpack
import 'flexboxgrid/dist/flexboxgrid.min.css';
import './assets/favicon.ico';

injectTapEventPlugin();

(function () {
Expand All @@ -34,6 +40,22 @@ injectTapEventPlugin();
window.CustomEvent = CustomEvent;
})();

const checkVaultUiServer = (nextState, replace, callback) => {
// If it's a web deployment, query the server for default connection parameters
// Those can be set using environment variables in the nodejs process
if (WEBPACK_DEF_TARGET_WEB) {
axios.get('/vaultui').then((resp) => {
window.defaultVaultUrl = resp.data.defaultVaultUrl;
window.defaultAuthMethod = resp.data.defaultAuthMethod;
window.defaultBackendPath = resp.data.defaultBackendPath;
window.suppliedAuthToken = resp.data.suppliedAuthToken;
callback();
}).catch((err) => callback())
} else {
callback();
}
}

const checkAccessToken = (nextState, replace, callback) => {
let vaultAuthToken = window.localStorage.getItem('vaultAccessToken');
if (!vaultAuthToken) {
Expand All @@ -49,8 +71,8 @@ const muiTheme = getMuiTheme({

ReactDOM.render((
<MuiThemeProvider muiTheme={muiTheme}>
<Router history={browserHistory}>
<Route path="/login" component={Login} />
<Router history={history}>
<Route path="/login" component={Login} onEnter={checkVaultUiServer} />
<Route path="/unwrap" component={SecretUnwrapper} />
<Route path="/" component={App} onEnter={checkAccessToken}>
<Route path="/secrets/generic/:namespace(/**)" component={SecretsGeneric} />
Expand Down
Binary file added app/assets/favicon.ico
Binary file not shown.
Loading