Trust repository with small dh key in maven build - maven

When building my project using maven inside my newly setup CentOS 8 VM I get the following error when maven tries to download a dependecy from our internal nexus:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.120 s
[INFO] Finished at: 2020-03-25T17:43:34+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myproject: Could not resolve dependencies for project our.domain:myproject:jar:1.5.0: Failed to collect dependencies at our.domain.internal:internal-commons:jar:0.12.3: Failed to read artifact descriptor for our.domain.internal:internal-commons:jar:0.12.3: Could not transfer artifact our.domain.internal:internal-commons:pom:0.12.3 from/to nexus-proxy (https://nexus.our.domain/repository/maven-public/): DH ServerKeyExchange does not comply to algorithm constraints -> [Help 1]
The problem also occurs when I try to read any webpage on that nexus:
[root#localhost Daisy]# curl https://nexus.our.domain
curl: (35) error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small
I tried to manually add the key to my known_hosts file using:
ssh-keyscan -p 443 nexus.our.domain >> ~/.ssh/known_hosts
But I returns without any console-output and no change to the file. Running
ssh-keyscan -p 443 nexus.our.domain
also produces no output at all.
I already reported the issue to the internal team that manages our nexus.
I would still appreciate any solution that forces my VM to accept the key of our nexus so I don't have to wait until the key is exchanged. I'm free to handle this in any level of my client (VM)-side (Maven, https, ssl or any lower level).
Versions used:
CentOS: CentOS Linux release 8.1.1911 (Core)
Maven:
[root#localhost Daisy]# mvn --version
Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Maven home: /usr/share/maven
Java version: 11.0.5, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-11.0.5.10-2.el8_1.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-147.5.1.el8_1.x86_64", arch: "amd64", family: "unix"
SSH: OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS 28 May 2019

Changing the first line in /etc/crypto-policies/back-ends/opensslcnf.config :
- CipherString = #SECLEVEL=2:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8
+ CipherString = #SECLEVEL=1:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8
(changing SECLEVEL=2 to SECLEVEL=1)
For the maven build to run I had to change the jvm-setting as well:
What does "Reason: DHPublicKey does not comply to algorithm constraints" mean?
Remember, this is only a workaround. The setting is a security-setting and should normally not be changed.

Related

Error when creating Maven project from archetype: 501 HTTPS Required

I run mvn archetype:generate and get this error:
Error reading archetype catalog http://repo.maven.apache.org/maven2
org.apache.maven.wagon.TransferFailedException: Transfer failed for http://repo.maven.apache.org/maven2 501 HTTPS Required
I'm using Maven 3.6.3.
I cannot put a different repository URL into the POM file, because when I'm creating a project from an archetype, no POM file exists yet.
I have no settings.xml file in ~/.m2.
Is there something wrong with my Maven installation?
The output of mvn --version is:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
/usr/local/Cellar/maven/3.6.3_1/libexec/conf/settings.xml does not contain the URL that the error message is complaining about.
Short answer: override the default http catalog url with an https one, by appending:
-DarchetypeCatalog=https://repo.maven.apache.org/maven2/archetype-catalog.xml
to the mvn archetype:generate command
Background:
When using the mvn -X -e archetype:generate command, Maven 3.6.3 seems to use version 2.4 of the maven-archetype-plugin:
[DEBUG] Resolved plugin version for org.apache.maven.plugins:maven-archetype-plugin to 2.4 from repository central (https://repo.maven.apache.org/maven2, default, releases)
The plugin uses the remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml:
[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml
[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2
[WARNING] Error reading archetype catalog http://repo.maven.apache.org/maven2
org.apache.maven.wagon.TransferFailedException: Transfer failed for http://repo.maven.apache.org/maven2 501 HTTPS Required
As of 15/1/2020, maven central requires an HTTPS url: Central 501 HTTPS Required
According to this JIRA, the issue should be fixed in version 3.0.0 of the plugin.

Apache Bigtop not building

I'm following these instruction for setting up Apache Bigtop, to eventually support me running Oozie. I'm trying to use Bigtop because the Oozie website recommends the use of Bigtop if I want to run my Oozie install on Hadoop 2+.
After running the step
make hadoop-deb
I get the following error message (full message HERE):
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary: [INFO] [INFO] Apache Hadoop Main ................................ FAILURE [1:50.288s] [INFO] Apache Hadoop Project POM ......................... SKIPPED ... ... ...
...
...
...
...
...
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:55.412s
[INFO] Finished at: Mon Sep 15 14:14:17 PDT 2014
[INFO] Final Memory: 71M/434M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:stage (default-cli) on project hadoop-main: Execution default-cli of goal org.apache.maven.plugins:maven-site-plugin:3.3:stage failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3.3:stage: org/apache/commons/lang/StringUtils
Scouring the web, some people say this can be fixed by manually deleting your /.m2 repo and then rebuilding. I've tried this to no avail.
I'm using Ubuntu 14.04, fully updated, with Java openjdk7. The only different between what I did and the instructions was that I have Maven installed directly from apt-get, and thus I replaced the MAVEN_HOME location the instructions use with my own.
This info might also be helpful...
mherbst#Oozing:~/bigtop$ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-35-generic", arch: "amd64", family: "unix"
Any ideas what might be the issue? I realize I'm using a slightly newer version of Ubuntu than when the guide was written, but I don't think that's the problem. This seems to be some type of Java/Maven dependency issue.
Where are you getting your BigTop installation instructions? I don't remember running maven as part of the install.
BigTop doesn't work on Ubuntu 14.04. There's a problem with at least one dependency (fuse-utils). Try Ubuntu 12.02 LTS.

Building gremlin-plugin for neo4j

I'm trying to install the gremlin-plugin so I can use neo4django in python. I tried to follow the steps laid out at https://github.com/neo4j-contrib/gremlin-plugin but I haven't had any success.
I have
downloaded gremlin-plugin-master.zip
unzip gremlin-plugin-master.zip
cd gremlin-plugin-master/
mvn clean package
At which point, I receive a message which contains the following snippit
...
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project neo4j-gremlin-plugin: Compilation failure
[ERROR] /home/mint/Downloads/gremlin-plugin-master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinPlugin.java:[79,23] method autoStartTransaction in class com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph cannot be applied to given types;
[ERROR] required: boolean
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] -> [Help 1]
....
Does anybody know what this means? I couldn't find anything that seemed to match this kind of error in this context and I have no idea where to start debugging this.
$ mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-12-generic", arch: "amd64", family: "unix"
EDIT:
After cloning the repo, I was able to compile.
Fresh clone of the repo solved the issue.

Maven in Ubuntu 10.4 -

This is my first time asking for help in a public forum.
So anyways Microsoft Windows has been my comfort zone as a development environment,recently I have been chucked into a linux environment at work, I seem to have got the hang of things, but when I tried to set up Maven2 I ran into some issues, I will get to the issue part later, but this is how I set up maven
Extracted maven to /usr/local/maven/apache-maven-2.2.1
Created a symbolic link to '/usr/bin' using following command
sudo ln -s /usr/local/maven/apache-maven-2.2.1 /usr/bin/mvn
when I mvn --version
Output :
Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530) Java version:
1.7.0_25 Java home: /usr/local/java/jdk1.7.0_25/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version:
"2.6.32-24-generic" arch: "i386" Family: "unix"
but when I try to do
mvn clean
Output :
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Maven is trying to download a plugin it needs to to do project cleanup from http://repo1.maven.org/. Do you need to use a proxy to connect to the internet? If so, see this guide: http://maven.apache.org/guides/mini/guide-proxies.html
If not, it might be that the network somewhere between your workstation and repo1.maven.org was having problems, which might be resolved now.
The answer by Ireeder(Thanks man :-) ) did the trick.
My computer was behind a proxy, so I needed to do the following to allow maven access the Internet
Steps to solve it
Open the M2_HOME/conf/settings.xml
Look for this line block in the settings.xml
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>{username}</username>
<password> {password} </password>
<host>{host}</host>
<port>{port}</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
replace {value} with data relevant to you.
Enjoy!

Maven not working?

Initially I used maven with proxy and it was working fine. Now I don't need the proxy, so I edited the settings.xml to not use proxy. After that, Maven does not connect to the Internet to download repos. I tried reinstalling, but still getting the same problem. I even tried IDEs like eclipse and IDEA but the problem was still there. How do I resolve this?
mvn --version
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_24
Java home: /usr/lib/jvm/java-6-openjdk-i386/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux" version: "3.2.0-31-generic-pae" arch: "i386" Family: "unix"
mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple -DartifactId=simple -DpackageName=org.sonatype.mavenbook -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
Nothings happens after this.
All things considered, my initial thought is this is a connection issue since it fails to work after removing the proxy settings. Are you able to ping or curl the repository being scanned?

Resources