Commit e9b15488 authored by Johannes Zellner's avatar Johannes Zellner

Port to manifest v2

parent 211fc600
......@@ -12,7 +12,7 @@
"version": "1.1.0",
"healthCheckPath": "/api/healthcheck",
"httpPort": 3000,
"manifestVersion": 1,
"manifestVersion": 2,
"website": "https://git.cloudron.io/cloudron/openvpn-app",
"contactEmail": "arantes555@gmail.com",
"icon": "logo.png",
......@@ -29,7 +29,7 @@
"capabilities": [
"net_admin"
],
"minBoxVersion": "1.8.1",
"minBoxVersion": "4.1.4",
"tcpPorts": {
"VPN_TCP_PORT": {
"title": "VPN TCP port",
......
#!/bin/bash
echo "# Server TCP/${VPN_TCP_PORT:?}
echo "# Server TCP/${CLOUDRON_VPN_TCP_PORT:?}
mode server
tls-server
proto tcp
port ${VPN_TCP_PORT:?}
port ${CLOUDRON_VPN_TCP_PORT:?}
dev tun
dev-node /app/code/net-tun
# Keys and certificates
......@@ -20,7 +20,7 @@ auth SHA256
server 10.8.0.0 255.255.255.0
push \"redirect-gateway def1 bypass-dhcp\"
push \"dhcp-option DNS 10.8.0.1\"
push \"dhcp-option DOMAIN ${APP_DOMAIN}\"
push \"dhcp-option DOMAIN ${CLOUDRON_APP_DOMAIN}\"
client-to-client
keepalive 10 120
# Security
......
......@@ -3,7 +3,7 @@
const ldap = require('ldapjs')
const client = ldap.createClient({
url: process.env.LDAP_URL,
url: process.env.CLOUDRON_LDAP_URL,
timeout: 10000, /* 10 seconds */
reconnect: true /* undocumented option to automatically reconnect on connection failure : https://github.com/joyent/node-ldapjs/issues/318#issuecomment-165769581 */
})
......@@ -16,7 +16,7 @@ const search = (username) => new Promise((resolve, reject) => {
const filter = username
? {filter: `(|(uid=${username})(mail=${username})(username=${username})(sAMAccountName=${username}))`}
: {}
client.search(process.env.LDAP_USERS_BASE_DN, filter, (err, res) => {
client.search(process.env.CLOUDRON_LDAP_USERS_BASE_DN, filter, (err, res) => {
if (err) return reject(err)
const entries = []
......@@ -47,7 +47,7 @@ const auth = (username, password) => search(username)
if (entries.length !== 1) {
throw new Error('Unknown user')
} else {
return bind(`cn=${entries[0].username},${process.env.LDAP_USERS_BASE_DN}`, password)
return bind(`cn=${entries[0].username},${process.env.CLOUDRON_LDAP_USERS_BASE_DN}`, password)
.then(() => ({
id: entries[0].id,
username: entries[0].username,
......
......@@ -55,7 +55,7 @@ client
tls-client
dev tun
proto tcp-client
remote ${process.env.APP_DOMAIN} ${process.env.VPN_TCP_PORT}
remote ${process.env.CLOUDRON_APP_DOMAIN} ${process.env.CLOUDRON_VPN_TCP_PORT}
resolv-retry infinite
cipher AES-256-CBC
auth SHA256
......@@ -191,7 +191,7 @@ const getKey = (req, res, next) => {
configExt = 'ovpn'
} else if (format === 'tblk') {
if (!zip) return next(new HttpError(409, 'Invalid format: cannot disable zip for tblk'))
internalPathPrefix = `${process.env.APP_DOMAIN}-${deviceName}.tblk/Contents/Resources/`
internalPathPrefix = `${process.env.CLOUDRON_APP_DOMAIN}-${deviceName}.tblk/Contents/Resources/`
configExt = 'ovpn'
} else {
return next(new HttpError(409, 'Invalid format'))
......@@ -205,7 +205,7 @@ const getKey = (req, res, next) => {
if (zip) {
res.header('Content-Type', 'application/zip')
res.header('Content-Disposition', `attachment; filename="${process.env.APP_DOMAIN}-${deviceName}-${format}.zip"`)
res.header('Content-Disposition', `attachment; filename="${process.env.CLOUDRON_APP_DOMAIN}-${deviceName}-${format}.zip"`)
const archive = new Archiver('zip')
archive.on('warning', (err) => console.error('ZIP WARNING:', err))
......@@ -233,7 +233,7 @@ const getKey = (req, res, next) => {
])
.then(([ca, cert, key, tlsAuth]) => {
res.header('Content-Type', 'application/data')
res.header('Content-Disposition', `attachment; filename="${process.env.APP_DOMAIN}-${deviceName}.${configExt}"`)
res.header('Content-Disposition', `attachment; filename="${process.env.CLOUDRON_APP_DOMAIN}-${deviceName}.${configExt}"`)
res.send(clientConfFile({
ca,
cert,
......@@ -330,7 +330,7 @@ const onLearnAddress = (req, res, next) => {
const hostname = deviceName + '.' + user
hostnames[vpnIp] = `${hostname} ${hostname}.${process.env.APP_DOMAIN}`
hostnames[vpnIp] = `${hostname} ${hostname}.${process.env.CLOUDRON_APP_DOMAIN}`
} else if (operation === 'delete') {
delete hostnames[vpnIp]
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment