We have also script that add the public key automatically to the SSH Key via command curl (and the error below) :
curl -v -X POST -u <username> -H "Content-Type: text/plain" -d "@C:\Users\<username>amitpaz\.ssh\id_rsa.pub" -k https://<servername>.com:8443/a/accounts/<username>/sshkeys
Enter host password for user '<username>':
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 194.29.37.91:8443...
* Connected to <server>.com (IP) port <number> (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: ...
* start date: Aug 28 07:35:13 2022 GMT
* expire date: Aug 27 07:35:13 2024 GMT
* issuer:
* SSL certificate verify result: self signed certificate in certificate chain
* Server auth using Basic with user 'username'
> POST /a/accounts/username/sshkeys HTTP/1.1
> Host: gerrit.com:port
> Authorization: Basic
> User-Agent: curl/7.74.0
> Accept: */*
> Content-Type: text/plain
> Content-Length: 575
>
* upload completely sent off: 575 out of 575 bytes
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Gerrit Code Review"
< Content-Type: text/plain;charset=iso-8859-1
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: Mon, 01 Jan 1990 00:00:00 GMT
< Date: Mon, 01 Apr 2024 06:00:45 GMT
< Content-Length: 12
<
Unauthorized* Connection #0 to host <gerrit>.com left intact
Any Idea ?
ב-יום ראשון, 31 במרץ 2024 בשעה 21:35:13 UTC+3, Guy Levkowitz כתב/ה: