Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
GUACAMOLE-197: Use FileGuacamoleProperty for CA and Key file propeties.
Browse files Browse the repository at this point in the history
  • Loading branch information
necouchman committed Feb 2, 2018
1 parent 6ed4dcd commit 18084c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Expand Up @@ -20,6 +20,7 @@
package org.apache.guacamole.auth.radius;

import com.google.inject.Inject;
import java.io.File;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.environment.Environment;

Expand Down Expand Up @@ -176,9 +177,10 @@ public int getRadiusTimeout() throws GuacamoleException {
* @throws GuacamoleException
* If guacamole.properties cannot be parsed.
*/
public String getRadiusCAFile() throws GuacamoleException {
public File getRadiusCAFile() throws GuacamoleException {
return environment.getProperty(
RadiusGuacamoleProperties.RADIUS_CA_FILE
RadiusGuacamoleProperties.RADIUS_CA_FILE,
new File(environment.getGuacamoleHome(), "ca.crt")
);
}

Expand All @@ -195,10 +197,10 @@ public String getRadiusCAFile() throws GuacamoleException {
* @throws GuacamoleException
* If guacamole.properties cannot be parsed.
*/
public String getRadiusKeyFile() throws GuacamoleException {
public File getRadiusKeyFile() throws GuacamoleException {
return environment.getProperty(
RadiusGuacamoleProperties.RADIUS_KEY_FILE,
"radius.pem"
new File(environment.getGuacamoleHome(), "radius.key")
);
}

Expand Down
Expand Up @@ -27,7 +27,6 @@
import java.security.NoSuchAlgorithmException;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleServerException;
import org.apache.guacamole.environment.LocalEnvironment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.jradius.client.RadiusClient;
Expand Down Expand Up @@ -136,15 +135,13 @@ private RadiusAuthenticator setupRadiusAuthenticator(RadiusClient radiusClient)
radAuth instanceof EAPTTLSAuthenticator) {

// Pull TLS configuration parameters from guacamole.properties
LocalEnvironment guacEnv = new LocalEnvironment();
File guacHome = guacEnv.getGuacamoleHome();
String caFile = confService.getRadiusCAFile();
File caFile = confService.getRadiusCAFile();
String caPassword = confService.getRadiusCAPassword();
String keyFile = confService.getRadiusKeyFile();
File keyFile = confService.getRadiusKeyFile();
String keyPassword = confService.getRadiusKeyPassword();

if (caFile != null) {
((EAPTLSAuthenticator)radAuth).setCaFile((new File(guacHome, caFile)).toString());
((EAPTLSAuthenticator)radAuth).setCaFile(caFile.toString());
((EAPTLSAuthenticator)radAuth).setCaFileType(confService.getRadiusCAType());
if (caPassword != null)
((EAPTLSAuthenticator)radAuth).setCaPassword(caPassword);
Expand All @@ -153,7 +150,7 @@ private RadiusAuthenticator setupRadiusAuthenticator(RadiusClient radiusClient)
if (keyPassword != null)
((EAPTLSAuthenticator)radAuth).setKeyPassword(keyPassword);

((EAPTLSAuthenticator)radAuth).setKeyFile((new File(guacHome, keyFile)).toString());
((EAPTLSAuthenticator)radAuth).setKeyFile(keyFile.toString());
((EAPTLSAuthenticator)radAuth).setKeyFileType(confService.getRadiusKeyType());
((EAPTLSAuthenticator)radAuth).setTrustAll(confService.getRadiusTrustAll());
}
Expand Down
Expand Up @@ -20,6 +20,7 @@
package org.apache.guacamole.auth.radius;

import org.apache.guacamole.properties.BooleanGuacamoleProperty;
import org.apache.guacamole.properties.FileGuacamoleProperty;
import org.apache.guacamole.properties.IntegerGuacamoleProperty;
import org.apache.guacamole.properties.StringGuacamoleProperty;

Expand Down Expand Up @@ -110,7 +111,7 @@ private RadiusGuacamoleProperties() {}
/**
* 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
public String getName() { return "radius-ca-file"; }
Expand Down Expand Up @@ -140,7 +141,7 @@ private RadiusGuacamoleProperties() {}
/**
* 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
public String getName() { return "radius-key-file"; }
Expand Down

0 comments on commit 18084c2

Please sign in to comment.