Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
<version>1.6.0</version>
</dependency>

<!-- Hashicorp Vault Extension -->
<dependency>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-vault-hv</artifactId>
<version>1.6.0</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
</includes>
</dependencySet>

<!-- Hashicorp Vault extension .jar -->
<dependencySet>
<outputDirectory>hv</outputDirectory>
<includes>
<include>org.apache.guacamole:guacamole-vault-hv</include>
</includes>
</dependencySet>

</dependencySets>

<!-- Licenses -->
Expand Down
Empty file.
92 changes: 92 additions & 0 deletions extensions/guacamole-vault/modules/guacamole-vault-hv/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-vault-hv</artifactId>
<packaging>jar</packaging>
<version>1.6.0</version>
<name>guacamole-vault-hv</name>
<url>http://guacamole.apache.org/</url>

<parent>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-vault</artifactId>
<version>1.6.0</version>
<relativePath>../../</relativePath>
</parent>

<properties>
<kotlin.version>1.9.25</kotlin.version>
</properties>

<dependencies>

<!-- Guacamole Extension API -->
<dependency>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-ext</artifactId>
<scope>provided</scope>
</dependency>

<!-- Guacamole base key vault support -->
<dependency>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-vault-base</artifactId>
<version>1.6.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.19.0</version>
</dependency>

<!-- Use same version of Kotlin across all dependencies -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>

<!-- Use FIPS variant of Bouncy Castle crypto library -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bc-fips</artifactId>
<version>2.1.0</version>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.guacamole.vault.hv;

import org.apache.guacamole.GuacamoleException;

/**
* A class that is basically equivalent to the standard Supplier class in
* Java, except that the get() function can throw GuacamoleException, which
* is impossible with any of the standard Java lambda type classes, since
* none of them can handle checked exceptions
*
* @param <T>
* The type of object which will be returned as a result of calling
* get().
*/
public interface GuacamoleExceptionSupplier<T> {

/**
* Returns a value of the declared type.
*
* @return
* A value of the declared type.
*
* @throws GuacamoleException
* If an error occurs while attemping to calculate the return value.
*/
public T get() throws GuacamoleException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.guacamole.vault.hv;

import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.vault.VaultAuthenticationProvider;

/**
* VaultAuthenticationProvider implementation which reads secrets from
* Hashicorp Vault
*/
public class HvAuthenticationProvider extends VaultAuthenticationProvider {

/**
* Creates a new HvKeyVaultAuthenticationProvider which reads secrets
* from a configured Hashicorp Vault.
*
* @throws GuacamoleException
* If configuration details cannot be read from guacamole.properties.
*/
public HvAuthenticationProvider() throws GuacamoleException {
super(new HvAuthenticationProviderModule());
}

@Override
public String getIdentifier() {
return "hashicorp-vault";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.guacamole.vault.hv;

import com.google.inject.assistedinject.FactoryModuleBuilder;
import java.security.Security;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.vault.VaultAuthenticationProviderModule;
import org.apache.guacamole.vault.conf.VaultAttributeService;
import org.apache.guacamole.vault.conf.VaultConfigurationService;
import org.apache.guacamole.vault.hv.conf.HvAttributeService;
import org.apache.guacamole.vault.hv.conf.HvConfigurationService;
import org.apache.guacamole.vault.hv.secret.HvClient;
import org.apache.guacamole.vault.hv.secret.HvClientFactory;
import org.apache.guacamole.vault.hv.secret.HvSecretService;
import org.apache.guacamole.vault.hv.user.HvConnectionGroup;
import org.apache.guacamole.vault.hv.user.HvDirectoryService;
import org.apache.guacamole.vault.hv.user.HvUser;
import org.apache.guacamole.vault.hv.user.HvUserFactory;
import org.apache.guacamole.vault.secret.VaultSecretService;
import org.apache.guacamole.vault.user.VaultDirectoryService;
import org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider;

/**
* Guice module which configures injections specific to Hashicorp Vault
* support.
*/
public class HvAuthenticationProviderModule
extends VaultAuthenticationProviderModule {

/**
* Creates a new HvAuthenticationProviderModule which
* configures dependency injection for the Hashicorp Vault
* authentication provider and related services.
*
* @throws GuacamoleException
* If configuration details in guacamole.properties cannot be parsed.
*/
public HvAuthenticationProviderModule() throws GuacamoleException {
Security.addProvider(new BouncyCastleFipsProvider());
}

@Override
protected void configureVault() {

// Bind services specific to Hashicorp Vault
bind(HvAttributeService.class);
bind(VaultAttributeService.class).to(HvAttributeService.class);
bind(VaultConfigurationService.class).to(HvConfigurationService.class);
bind(VaultSecretService.class).to(HvSecretService.class);
bind(VaultDirectoryService.class).to(HvDirectoryService.class);

// Bind factory for creating HV Clients
install(new FactoryModuleBuilder()
.implement(HvClient.class, HvClient.class)
.build(HvClientFactory.class));

// Bind factory for creating HvUsers
install(new FactoryModuleBuilder()
.implement(HvUser.class, HvUser.class)
.build(HvUserFactory.class));
}

}
Loading
Loading