Skip to content
Permalink
Browse files

Access polish, import v1 stsarted

  • Loading branch information...
Jamie Curnow
Jamie Curnow committed Aug 20, 2018
1 parent 7d9e716 commit 8d925deeb03866da6c2ecc535b9ac3bed4fc40c5
@@ -10,3 +10,5 @@ data/*
yarn-error.log
yarn.lock
tmp
certbot.log

@@ -6,25 +6,25 @@
![Stars](https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge)
![Pulls](https://img.shields.io/docker/pulls/jc21/nginx-proxy-manager.svg?style=for-the-badge)

**NOTE: Version 2 is a work in progress. Not all of the areas are complete and is definitely not ready for production use.**

This project comes as a pre-built docker image that enables you to easily forward to your websites
running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.

----------

**WARNING: Version 2 a complete rewrite!** If you are using the `latest` docker tag and update to version 2
without preparation, horrible things might happen. Refer to the [Migrating Documentation](doc/MIGRATING.md).

----------

## Features

- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io/)
- Easily create forwarding domains, redirections, streams and 404 hosts without knowing anything about Nginx
- Free SSL using Let's Encrypt or provide your own custom SSL certificates
- Access Lists and basic HTTP Authentication for your hosts
- Advanced Nginx configuration available for super users
- -Advanced Nginx configuration available for super users- TODO
- User management, permissions and audit log

#### Future Features

- Live log tail


## Screenshots

@@ -2,16 +2,16 @@

In order of importance, somewhat..

- Manual certificate writing to disk and usage in nginx configs - MIGRATING.md
- Access Lists UI and Nginx usage
- Make modal dialogs unclosable in overlay
- Custom ssl certificate saving to disk and usage in nginx configs
- Dashboard stats are caching instead of querying
- Create a nice way of importing from v1 let's encrypt certs and config data
- UI Log tail
- Custom Nginx Config Editor

Testing
Testing:

- Access Levels
- Adding a proxy host without access to read certs or access lists
- Visibility
- Forwarding
- Cert renewals
@@ -3,7 +3,6 @@
There's a few ways to configure this app depending on:

- Whether you use `docker-compose` or vanilla docker
- Which Database you want to use (mysql or postgres)
- Which architecture you're running it on (raspberry pi also supported)

### Configuration File
@@ -12,9 +11,9 @@ There's a few ways to configure this app depending on:

Don't worry, this is easy to do.

The app requires a configuration file to let it know what database you're using and where it is.
The app requires a configuration file to let it know what database you're using.

Here's an example configuration for `mysql`:
Here's an example configuration for `mysql` (or mariadb):

```json
{
@@ -29,22 +28,6 @@ Here's an example configuration for `mysql`:
}
```

and here's one for `postgres`:

```json
{
"database": {
"engine": "pg",
"version": "7.2",
"host": "127.0.0.1",
"name": "nginxproxymanager",
"user": "nginxproxymanager",
"password": "password123",
"port": 5432
}
}
```

Once you've created your configuration file it's easy to mount it in the docker container, examples below.

**Note:** After the first run of the application, the config file will be altered to include generated encryption keys unique to your installation. These keys
@@ -138,3 +121,24 @@ docker run -d \
-v /path/to/letsencrypt:/etc/letsencrypt \
jc21/nginx-proxy-manager:2-armhf
```


### Initial Run

After the app is running for the first time, the following will happen:

- The database will initialize with table structures
- GPG keys will be generated and saved in the configuration file
- A default admin user will be created

This process can take a couple of minutes depending on your machine.


### Default Administrator User

```
Email: admin@example.com
Password: changeme
```

Immediately after logging in with this default user you will be asked to modify your details and change your password.
@@ -41,6 +41,7 @@
"body-parser": "^1.18.3",
"compression": "^1.7.2",
"config": "^2.0.1",
"diskdb": "^0.1.17",
"ejs": "^2.6.1",
"express": "^4.16.3",
"express-fileupload": "^0.4.0",
@@ -56,7 +57,6 @@
"node-rsa": "^1.0.0",
"objection": "^1.1.10",
"path": "^0.12.7",
"pg": "^7.4.3",
"restler": "^3.4.0",
"signale": "^1.2.1",
"temp-write": "^3.4.0",
@@ -4,4 +4,3 @@ mkdir -p /data/letsencrypt-acme-challenge

cd /app
node --abort_on_uncaught_exception --max_old_space_size=250 /app/src/backend/index.js

@@ -2,9 +2,16 @@

mkdir -p /tmp/nginx/body \
/var/log/nginx \
/data/{nginx,logs,access} \
/data/nginx/{proxy_host,redirection_host,stream,dead_host,temp} \
/var/lib/nginx/cache/{public,private}
/data/nginx \
/data/logs \
/data/access \
/data/nginx/proxy_host \
/data/nginx/redirection_host \
/data/nginx/stream \
/data/nginx/dead_host \
/data/nginx/temp \
/var/lib/nginx/cache/public \
/var/lib/nginx/cache/private

touch /var/log/nginx/error.log && chmod 777 /var/log/nginx/error.log
chown root /tmp/nginx
@@ -0,0 +1,68 @@
'use strict';

const fs = require('fs');
const logger = require('./logger').import;
const utils = require('./lib/utils');

module.exports = function () {
return new Promise((resolve, reject) => {
if (fs.existsSync('/config') && !fs.existsSync('/config/v2-imported')) {

logger.info('Beginning import from V1 ...');

// Setup
const batchflow = require('batchflow');
const db = require('diskdb');
module.exports = db.connect('/config', ['hosts', 'access']);

// Create a fake access object
const Access = require('./lib/access');
let access = new Access(null);
resolve(access.load(true)
.then(access => {



// Import access lists first
let lists = db.access.find();
lists.map(list => {
logger.warn('List:', list);

});

})
);

/*
let hosts = db.hosts.find();
hosts.map(host => {
logger.warn('Host:', host);
});
*/

// Looks like we need to import from version 1
// There are numerous parts to this import:
//
// 1. The letsencrypt certificates, the need to be added to the database and files renamed
// 2. The access lists from the previous datastore
// 3. The Hosts from the previous datastore

// get all hosts:
// resolve(db.hosts.find());

// get specific host:
// existing_host = db.hosts.findOne({incoming_port: payload.incoming_port});

// remove host:
// db.hosts.remove({hostname: payload.hostname});

// get all access:
// resolve(db.access.find());

resolve();

} else {
resolve();
}
});
};
@@ -7,14 +7,14 @@ const logger = require('./logger').global;
function appStart () {
const migrate = require('./migrate');
const setup = require('./setup');
const importer = require('./importer');
const app = require('./app');
const apiValidator = require('./lib/validator/api');
const internalCertificate = require('./internal/certificate');

return migrate.latest()
.then(() => {
return setup();
})
.then(setup)
.then(importer)
.then(() => {
return apiValidator.loadSchemas;
})
Oops, something went wrong.

0 comments on commit 8d925de

Please sign in to comment.
You can’t perform that action at this time.