How to publish jar to nexus through curl? - nexus

curl -v -u admin:admin123 --upload-file abclog.jar http://111.111.1.121:8081/nexus/content/repositories/releases/com/keshri/fileupload/

This works on nexus 3.12 (from windows, uploading a nuget package)
$curl.exe" -u ${NUGET_DEPLOYER_USER}:${NUGET_DEPLOYER_PASS} -F filename=the_artifact.nupkg
http://mynexus.example.org:9881/nexus/service/extdirect -F file=c:\\fakepath\\the_artifact.nupkg
-F repositoryName=nuget-hosted -F extTID=36 -F extAction=coreui_Upload
-F extMethod=doUpload -F extType=rpc -F extUpload=true
On 3.14 it fails with something about an csrf token being missing.

Related

Varnish 6.0.8 Secret file is not created

Please we're facing some issues when installing Varnish 6.0.8 on ubutnu 18.04.6 OS, it doesn't create the secret file inside the /etc/varnish dir as shown below:
enter image description here
we use the following script to for installation :
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish60lts/script.deb.sh | sudo bash
can someone please help ?
PS: we tried to install later versions (6.6 and 7.0.0) and we got the same issue.
Form a security point of view, remote CLI access is not enabled by default. You can see this when looking at /lib/systemd/system/varnish.service:
[Unit]
Description=Varnish Cache, a high-performance HTTP accelerator
After=network-online.target nss-lookup.target
[Service]
Type=forking
KillMode=process
# Maximum number of open files (for ulimit -n)
LimitNOFILE=131072
# Locked shared memory - should suffice to lock the shared memory log
# (varnishd -l argument)
# Default log size is 80MB vsl + 1M vsm + header -> 82MB
# unit is bytes
LimitMEMLOCK=85983232
# Enable this to avoid "fork failed" on reload.
TasksMax=infinity
# Maximum size of the corefile.
LimitCORE=infinity
ExecStart=/usr/sbin/varnishd \
-a :6081 \
-a localhost:8443,PROXY \
-p feature=+http2 \
-f /etc/varnish/default.vcl \
-s malloc,256m
ExecReload=/usr/sbin/varnishreload
[Install]
WantedBy=multi-user.target
There are no -T and -S parameters in the standard systemd configuration. However, you can enable this by modifying the systemd configuration yourself.
Just run sudo systemctl edit --full varnish to edit the runtime configuration and add a -T parameter to enable remote CLI access.
Be careful with this and make sure you restrict access to this endpoint via firewalling rules.
Additionally you'll add -S /etc/varnish/secret as a varnishd runtime parameter in /lib/systemd/system/varnish.service.
You can use the following command to add a random unique value to the secret file:
uuidgen | sudo tee /etc/varnish/secret
This is what your runtime parameters would look like:
ExecStart=/usr/sbin/varnishd \
-a :6081 \
-a localhost:8443,PROXY \
-p feature=+http2 \
-f /etc/varnish/default.vcl \
-s malloc,2g \
-S /etc/varnish/secret \
-T :6082
When you're done just run the following command to restart Varnish:
sudo systemctl restart varnish

The artifactory trusty repository is corrupt

The checksums in the Packages.bz2 file in jfrog's trusty repository for artifactory don't match the packages. This causes mirroring and installations to fail. Checked 19-Jul-2018 0606 UTC
$ curl -s https://jfrog.bintray.com/artifactory-
debs/dists/trusty/main/binary-amd64/Packages.bz2|bzcat|grep -A2 -F jfrog-artifactory-oss-6.1.0.deb
Filename: pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb
SHA1: dfe6d0cce9c3ca946d27b8dd1cf080e0ef6b9818
SHA256: c88e6f2f183426721ce3273642e0df00abce2150c7ca67afe1a69b175e9775f6
$ curl -s https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb | sha1sum
da39a3ee5e6b4b0d3255bfef95601890afd80709 -
$ curl -s https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb | sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
Edit:
As has been kindly pointed out by Royg, I was missing the -L flag to curl in order to follow bintray's redirects. However, that then exposes an issue with the package for version 4.3.1:
$ curl -sL https://jfrog.bintray.com/artifactory-debs/dists/trusty/main/binary-amd64/Packages.bz2 | bzcat | grep -A2 -F jfrog-artifactory-oss-4.3.1.deb
Filename: pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-4.3.1.deb
SHA1: dc8b12436f309b538f6b80b4027b797e3cfce897
SHA256: 8cad6699ff17866b93a02124254ba3fb9a3ca2036048161b9bd3a49c8257831f
$ curl -sL https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-4.3.1.deb | sha1sum
575dc3debd016ff3a21e635625de266a6b0c2e48 -
You are missing the redirect option in your curl -L or --location.
If you try the curl command to the artifact with -v or --verbose you can seen that Bintray is redirecting you to the CDN nearest you. That means that you are sha1sum and sha256sum on empty artifact, that is why the checksum doesn't match.
$ curl https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb -vL | sha1sum
dfe6d0cce9c3ca946d27b8dd1cf080e0ef6b9818 -
$ curl https://jfrog.bintray.com/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-6.1.0.deb -vL | sha256sum
c88e6f2f183426721ce3273642e0df00abce2150c7ca67afe1a69b175e9775f6 -

how to upload JAR to Nexus OSS 3?

How to perform an upload of a jar via curl the Nexus 3?
I tried using the link tips but without success.
Here are my attempts:
curl -v -F r = -F releases hasPom = true and = -F jar -F file = #. / v12.1.0.1 / pom.xml -F file = #. / v12.1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases
curl -v -F r = -F releases hasPom = false -F and -F jar = g = com.oracle.jdbc -F = ojdbc7 -F v = 1.0 p = -F jar -F file = #. / v12 .1.0.1 / ojdbc7.jar -u admin: admin123 http: // localhost: 8081 / repository / maven releases
Both have 400 Bad Request.
Contents of directory
cert_for_nexus.pem
curl.exe
pom.xml
utils-1.0.jar
Nexus v3 is configured for http
curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom
curl -v -u admin:admin123 --upload-file utils-1.0.jar http://localhost:8081/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar
Nexus v3 is configured for https
prerequisite: must have curl with SSL enabled (link - left menu)
curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file pom.xml https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.pom
curl -v --cacert cert_for_nexus.pem -u admin:admin123 --upload-file utils-1.0.jar https://localhost:8443/nexus/repository/maven-releases/org/foo/utils/1.0/utils-1.0.jar
Contents of pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.foo</groupId>
<artifactId>utils</artifactId>
<version>1</version>
</project>
EDIT: fixed -u order for both https examples
You could use nexus-cli.
docker run -ti -v $(pwd):$(pwd):ro sjeandeaux/nexus-cli:0.2.0 \
-repo=http://nexus:8081/repository/maven-releases \
-user=admin \
-password=admin123 \
-file=$(pwd)/upload.jar \
-groupID=your.group \
-artifactID=yourArtifactID \
-version=0.1.0 \
-hash md5 \
-hash sha1
I've modified your code as below. Please try this.
curl -v -F r=releases -F hasPom=false -F e=jar -F g=com.oracle.jdbc -F a=ojdbc7 -F v=1.0 -F p=jar -F file=#"./v12.1.0.1/ojdbc7.jar" -u admin:admin123 http://localhost:8081/nexus/service/local/artifact/maven/content
Also I would suggest using the full path rather than relative path. Can you share where you are using this curl snippet? Any CI tool like Jenkins?

Is it possible to send source file as URL with hylaFax?

I need to send a fax where the source file is coming from an HTTP URL. I have configured hylaFax. When trying a local file, it works fine. But with a URL it gives an error.
The command I am using is something like this:
sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890 \
'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt'
The error:
Error : 'Can not open file'
The file is downloading when connecting through browser.
sendfax will process stdin so you can pipe documents in:
wget -O - 'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt' | sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890
or
curl 'http://kaur.dev.xyz.com:7771/app-name/proxy?bName=Test&oName=1.txt' | sendfax -v -h faxhost -f kaur#xyz.com -D -d 1234567890

Nginx & Varnish connection error

My site gives error 521 all the times.
When I found this error from my server
$sudo service varnish reload
* Reloading HTTP accelerator varnishd
Connection failed (localhost:6082)
Error: vcl.load 8d6fb6be-9a0a-4896-be47-e2678e3c2617 /etc/varnish/default.vcl failed
Moreover,
varnishlog
shows nothing.
I am following this tutorial to set the server up. And, I changed
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-u www-data -g www-data \
-S /etc/varnish/secret \
-s malloc,256m"
The /etc/varnish/default.vcl file is copied from the tutorial. All & has been corrected to &.
It is a fresh VPS. No firewall.
Any clue to resolve it?
Thanks!!!!
3 things come into my mind:
Start varnish in foreground mode and check what it says
varnishd -F -a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-u www-data -g www-data \
-S /etc/varnish/secret \
-s malloc,256m
Try changing -T localhost:6082 to -T 127.0.0.1:6082
Your port 6082 might be already taken. Change it or check if it's listed in already open ports' list with
netstat -tlnep
restart your varnish
sudo /etc/init.d/varnish restart
then
sudo /etc/init.d/varnish reload

Resources