Tuesday, February 16, 2016

Starting a process remotely thru SSH

[user@prh01967.prod /home/user]$ cat startFlagsAgent.sh 
JAVA_HOME=/opt/java/hotspot/7/current/jre
PATH=$JAVA_HOME/bin:$PATH
nohup $JAVA_HOME/bin/java -jar ~/FlagsAgent-0.0.1-SNAPSHOT.jar -https > ~/agent.log &
pId=$!
echo "kill $pId" > ~/stop_agent.sh
chmod u+x ~/stop_agent.sh


  217  ssh userprh01628.prod 'bash -s' < ./startFlagsAgent.sh

Saturday, November 7, 2015

Tuesday, October 27, 2015

Netcat testing port connectivity

-bash-4.1$ telnet  10.75.20.102 8471
Trying 10.75.20.102...
Connected to 10.75.20.102.
Escape character is '^]'.
^CConnection closed by foreign host.
-bash-4.1$ nc 10.75.20.102 8471

^C
-bash-4.1$ nc -vz 10.75.20.102 8471
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
-bash-4.1$ 
Or in a loop
MBP:~ username$ for i in `seq 60 75`; do ssh username@mrh009$i.company.com 'nc -vz 10.75.20.102 8471'; done;
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!

Thursday, October 22, 2015

Installing authorized_keys over a range of hosts automatically

$ for i in `seq 60 75`; do ssh -o "StrictHostKeyChecking no" username@mrh009$i.host.com '[ ! -e .ssh ] &&  mkdir .ssh; echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEArnIJhZCiJz8arKHd1C5gi2B7G22VuMeqDGcj8jv+sdfsdfsdfsdfsdfsdfsfdsfNBekqviSUFXiG1cBNpNxaAstOWyWmKaS1oefeNJ5waihlzR5V9QTTdBCrYavHj4viPMLWfm70eOhZhOzXQjl4x/xSrh/sadfasdfasdf= " > .ssh/authorized_keys && chmod 700 .ssh '; done;

Tuesday, August 4, 2015

External resources like XSD and taglib schema resolving behind the firewall can cause issues at runtime. In order to avoid these it would be wise to set the network proxy settings for each JVM.
-Dhttp.proxyHost=proxy.domain.net
-Dhttp.proxyPort=3128
-Dhttp.nonProxyHosts=domain.net|*.domain.biz

Monday, July 6, 2015

ssh-keygen without prompts and publishing known_hosts

Self provisioning PKI infrastructure and auto registration destination known_hosts

# Generating PKI for publishing the build
ssh-keygen -q -t dsa -N '' -f /opt/jenkins/.ssh/id_dsa

# Registering the mvndev.mycompany.com target
ssh-keyscan -H destination.com,10.76.20.41 >> /opt/jenkins/.ssh/known_hosts