Commit e9b15488 authored by Johannes Zellner's avatar Johannes Zellner

Port to manifest v2

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