You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/17 13:28:58 UTC

[GitHub] [camel-quarkus] squakez opened a new pull request #1802: feat(ssh): promoting native extension

squakez opened a new pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802


   Closes #798


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490810888



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }

Review comment:
       Yeah, I was in doubt if it belongs there. Thanks for confirming, I am going to move it accordingly.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton merged pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
jamesnetherton merged pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802


   


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#issuecomment-694929524


   The failing check does not seem related to this PR, any possibility to rerun it?


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490812043



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }
+
+    @BuildStep
+    RuntimeInitializedClassBuildItem delayEdDSAConfiguration() {
+        return new RuntimeInitializedClassBuildItem(EdDSASecurityProviderUtils.class.getCanonicalName());
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(
+                new ReflectiveClassBuildItem(
+                        true,
+                        false,
+                        KeyPairGenerator.class.getCanonicalName(),

Review comment:
       you may also remove the `.getName()` AFAIK




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490348655



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }
+
+    @BuildStep
+    RuntimeInitializedClassBuildItem delayEdDSAConfiguration() {
+        return new RuntimeInitializedClassBuildItem(EdDSASecurityProviderUtils.class.getCanonicalName());
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(
+                new ReflectiveClassBuildItem(
+                        true,
+                        false,
+                        KeyPairGenerator.class.getCanonicalName(),

Review comment:
       Please prefer `class.getName()` here and also in other methods of this class. It works also for inner classes and is a safer choice for people copying from here.

##########
File path: extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteSecurityUtils.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.camel.quarkus.component.ssh.runtime;
+
+import java.security.GeneralSecurityException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * We're substituting those offending methods that would require the presence of
+ * net.i2p.crypto:eddsa library which is not supported by Camel SSH component

Review comment:
       Is this documented somewhere? I am not finding any mention of eddsa on https://camel.apache.org/components/latest/ssh-component.html Shouldn't we file a documentation issue?

##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }

Review comment:
       I think `org.apache.camel.quarkus.support.bouncycastle.deployment.BouncycastleSupportProcessor` would be the right home for this BuildStep. 

##########
File path: integration-tests/ssh/src/test/java/org/apache/camel/quarkus/component/ssh/it/SshTest.java
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.camel.quarkus.component.ssh.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@QuarkusTest
+@QuarkusTestResource(SshTestResource.class)
+class SshTest {
+
+    @Test
+    public void testWriteToSSHAndReadFromSSH() {
+        final String fileContent = "Hello Camel Quarkus SSH";
+        BouncyCastleProvider x;

Review comment:
       Can't we remove this line?




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490814724



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }
+
+    @BuildStep
+    RuntimeInitializedClassBuildItem delayEdDSAConfiguration() {
+        return new RuntimeInitializedClassBuildItem(EdDSASecurityProviderUtils.class.getCanonicalName());
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(
+                new ReflectiveClassBuildItem(
+                        true,
+                        false,
+                        KeyPairGenerator.class.getCanonicalName(),

Review comment:
       > you may also remove the `.getName()` AFAIK
   
   Do you mean using a text with the fully qualified name instead?




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490813255



##########
File path: extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteSecurityUtils.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.camel.quarkus.component.ssh.runtime;
+
+import java.security.GeneralSecurityException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * We're substituting those offending methods that would require the presence of
+ * net.i2p.crypto:eddsa library which is not supported by Camel SSH component

Review comment:
       I think I did not explain properly in the comment. The `camel-ssh` depends on `sshd-core` library which has 2 optional security providers, `bouncycastle` and `eddsa`. In `camel-ssh` we chose to use `bouncycastle`. I will rephrase the comment to highlight that.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] jamesnetherton commented on pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#issuecomment-694930736


   I think it's fine to ignore the failing test. Lets get this merged.


----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490816128



##########
File path: extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteSecurityUtils.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.camel.quarkus.component.ssh.runtime;
+
+import java.security.GeneralSecurityException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * We're substituting those offending methods that would require the presence of
+ * net.i2p.crypto:eddsa library which is not supported by Camel SSH component

Review comment:
       > I think I did not explain properly in the comment. The `camel-ssh` depends on `sshd-core` library which has 2 optional security providers, `bouncycastle` and `eddsa`. In `camel-ssh` we chose to use `bouncycastle`.
   
   Thanks for the clarification. I still think that this is a piece of info interesting for the end users and it should ideally be present on https://camel.apache.org/components/latest/ssh-component.html . Filing a documentation issue would be a way not forget about that :)




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490813571



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }
+
+    @BuildStep
+    RuntimeInitializedClassBuildItem delayEdDSAConfiguration() {
+        return new RuntimeInitializedClassBuildItem(EdDSASecurityProviderUtils.class.getCanonicalName());
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(
+                new ReflectiveClassBuildItem(
+                        true,
+                        false,
+                        KeyPairGenerator.class.getCanonicalName(),

Review comment:
       True, ReflectiveClassBuildItem accepts also `Class...` for which it calls `getName()` under the hood.




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490822909



##########
File path: extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteSecurityUtils.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.camel.quarkus.component.ssh.runtime;
+
+import java.security.GeneralSecurityException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * We're substituting those offending methods that would require the presence of
+ * net.i2p.crypto:eddsa library which is not supported by Camel SSH component

Review comment:
       For the record: https://issues.apache.org/jira/browse/CAMEL-15550




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490816508



##########
File path: extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.ssh.deployment;
+
+import java.security.KeyFactory;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.util.Arrays;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.Mac;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
+import org.apache.sshd.common.channel.ChannelListener;
+import org.apache.sshd.common.forward.PortForwardingEventListener;
+import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
+import org.apache.sshd.common.session.SessionListener;
+import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;
+
+class SshProcessor {
+
+    private static final String FEATURE = "camel-ssh";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void secureRandomConfiguration(BuildProducer<RuntimeReinitializedClassBuildItem> reinitialized) {
+        for (String s : Arrays.asList(
+                "java.security.SecureRandom",
+                "org.bouncycastle.crypto.CryptoServicesRegistrar",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV",
+                "org.bouncycastle.jcajce.provider.drbg.DRBG$Default")) {
+            reinitialized.produce(new RuntimeReinitializedClassBuildItem(s));
+        }
+    }
+
+    @BuildStep
+    RuntimeInitializedClassBuildItem delayEdDSAConfiguration() {
+        return new RuntimeInitializedClassBuildItem(EdDSASecurityProviderUtils.class.getCanonicalName());
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(
+                new ReflectiveClassBuildItem(
+                        true,
+                        false,
+                        KeyPairGenerator.class.getCanonicalName(),

Review comment:
       Ah, okey, I see, thanks!




----------------------------------------------------------------
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.

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



[GitHub] [camel-quarkus] squakez commented on a change in pull request #1802: feat(ssh): promoting native extension

Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #1802:
URL: https://github.com/apache/camel-quarkus/pull/1802#discussion_r490818745



##########
File path: extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteSecurityUtils.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.camel.quarkus.component.ssh.runtime;
+
+import java.security.GeneralSecurityException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.sshd.common.util.buffer.Buffer;
+import org.apache.sshd.common.util.security.SecurityUtils;
+
+/**
+ * We're substituting those offending methods that would require the presence of
+ * net.i2p.crypto:eddsa library which is not supported by Camel SSH component

Review comment:
       Okey, I'll take care!




----------------------------------------------------------------
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.

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