mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-197: Use FileGuacamoleProperty for CA and Key file propeties.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
package org.apache.guacamole.auth.radius;
|
package org.apache.guacamole.auth.radius;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import java.io.File;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.environment.Environment;
|
import org.apache.guacamole.environment.Environment;
|
||||||
|
|
||||||
@@ -176,9 +177,10 @@ public class ConfigurationService {
|
|||||||
* @throws GuacamoleException
|
* @throws GuacamoleException
|
||||||
* If guacamole.properties cannot be parsed.
|
* If guacamole.properties cannot be parsed.
|
||||||
*/
|
*/
|
||||||
public String getRadiusCAFile() throws GuacamoleException {
|
public File getRadiusCAFile() throws GuacamoleException {
|
||||||
return environment.getProperty(
|
return environment.getProperty(
|
||||||
RadiusGuacamoleProperties.RADIUS_CA_FILE
|
RadiusGuacamoleProperties.RADIUS_CA_FILE,
|
||||||
|
new File(environment.getGuacamoleHome(), "ca.crt")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,10 +197,10 @@ public class ConfigurationService {
|
|||||||
* @throws GuacamoleException
|
* @throws GuacamoleException
|
||||||
* If guacamole.properties cannot be parsed.
|
* If guacamole.properties cannot be parsed.
|
||||||
*/
|
*/
|
||||||
public String getRadiusKeyFile() throws GuacamoleException {
|
public File getRadiusKeyFile() throws GuacamoleException {
|
||||||
return environment.getProperty(
|
return environment.getProperty(
|
||||||
RadiusGuacamoleProperties.RADIUS_KEY_FILE,
|
RadiusGuacamoleProperties.RADIUS_KEY_FILE,
|
||||||
"radius.pem"
|
new File(environment.getGuacamoleHome(), "radius.key")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,7 +27,6 @@ import java.net.UnknownHostException;
|
|||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
import org.apache.guacamole.environment.LocalEnvironment;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import net.jradius.client.RadiusClient;
|
import net.jradius.client.RadiusClient;
|
||||||
@@ -136,15 +135,13 @@ public class RadiusConnectionService {
|
|||||||
radAuth instanceof EAPTTLSAuthenticator) {
|
radAuth instanceof EAPTTLSAuthenticator) {
|
||||||
|
|
||||||
// Pull TLS configuration parameters from guacamole.properties
|
// Pull TLS configuration parameters from guacamole.properties
|
||||||
LocalEnvironment guacEnv = new LocalEnvironment();
|
File caFile = confService.getRadiusCAFile();
|
||||||
File guacHome = guacEnv.getGuacamoleHome();
|
|
||||||
String caFile = confService.getRadiusCAFile();
|
|
||||||
String caPassword = confService.getRadiusCAPassword();
|
String caPassword = confService.getRadiusCAPassword();
|
||||||
String keyFile = confService.getRadiusKeyFile();
|
File keyFile = confService.getRadiusKeyFile();
|
||||||
String keyPassword = confService.getRadiusKeyPassword();
|
String keyPassword = confService.getRadiusKeyPassword();
|
||||||
|
|
||||||
if (caFile != null) {
|
if (caFile != null) {
|
||||||
((EAPTLSAuthenticator)radAuth).setCaFile((new File(guacHome, caFile)).toString());
|
((EAPTLSAuthenticator)radAuth).setCaFile(caFile.toString());
|
||||||
((EAPTLSAuthenticator)radAuth).setCaFileType(confService.getRadiusCAType());
|
((EAPTLSAuthenticator)radAuth).setCaFileType(confService.getRadiusCAType());
|
||||||
if (caPassword != null)
|
if (caPassword != null)
|
||||||
((EAPTLSAuthenticator)radAuth).setCaPassword(caPassword);
|
((EAPTLSAuthenticator)radAuth).setCaPassword(caPassword);
|
||||||
@@ -153,7 +150,7 @@ public class RadiusConnectionService {
|
|||||||
if (keyPassword != null)
|
if (keyPassword != null)
|
||||||
((EAPTLSAuthenticator)radAuth).setKeyPassword(keyPassword);
|
((EAPTLSAuthenticator)radAuth).setKeyPassword(keyPassword);
|
||||||
|
|
||||||
((EAPTLSAuthenticator)radAuth).setKeyFile((new File(guacHome, keyFile)).toString());
|
((EAPTLSAuthenticator)radAuth).setKeyFile(keyFile.toString());
|
||||||
((EAPTLSAuthenticator)radAuth).setKeyFileType(confService.getRadiusKeyType());
|
((EAPTLSAuthenticator)radAuth).setKeyFileType(confService.getRadiusKeyType());
|
||||||
((EAPTLSAuthenticator)radAuth).setTrustAll(confService.getRadiusTrustAll());
|
((EAPTLSAuthenticator)radAuth).setTrustAll(confService.getRadiusTrustAll());
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
package org.apache.guacamole.auth.radius;
|
package org.apache.guacamole.auth.radius;
|
||||||
|
|
||||||
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
|
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
|
||||||
|
import org.apache.guacamole.properties.FileGuacamoleProperty;
|
||||||
import org.apache.guacamole.properties.IntegerGuacamoleProperty;
|
import org.apache.guacamole.properties.IntegerGuacamoleProperty;
|
||||||
import org.apache.guacamole.properties.StringGuacamoleProperty;
|
import org.apache.guacamole.properties.StringGuacamoleProperty;
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ public class RadiusGuacamoleProperties {
|
|||||||
/**
|
/**
|
||||||
* The CA file to use to validate RADIUS server certificates.
|
* The CA file to use to validate RADIUS server certificates.
|
||||||
*/
|
*/
|
||||||
public static final StringGuacamoleProperty RADIUS_CA_FILE = new StringGuacamoleProperty() {
|
public static final FileGuacamoleProperty RADIUS_CA_FILE = new FileGuacamoleProperty() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return "radius-ca-file"; }
|
public String getName() { return "radius-ca-file"; }
|
||||||
@@ -140,7 +141,7 @@ public class RadiusGuacamoleProperties {
|
|||||||
/**
|
/**
|
||||||
* The file that stores the key/certificate pair to use for the RADIUS client connection.
|
* The file that stores the key/certificate pair to use for the RADIUS client connection.
|
||||||
*/
|
*/
|
||||||
public static final StringGuacamoleProperty RADIUS_KEY_FILE = new StringGuacamoleProperty() {
|
public static final FileGuacamoleProperty RADIUS_KEY_FILE = new FileGuacamoleProperty() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return "radius-key-file"; }
|
public String getName() { return "radius-key-file"; }
|
||||||
|
Reference in New Issue
Block a user