You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2022/01/23 07:05:53 UTC

[GitHub] [guacamole-client] mike-jumper opened a new pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

mike-jumper opened a new pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689


   This change builds off the changes originally proposed via #336, adding:
   
   1. Dynamic retrieval of secrets based on existing connection parameter contents, where the vault implementation has enough structural information to provide this.
   2. Retrieval of `guacamole.properties` values from the vault.
   3. Support for the Keeper Secrets Manager vault.
   
   I was recently tasked with implemented support for the Keeper Secrets Manager vault as part of my day job, which conveniently gives us a way to move forward with key vault support while we await the missing license information for Azure Key Vault. I went ahead and temporarily removed the Azure portion of these changes in a single, final commit so that we can simply revert it when ready.
   
   Note that these changes depend on #687 to function. The Keeper library and the Bouncy Castle FIPS library both depend on being able to read their own .jar files, which cannot work correctly with the old method of unpacking and mingling all dependencies directly into the extension .jar file.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] jmuehlner commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792304584



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -273,6 +347,34 @@ public void filterValues(Map<?, String> map) {
             String value = entry.getValue();
             if (value != null)
                 entry.setValue(filter(value));
+
+        }
+
+    }
+
+    /**
+     * Given an arbitrary map containing String values, replace each non-null
+     * value with the corresponding filtered value. If any token in any string
+     * has no defined value within this TokenFilter, a
+     * GuacamoleTokenUndefinedException will be thrown.
+     *
+     * @param map
+     *     The map whose values should be filtered.
+     *
+     * @throws GuacamoleTokenUndefinedException
+     *     If at least one token in at least one string has no corresponding
+     *     value.
+     */
+    public void filterValuesStrict(Map<?, String> map)

Review comment:
       I think this API might be a little more straightforward if there were a 1 and 2 argument version each of `filterValue` and `filterValues`, with the 1-argument version passing `false` for the `strict` parameter. That would also reduce the duplicated iteration code in this function.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] jmuehlner commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792309324



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -247,19 +269,71 @@ public String filter(String input) {
 
             // Update last regex match
             endOfLastMatch = tokenMatcher.end();
-            
+
         }
 
         // Append any remaining non-token text
         output.append(input.substring(endOfLastMatch));
-        
+
         return output.toString();
-       
+
+    }
+
+    /**
+     * Filters the given string, replacing any tokens with their corresponding
+     * values. Any tokens present in the given string which lack values will
+     * be interpreted as literals.
+     *
+     * @param input
+     *     The string to filter.
+     *
+     * @return
+     *     A copy of the input string, with any tokens replaced with their
+     *     corresponding values.
+     */
+    public String filter(String input) {

Review comment:
       Ahh right, gotcha. That makes sense.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792309341



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -273,6 +347,34 @@ public void filterValues(Map<?, String> map) {
             String value = entry.getValue();
             if (value != null)
                 entry.setValue(filter(value));
+
+        }
+
+    }
+
+    /**
+     * Given an arbitrary map containing String values, replace each non-null
+     * value with the corresponding filtered value. If any token in any string
+     * has no defined value within this TokenFilter, a
+     * GuacamoleTokenUndefinedException will be thrown.
+     *
+     * @param map
+     *     The map whose values should be filtered.
+     *
+     * @throws GuacamoleTokenUndefinedException
+     *     If at least one token in at least one string has no corresponding
+     *     value.
+     */
+    public void filterValuesStrict(Map<?, String> map)

Review comment:
       (See above - this would end up requiring exception handling on the part of the developer even though it's known the exception would never be thrown).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] jmuehlner commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792295253



##########
File path: extensions/guacamole-vault/modules/guacamole-vault-base/src/main/java/org/apache/guacamole/vault/VaultAuthenticationProviderModule.java
##########
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.environment.LocalEnvironment;
+import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.vault.user.VaultUserContext;
+import org.apache.guacamole.vault.user.VaultUserContextFactory;
+
+/**
+ * Guice module which configures injections specific to the base support for
+ * key vaults. When adding support for a key vault provider, a subclass
+ * specific to that vault implementation will need to be created.
+ *
+ * @see AzureKeyVaultAuthenticationProviderModule

Review comment:
       See it ... where? I don't see this class anywhere.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] jmuehlner commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
jmuehlner commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792303764



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -247,19 +269,71 @@ public String filter(String input) {
 
             // Update last regex match
             endOfLastMatch = tokenMatcher.end();
-            
+
         }
 
         // Append any remaining non-token text
         output.append(input.substring(endOfLastMatch));
-        
+
         return output.toString();
-       
+
+    }
+
+    /**
+     * Filters the given string, replacing any tokens with their corresponding
+     * values. Any tokens present in the given string which lack values will
+     * be interpreted as literals.
+     *
+     * @param input
+     *     The string to filter.
+     *
+     * @return
+     *     A copy of the input string, with any tokens replaced with their
+     *     corresponding values.
+     */
+    public String filter(String input) {

Review comment:
       Why not roll this functionality into the 2-argiment `filter` method? Having another method with the same name that works _sort of_ but not _exactly like_ `filter(*, false)` is honestly a little confusing.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792309058



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -247,19 +269,71 @@ public String filter(String input) {
 
             // Update last regex match
             endOfLastMatch = tokenMatcher.end();
-            
+
         }
 
         // Append any remaining non-token text
         output.append(input.substring(endOfLastMatch));
-        
+
         return output.toString();
-       
+
+    }
+
+    /**
+     * Filters the given string, replacing any tokens with their corresponding
+     * values. Any tokens present in the given string which lack values will
+     * be interpreted as literals.
+     *
+     * @param input
+     *     The string to filter.
+     *
+     * @return
+     *     A copy of the input string, with any tokens replaced with their
+     *     corresponding values.
+     */
+    public String filter(String input) {

Review comment:
       Ah - because that would require all callers of `filter()` to handle the possible exception, even when there will not be one in the `false` case. There was some discussion on this in #336 (look for resolved conversations regarding `TokenFilter.java - linking to the conversation directly appears to not work for resolved discussions 🤷).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] jmuehlner merged pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
jmuehlner merged pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792309058



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/token/TokenFilter.java
##########
@@ -247,19 +269,71 @@ public String filter(String input) {
 
             // Update last regex match
             endOfLastMatch = tokenMatcher.end();
-            
+
         }
 
         // Append any remaining non-token text
         output.append(input.substring(endOfLastMatch));
-        
+
         return output.toString();
-       
+
+    }
+
+    /**
+     * Filters the given string, replacing any tokens with their corresponding
+     * values. Any tokens present in the given string which lack values will
+     * be interpreted as literals.
+     *
+     * @param input
+     *     The string to filter.
+     *
+     * @return
+     *     A copy of the input string, with any tokens replaced with their
+     *     corresponding values.
+     */
+    public String filter(String input) {

Review comment:
       Ah - because that would require all callers of `filter()` to handle the possible exception, even when there will not be one in the `false` case. There was some discussion on this in #336 (look for resolved conversations regarding `TokenFilter.java` - linking to the conversation directly appears to not work for resolved discussions 🤷).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792295403



##########
File path: extensions/guacamole-vault/modules/guacamole-vault-base/src/main/java/org/apache/guacamole/vault/VaultAuthenticationProviderModule.java
##########
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.environment.LocalEnvironment;
+import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.vault.user.VaultUserContext;
+import org.apache.guacamole.vault.user.VaultUserContextFactory;
+
+/**
+ * Guice module which configures injections specific to the base support for
+ * key vaults. When adding support for a key vault provider, a subclass
+ * specific to that vault implementation will need to be created.
+ *
+ * @see AzureKeyVaultAuthenticationProviderModule

Review comment:
       Thaaaat's ... fair. I'll correct these references to point to things that still exist in the current set of changes.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #689: GUACAMOLE-641: Add support for reading secrets from key vaults.

Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #689:
URL: https://github.com/apache/guacamole-client/pull/689#discussion_r792296504



##########
File path: extensions/guacamole-vault/modules/guacamole-vault-base/src/main/java/org/apache/guacamole/vault/VaultAuthenticationProviderModule.java
##########
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.environment.LocalEnvironment;
+import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.vault.user.VaultUserContext;
+import org.apache.guacamole.vault.user.VaultUserContextFactory;
+
+/**
+ * Guice module which configures injections specific to the base support for
+ * key vaults. When adding support for a key vault provider, a subclass
+ * specific to that vault implementation will need to be created.
+ *
+ * @see AzureKeyVaultAuthenticationProviderModule

Review comment:
       OK - fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org