Skip to content
Snippets Groups Projects
Commit 67f7aabd authored by Antoine Leblanc's avatar Antoine Leblanc Committed by Romain Soufflet
Browse files

Add Guacamole RDP options settable (#476)

* Add RDP Guacamole options

* Use a loop in guacamole-client
parent 22c1dbe1
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,22 @@ Once loaded, Nanocloud will be accessible on **localhost**.
- ldapBaseDn (defaults to empty string)
- ldapDefaultGroup (defaults to empty string (no default group)) id of the group users should be attached to automatically
## RDP/Guacamole Options
You can use RDP options detailed on [Guacamole documentation](http://guacamole.incubator.apache.org/doc/gug/configuring-guacamole.html#rdp). Use config variables with 'rdp' prefix and option name in camel case.
All options are Guacamole defaults except the following:
- rdpSecurity (Nanocloud defaults to nla)
- rdpIgnoreCert (Nanocloud defaults to true)
- rdpWidth (Nanocloud defaults to 0 (automatic))
- rdpHeight (Nanocloud defaults to 0 (automatic))
- rdpDpi (Nanocloud defaults to 0 (automatic))
- rdpEnablePrinting (Nanocloud defaults to true)
- rdpPreconnectionID (Nanocloud defaults to 0 (desactivated))
- rdpEnableWallpaper (Nanocloud defaults to true)
- rdpEnableFontSmooting (Nanocloud defaults to true)
# Run in developer mode
Nanocloud also relies on Docker to run its development stack:
......
......@@ -228,9 +228,49 @@ module.exports = {
}),
user: User.findOne({
id: req.user.id
})
}),
config: ConfigService.get(
'rdpDomain',
'rdpSecurity',
'rdpIgnoreCert',
'rdpDisableAuth',
'rdpClientName',
'rdpConsole',
'rdpInitialProgram',
'rdpServerLayout',
'rdpColorDepth',
'rdpWidth',
'rdpHeight',
'rdpDpi',
'rdpDisableAudio',
'rdpEnablePrinting',
'rdpEnableDrive',
'rdpDrivePath',
'rdpCreateDrivePath',
'rdpConsoleAudio',
'rdpStaticChannels',
'rdpPreconnectionId',
'rdpPreconnectionBlob',
'rdpEnableSftp',
'rdpSftpHostname',
'rdpSftpPort',
'rdpSftpUsername',
'rdpSftpPassword',
'rdpSftpPrivateKey',
'rdpSftpPassphrase',
'rdpSftpDirectory',
'rdpEnableWallpaper',
'rdpEnableTheming',
'rdpEnableFontSmoothing',
'rdpEnableFullWindowDrag',
'rdpEnableDesktopComposition',
'rdpEnableMenuAnimations',
'rdpRemoteApp',
'rdpRemoteAppDir',
'rdpRemoteAppArgs'
)
})
.then(({machine, user}) => {
.then(({machine, user, config}) => {
let username = null;
let password = null;
......@@ -245,17 +285,56 @@ module.exports = {
if (machine) {
image.apps.forEach((app) => {
connections.push({
protocol: 'rdp',
id: app.id,
hostname: machine.ip,
machineId: machine.id,
machineType: machine.flavor,
machineDriver: machine.type,
port: machine.rdpPort,
username: username,
password: password,
'remote-app': '',
protocol: 'rdp',
'app-name': app.id
'app-name': app.id,
'rdp-options': {
hostname: machine.ip,
port: machine.rdpPort,
username: username,
password: password,
domain: config.rdpDomain,
security: config.rdpSecurity,
'ignore-cert': config.rdpIgnoreCert,
'disable-auth': config.rdpDisableAuth,
'client-name': config.rdpClientName,
console: config.rdpConsole,
'initial-program': config.rdpInitialProgram,
'server-layout': config.rdpServerLayout,
'color-depth': config.rdpColorDepth,
width: config.rdpWidth,
height: config.rdpHeight,
dpi: config.rdpDpi,
'disable-audio': config.rdpDisableAudio,
'enable-printing': config.rdpEnablePrinting,
'enable-drive': config.rdpEnableDrive,
'drive-path': config.rdpDrivePath,
'create-drive-path': config.rdpDrivePath,
'console-audio': config.rdpConsoleAudio,
'static-channels': config.rdpStaticChannels,
'preconnection-id': config.rdpPreconnectionId,
'preconnection-blob': config.rdpPreconnectionBlob,
'enable-sftp': config.rdpEnableSftp,
'sftp-hostname': config.rdpSftpHostname,
'sftp-port': config.rdpSftpPort,
'sftp-username': config.rdpSftpUsername,
'sftp-password': config.rdpSftpPassword,
'sftp-private-key': config.rdpSftpPrivateKey,
'sftp-passphrase': config.rdpSftpPassphrase,
'sftp-directory': config.rdpSftpDirectory,
'enable-wallpaper': config.rdpEnableWallpaper,
'enable-theming': config.rdpEnableTheming,
'enable-font-smoothing': config.rdpEnableFontSmoothing,
'enable-full-window-drag': config.rdpEnableFullWindowDrag,
'enable-desktop-composition': config.rdpEnableDesktopComposition,
'enable-menu-animations': config.rdpEnableMenuAnimations,
'remote-app': config.rdpRemoteApp,
'remote-app-dir': config.rdpRemoteAppDir,
'remote-app-args': config.rdpRemoteAppArgs
}
});
});
}
......
......@@ -258,7 +258,7 @@ class AWSDriver extends Driver {
*/
createMachine(machine, image) {
return ConfigService.get('awsFlavor', 'plazaURI', 'awsKeyName', 'plazaPort',
'awsMachineSubnet', 'awsDiskSize', 'awsMachineUsername')
'awsMachineSubnet', 'awsDiskSize', 'awsMachineUsername', 'rdpPort')
.then((config) => {
let userData = new Buffer(`<powershell>
......@@ -334,7 +334,7 @@ class AWSDriver extends Driver {
password : null,
domain : '',
plazaport : config.plazaPort,
rdpPort : 3389
rdpPort : config.rdpPort
});
return resolve(machineModel);
});
......
......@@ -101,7 +101,7 @@ class OpenstackDriver extends Driver {
*/
createMachine(options) {
return ConfigService.get(
'openstackImage', 'openstackFlavor', 'openstackSecurityGroups',
'openstackImage', 'openstackFlavor', 'openstackSecurityGroups', 'rdpPort',
'openstackMachineUsername', 'openstackMachinePassword', 'plazaURI', 'plazaPort'
)
.then((config) => {
......@@ -180,7 +180,7 @@ class OpenstackDriver extends Driver {
password : password,
domain : '',
plazaport : config.plazaPort,
rdpPort : 3389
rdpPort : config.rdpPort
});
return resolve(machine);
......
......@@ -127,6 +127,46 @@ module.exports = {
ldapBaseDn: 'dc=nanocloud,dc=com',
defaultGroupLdap: '',
rdpPort: 3389,
rdpDomain: '',
rdpSecurity: 'nla',
rdpIgnoreCert: true,
rdpDisableAuth: false,
rdpClientName: '',
rdpConsole: false,
rdpInitialProgram: '',
rdpServerLayout: 'en-us-qwerty',
rdpColorDepth: '',
rdpWidth: 0,
rdpHeight: 0,
rdpDpi: 0,
rdpDisableAudio: false,
rdpEnablePrinting: true,
rdpEnableDrive: false,
rdpDrivePath: '',
rdpCreateDrivePath: false,
rdpConsoleAudio: false,
rdpStaticChannels: '',
rdpPreconnectionId: 0,
rdpPreconnectionBlob: '',
rdpEnableSftp: false,
rdpSftpHostname: '',
rdpSftpPort: 0,
rdpSftpUsername: '',
rdpSftpPassword: '',
rdpSftpPrivateKey: '',
rdpSftpPassphrase: '',
rdpSftpDirectory: '',
rdpEnableWallpaper: true,
rdpEnableTheming: true,
rdpEnableFontSmoothing: true,
rdpEnableFullWindowDrag: false,
rdpEnableDesktopComposition: false,
rdpEnableMenuAnimations: false,
rdpRemoteApp: '',
rdpRemoteAppDir: '',
rdpRemoteAppArgs: '',
testMail: false,
dummyBootingState: false
}
......
......@@ -185,20 +185,20 @@ public class UserContext implements org.glyptodon.guacamole.net.auth.UserContext
GuacamoleConfiguration config = new GuacamoleConfiguration();
config.setProtocol(connection.getJSONObject("attributes").getString("protocol"));
config.setParameter("hostname", connection.getJSONObject("attributes").getString("hostname"));
config.setParameter("port", connection.getJSONObject("attributes").getString("port"));
config.setParameter("username", connection.getJSONObject("attributes").getString("username"));
config.setParameter("password", connection.getJSONObject("attributes").getString("password"));
config.setParameter("security", "nla");
config.setParameter("ignore-cert", "true");
config.setParameter("enable-printing", "true");
config.setParameter("enable-font-smoothing", "true");
config.setParameter("enable-wallpaper", "true");
if (connection.getJSONObject("attributes").has("remote-app")) {
config.setParameter("remote-app", connection.getJSONObject("attributes").getString("remote-app"));
}
configs.put(connection.getJSONObject("attributes").getString("app-name"), config);
Iterator keys = connection.getJSONObject("attributes").getJSONObject("rdp-options").keys();
String key;
while (keys.hasNext()) {
key = (String)keys.next();
if (key.equals("width") || key.equals("height") || key.equals("dpi") || key.equals("preconnection-id")) {
if (!connection.getJSONObject("attributes").getJSONObject("rdp-options").getString(key).equals("0")) {
config.setParameter(key, connection.getJSONObject("attributes").getJSONObject("rdp-options").getString(key));
}
} else {
config.setParameter(key, connection.getJSONObject("attributes").getJSONObject("rdp-options").getString(key));
}
}
}
return configs;
......
......@@ -498,32 +498,126 @@ module.exports = function() {
'type': 'apps',
'id': app2,
'attributes': {
'hostname': '127.0.0.1',
'port': 3389,
'username': 'Administrator',
'password': null,
'remote-app': '',
'protocol': 'rdp',
'app-name': app2,
'machine-id': machine.id,
'machine-type': 'dummy',
'machine-driver': 'dummy'
'machine-driver': 'dummy',
'app-name': app2,
'rdp-options': {
'hostname': '127.0.0.1',
'port': 3389,
'username': 'Administrator',
'password': null,
'domain': '',
'security': 'nla',
'ignore-cert': true,
'disable-auth': false,
'client-name': '',
'console': false,
'initial-program': '',
'server-layout': 'en-us-qwerty',
'color-depth': '',
'width': 0,
'height': 0,
'dpi': 0,
'disable-audio': false,
'enable-printing': true,
'enable-drive': false,
'drive-path': '',
'create-drive-path': '',
'console-audio': false,
'static-channels': '',
'preconnection-id': 0,
'preconnection-blob': '',
'enable-sftp': false,
'sftp-hostname': '',
'sftp-port': 0,
'sftp-username': '',
'sftp-password': '',
'sftp-private-key': '',
'sftp-passphrase': '',
'sftp-directory': '',
'enable-wallpaper': true,
'enable-theming': true,
'enable-font-smoothing': true,
'enable-full-window-drag': false,
'enable-desktop-composition': false,
'enable-menu-animations': false,
'remote-app': '',
'remote-app-dir': '',
'remote-app-args': ''
}
},
relationships: {
image: {
data: null
},
groups: {
data: null
}
}
});
expect(res.body.data).to.include({
'type': 'apps',
'id': app1,
'attributes': {
'hostname': '127.0.0.1',
'port': 3389,
'username': 'Administrator',
'password': null,
'remote-app': '',
'protocol': 'rdp',
'app-name': app1,
'machine-id': machine.id,
'machine-type': 'dummy',
'machine-driver': 'dummy'
'machine-driver': 'dummy',
'app-name': app1,
'rdp-options': {
'hostname': '127.0.0.1',
'port': 3389,
'username': 'Administrator',
'password': null,
'domain': '',
'security': 'nla',
'ignore-cert': true,
'disable-auth': false,
'client-name': '',
'console': false,
'initial-program': '',
'server-layout': 'en-us-qwerty',
'color-depth': '',
'width': 0,
'height': 0,
'dpi': 0,
'disable-audio': false,
'enable-printing': true,
'enable-drive': false,
'drive-path': '',
'create-drive-path': '',
'console-audio': false,
'static-channels': '',
'preconnection-id': 0,
'preconnection-blob': '',
'enable-sftp': false,
'sftp-hostname': '',
'sftp-port': 0,
'sftp-username': '',
'sftp-password': '',
'sftp-private-key': '',
'sftp-passphrase': '',
'sftp-directory': '',
'enable-wallpaper': true,
'enable-theming': true,
'enable-font-smoothing': true,
'enable-full-window-drag': false,
'enable-desktop-composition': false,
'enable-menu-animations': false,
'remote-app': '',
'remote-app-dir': '',
'remote-app-args': ''
}
},
relationships: {
image: {
data: null
},
groups: {
data: null
}
}
});
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment