getting authentication failure on jenkins - jenkins

I have suddly started to get the next error when using the jenkins cli:
>java -jar <path to jenkins-cli>/jenkins-cli.jar -s <jenkins url> build <job name>
Exception in thread "main" java.io.EOFException
at java.io.DataInputStream.readBoolean(DataInputStream.java:244)
at hudson.cli.Connection.readBoolean(Connection.java:95)
at hudson.cli.CLI.authenticate(CLI.java:634)
at hudson.cli.CLI._main(CLI.java:474)
at hudson.cli.CLI.main(CLI.java:384)
what am I doing wrong ? using Jenkins ver. 1.567.

That looks like this issue. Parts of that issue have been fixed in Jenkins 1.617, so upgrading might help, but there are still reports that the issue remains "when a key is used but authentication is disabled".

how do you authenticate to the server ?
If you are using a public , private key authentication. Strongly Suggest you to generate a new one using
SSH Key gen for your reference
bash-4.1$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/users/xxxx/.ssh/id_rsa):
JenkinsCLI
Enter passphrase (empty for no passphrase):(leave blank)
Enter same passphrase again:(leave blank)
Your identification has been saved in JenkinsCLI.
Your public key has been saved in JenkinsCLI.pub.
The key fingerprint is:
f6:4c:be:fc:cb:cd:d3:ee:8c:80:26:a2:57:df:67:14 xxxxx#xxxxxx
The key's randomart image is:

Related

Erlang :ssh authentication error. How to connect to ssh using identity file

I'm getting an authentication error when trying to connect ssh host.
The goal is to connect to the host using local forwarding. The command below is an example using drop bear ssh client to connect to host with local forwarding.
dbclient -N -i /opt/private-key-rsa.dropbear -L 2002:1.2.3.4:2006 -p 2002 -l
test_user 11.22.33.44
I have this code so far which returns empty connection
ip = "11.22.33.44"
user = "test_user"
port = 2002
ssh_config = [
user_interaction: false,
silently_accept_hosts: true,
user: String.to_charlist(user),
user_dir: String.to_charlist("/opt/")
]
# returns aunthentication error
{:ok, conn} = :ssh.connect(String.to_charlist(ip), port, ssh_config)
This is the error Im seeing
Server: 'SSH-2.0-OpenSSH_5.2'
Disconnects with code = 14 [RFC4253 11.1]: Unable to connect using the available authentication methods
State = {userauth,client}
Module = ssh_connection_handler, Line = 893.
Details:
User auth failed for: "test_user"
I'm a newbie to elixir and have been reading this erlang ssh document for 2 days. I did not find any examples in the documentation which makes it difficult to understand.
You are using non-default key name, private-key-rsa.dropbear. Erlang by default looks for this set of names:
From ssh module docs:
Optional: one or more User's private key(s) in case of publickey authorization. The default files are
id_dsa and id_dsa.pub
id_rsa and id_rsa.pub
id_ecdsa and id_ecdsa.pub`
To verify this is a reason, try renaming private-key-rsa.dropbear to id_rsa. If this works, the next step would be to add a key_cb callback to the ssh_config which should return the correct key file name.
One example implementation of a similar feature is labzero/ssh_client_key_api.
The solution was to convert dropbear key to ssh key. I have used this link as reference.
Here is the command to convert dropbear key to ssh key
/usr/lib/dropbear/dropbearconvert dropbear openssh /opt/private-key-rsa.dropbear /opt/id_rsa

Azure Key Vault - Certificate generation

I am using the following script to generate a new ROOT CA that will be used to generate sub-ca's and client certificates.
New-SelfSignedCertificate -CertStoreLocation "cert:\CurrentUser\My" -Subject "CN=$certificateCleanName" -KeySpec Signature -KeyUsage CertSign -TextExtension #("2.5.29.19 ={critical} {text}ca=1")
This works perfectly, but I would prefer to generate them in the Key Vault Directly (via Powershell).
I know you can generate a self signed certificate in the key vault directly with this command:
$manualPolicy = New-AzureKeyVaultCertificatePolicy -SubjectName "CN=something.com" -ValidityInMonths 24 -IssuerName Self -RenewAtNumberOfDaysBeforeExpiry 100
$certificate = Add-AzureKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $manualPolicy
However, with the command above, I am not able to generate the exact same certificate properties as in the first command that use to generate the certificate locally.
Any idea how I can specify the following arguments to create the certificate with the exact same settings directly in the KeyVault?
-KeyUsage CertSign -TextExtension #("2.5.29.19 ={critical} {text}ca=1")

401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect

It's the first time for me using twitter4j i got project from github trying to run it to see the result of how using twitter4j and when i run the Crawler class i got this
0 [Twitter Stream consumer-1[initializing]] INFO twitter4j.TwitterStreamImpl - Establishing
connection. 5617 [Twitter Stream consumer-1[Establishing connection]] INFO
twitter4j.TwitterStreamImpl - 401:Authentication credentials (https://dev.twitter.com/pages
/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access
token/secret, and the system clock is in sync.
i guess from Ensure that you have set valid consumer key/secret that i should change the proprieties of twitter4j.proprieties !!? am i right or false ? and how can i change the proprieties of it ?
Can someone help ?
I got the similar error with using twitter4j 3.0.x version. I solved it by updating twitter4j to the 4.0.0 version
Try the following options given in this link to set the Keys:
via twitter4j.properties: Save a standard properties file named "twitter4j.properties". Place it to either the current directory, root of the classpath directory.
debug=true
oauth.consumerKey=*********************
oauth.consumerSecret=******************************************
oauth.accessToken=**************************************************
oauth.accessTokenSecret=******************************************
via ConfigurationBuilder: You can use ConfigurationBuilder class to configure Twitter4J programatically as follows:
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("*********************")
.setOAuthConsumerSecret("******************************************")
.setOAuthAccessToken("**************************************************")
.setOAuthAccessTokenSecret("******************************************");
TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter =
tf.getInstance();
via System Properties: You can configure Twitter4J via System properties. Note that you need "twitter4j." prefix.
$ java -Dtwitter4j.debug=true
-Dtwitter4j.oauth.consumerKey=*********************
-Dtwitter4j.oauth.consumerSecret=******************************************
-Dtwitter4j.oauth.accessToken=**************************************************
-Dtwitter4j.oauth.accessTokenSecret=******************************************
-cp twitter4j-core-4.0.2.jar:yourApp.jar yourpackage.Main
via environment variables: Note that you need "twitter4j." prefix.
$ export twitter4j.debug=true $ export
twitter4j.oauth.consumerKey=********************* $ export
twitter4j.oauth.consumerSecret=******************************************
$ export
twitter4j.oauth.accessToken=**************************************************
$ export
twitter4j.oauth.accessTokenSecret=******************************************
$ java -cp twitter4j-core-4.0.2.jar:yourApp.jar yourpackage.Main

iTMSTransporter fails with error -20101

I've received an email from Apple yesterday stating that it's now possible to deliver App Store metadata localizations using a command-line tool called Transporter.
I've downloaded iTunes_Store_Transporter_Quick_Start_Guide_v2.pdf from iTunes Connect and followed the example for a simple lookup of the metadata of an app:
To initiate lookup mode, use the following command:
$ iTMSTransporter -m lookupMetadata -u [iTunes Connect user name]
-p [iTunes Connect password] -vendor_id [App SKU]
-destination [destination path for App Store Package]
However, although my login credentials and all other informations entered are correct, I always receive the following error:
[2013-07-19 14:34:40 MESZ] <main> DBG-X: parameter Errors = [Directory Services reported the following error: Your Apple ID or password was entered incorrectly. (-20101)]
[2013-07-19 14:34:40 MESZ] <main> ERROR: Apple's web service operation was not successful
[2013-07-19 14:34:40 MESZ] <main> ERROR: An error occurred while looking up the metadata.
[2013-07-19 14:34:40 MESZ] <main> ERROR: Directory Services reported the following error: Your Apple ID or password was entered incorrectly. (-20101)
[2013-07-19 14:34:40 MESZ] <main> DBG-X: The error code is: -20101
INFOS: My password contains special characters. Thus I've tried to pass the password with and without quotation marks.
#Tafkadasoh It's the dollar sign that's causing the problem. Since the $ character is reserved for different kind of variables in unix, you have to escape it.
Instead of
-p 'Pass$123'
Use
-p 'Pass\$123'
What OS are you using and what are the special characters that your password contains? If you're using OS X try it with single quotes, e.g. 'password' not "password".
If you're going to be using iTMSTransporter a lot I would recommend
using this program.
As a workaround, it worked for me to remove the password parameter. iTMSTransporter will then ask for password entry on the command-line. This isn't a real solution, as you can't use this for automated scripts (for which iTMSTransporter is intended to use for). For infrequent use however, this might be enough.
#Tafkadasoh - that workaround worked great for me too, I can now connect and grab the metadata package.
Cheers!
For me, I had FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD and FASTLANE_PASSWORD in my environment variables. So I remove FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD and it worked.
If you have FASTLANE_SESSION along with FASTLANE_PASSWORD, you may need to remove FASTLANE_SESSION.

Creating a job with credentials in jenkins only in command lines

I am only allowed to work with the command line terminal on Ubuntu.
I need to create a job in Jenkins with security credentials.
I already installed Jenkins in my machine, but the access is open. If I set-up security credentials on Jenkins, how can I specify these on the command line?
Follow these steps:
Generate a public ssh-key in the user you want to work with from the command line:
ssh-keygen
Just press enter whenever yo are asked to enter some value.
Copy the content of the file ~/.ssh/id_rsa.pub.
Go to your jenkins home screen in a browser and login with a user with full access, Then click on the right on Users and then on the user you are currently logged with. Then click on settings (or configuration??).
In the field SSH public keys paste the content of the id_rsa.pub file. Save the changes.
And that's all! Now you are able to work with jenkins from the command line.
From the command line
The following is the configuration file of my jenkins main user (with all the privileges). Pay attention to the setting <authorizedKeys>. You should paste there the public ssh key. I haven't made that, but surely if you add the necessary lines to your config file it works. The file is in /path_to_jenkins/users/user_name/config.xml
<?xml version='1.0' encoding='UTF-8'?>
<user>
<fullName>admin</fullName>
<description></description>
<properties>
<jenkins.security.ApiTokenProperty>
<apiToken>pP08W9tzs2jlCrVCY9I2o6y2RNu3Huw85Y2f99/Uif7dia1W7piGpzsrpstln/jw</apiToken>
</jenkins.security.ApiTokenProperty>
<com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty plugin="credentials#1.4">
<credentials/>
</com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty>
<hudson.tasks.Mailer_-UserProperty plugin="mailer#1.4">
<emailAddress>admin#mail.com</emailAddress>
</hudson.tasks.Mailer_-UserProperty>
<hudson.model.MyViewsProperty>
<primaryViewName></primaryViewName>
<views>
<hudson.model.AllView>
<owner class="hudson.model.MyViewsProperty" reference="../../.."/>
<name>Alle</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
</hudson.model.AllView>
</views>
</hudson.model.MyViewsProperty>
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>1DF2ykjkkkjkkQXW</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
<org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl>
<authorizedKeys>ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4P1b/5RpibQgDZpKPD7lTQLjtyMrIQH43ns62PO72koL9zJe6qrAYcTIDNOUvSYNYyKfrgt6Z5zB8MvvENQLWezDKTWNXINhZml0PxOlc9ZaHbQX6UqyFbTS6o+ZEGs+K92Yi/XwK5hTmN5Igsw5BQYEs5cOsd5H2PoEZdhK1X0XAEBX/+p6aNy585+/scgZj0jSIvcX+pnzsCJLKmeYadlLnbrvebf9u6pu8MI9RuAY5dvPfpSL4WynWwS1QvY4z535TqPaaAlM3qXqH0pcOlxgW1iUkJqti3JnnxpBNXLmXalmq+4/d7mUrRBx+HKbh5ZpNZad9vaelAjAsNg+uw== user#machine_name</authorizedKeys>
</org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl>
<hudson.search.UserSearchProperty>
<insensitiveSearch>false</insensitiveSearch>
</hudson.search.UserSearchProperty>
</properties>
</user>
I just changed the starting prompt location to the folder in which the jar file is located. For example, if your jar file's location and name is:
C:\Users\Tod\file.jar
you can do two commands:
cd C:\Users\Tod
java -jar file.jar

Resources