Posts

Showing posts with the label Ssh

Adding Password To .ssh/config

Answer : Solution 1: No, There is no method to specify or provide on the command line the password in a non-interactive manner for ssh authentication using a openssh built-in mechanism. At least not one what I know of. You could hardcode your password into expect script but it is not a good solution either. You definitely would want to use keypairs for passwordless authentication as Michael stated, in the end private key is pretty much a big password in the file. Solution 2: To avoid the string of comments: Yes, this is insecure (not even arguably insecure). I would strongly recommend you only do it in a lab situation on an isolated network or a similiar situation that does not involve production servers or potentientially production server without a full reset/format. I wanted to set this up as I don't think my 2950 switch supports private/public keys and I hope at some point to get that knowledge, but I am not there yet. Using an alias and sshpass this can be acc...

Authentication Order With SSH

Answer : Solution 1: The ssh server decides which authentication options it allows, the ssh client can be configured to decide in which order to try them. The ssh client uses the PreferredAuthentications option in the ssh config file to determine this. From man ssh_config (see it online here): PreferredAuthentications Specifies the order in which the client should try protocol 2 authentication methods. This allows a client to prefer one method (e.g. keyboard-interactive) over another method (e.g. password). The default is: gssapi-with-mic,hostbased,publickey, keyboard-interactive,password I don't believe it's possible, without playing with the source, to tell the OpenSSH server to prefer a certain order - if you think about it, it doesn't quite make sense anyway. Solution 2: Adding this: PreferredAuthentications keyboard-interactive,password,publickey,hostbased,gssapi-with-mic ...to my /...

Access Host's Ssh Tunnel From Docker Container

Answer : Using your hosts network as network for your containers via --net=host or in docker-compose via network_mode: host is one option but this has the unwanted side effect that (a) you now expose the container ports in your host system and (b) that you cannot connect to those containers anymore that are not mapped to your host network. In your case, a quick and cleaner solution would be to make your ssh tunnel "available" to your docker containers (e.g. by binding ssh to the docker0 bridge) instead of exposing your docker containers in your host environment (as suggested in the accepted answer). Setting up the tunnel: For this to work, retrieve the ip your docker0 bridge is using via: ifconfig you will see something like this: docker0 Link encap:Ethernet HWaddr 03:41:4a:26:b7:31 inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0 Now you need to tell ssh to bind to this ip to listen for traffic directed towards port 9000 via ssh -L 1...

Checkout Jenkins Pipeline Git SCM With Credentials?

Answer : You can use the following in a pipeline: git branch: 'master', credentialsId: '12345-1234-4696-af25-123455', url: 'ssh://git@bitbucket.org:company/repo.git' If you're using the ssh url then your credentials must be username + private key. If you're using the https clone url instead of the ssh one, then your credentials should be username + password. To explicitly checkout using a specific credentials stage('Checkout external proj') { steps { git branch: 'my_specific_branch', credentialsId: 'my_cred_id', url: 'ssh://git@test.com/proj/test_proj.git' sh "ls -lat" } } To checkout based on the configred credentials in the current Jenkins Job stage('Checkout code') { steps { checkout scm } } You can use both of the stages within a single Jenkins file. If you want...