I need my code to handle every kind or error that can be thrown by the Net::OpenSSH module. I can't figure out how to do this using the $ssh->error function.
For example :
switch ($ARGV[2]) {
case "OBS" {
my $ssh = Net::OpenSSH->new("$user:$passwdobs\#$ARGV[1]");
$ssh->error and die "echec ssh : " . $ssh->error;
}
}
This code gives me error messages like this:
ssh: connect to host 126.120.180.250 port 22: Connection refused
echec ssh : unable to establish master SSH connection: bad password
or master process exited unexpectedly at sshscript.pl line 26.
These two error messages have nothing in common, the first tells me the real reason, and the second tells me WHO failed (the master ssh connection). It seems the only errors that OpenSSH can throw are the constants listed here: Net::OpenSSH::Constants
I would like my script to let me know why my connections failed, so I can send the errors to a database with the help of a separate ssh_error.sql file. Is this possible with OpenSSH module ?
Related
How do I use NMSSH in Swift?
When I execute the code below, I get these messages in my debug console:
2019-11-14 19:15:53.830479+0100 unLock[49480:480479] NMSSH: Start 192.168.178.97 resolution
2019-11-14 19:15:53.832950+0100 unLock[49480:480481] NMSSH: Socket connection to 192.168.178.97 on port 44 failed with reason -1, trying next address...
2019-11-14 19:15:53.833005+0100 unLock[49480:480481] NMSSH: Failure establishing socket connection
2019-11-14 19:15:53.833047+0100 unLock[49480:480481] NMSSH: Disconnected
The code:
let session = NMSSHSession(host: "192.168.178.97:44", andUsername: "root")
session.connect()
if session.isConnected == true{
session.authenticate(byPassword: "alpine")
//if session.isAuthorized == true {
session.channel.execute("killall SpringBoard", error: nil)
print("killed Springboard")
//}
}
What I've done is allowing arbitrary Loads in App Transport Security because I thought the problem may be that the ssh server isn't HTTPS, but it did not help. The fact that I try to SSH into an iPhone isn't the cause Haswell, as I tried it with a Raspberry Pi, same result. Also don't mind port 44 as it is the correct port for checkra1n.
You can see similar type problem here.
How to use NMSSH in swift
Also Read the Readme file for NMSSH and setup this framework using podfile.
pod 'NMSSH'
Read Documentation here
https://github.com/NMSSH/NMSSH
I am receiving error as
Redis server error: socket error on read socket
Error received as 'JobQueueError from line xxx of JobQueueRedis.php: Redis server error: socket error on read socket'
I tried by changing persistent connection option to true.
$wgObjectCaches['redis'] = [
'class' => 'RedisBagOStuff',
'servers' => [ $redisserver ],
'persistent' => true
];
In our case the following errors would occur because our AWS ElasticeCache Redis Cluster was using 100% of available memory :
"RedisException","message":"socket error on read socket","code":0
"RedisClusterException","message":"Error processing response from Redis node!"
Increasing the number of nodes and or allowing more memory on the instance seemed to solve the problem. But it seems our cached values take a lot of memory and need to expire faster.
For me, it was an error in the health check script, which was written with parm --no-auth-warning, which was not working for redis version 4 which caused redis-cli --no-auth-warning -a password ping resulted in an error after that, the script was retreating the redis server and server has socket error.
I have a test application that I created to start learn weblogic with Eclipse .
yesterday the jsp page was working well when I run as / on server , I got the basic page that I created .
but today I have an error message :
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
in the browser I got this :
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
and an other time I got this on console :
weblogic.application.ModuleException: null
null
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
Truncated. see log file for complete stacktrace
can you explain to me what I miss , when I start the server it has the status started . thank you I can add any information .
The most probable cause is server running in debug mode and having the same debug port as an existing server on same machine.
If you have multiple domains configured for each domain running in development mode on the same machine make sure DEBUG_PORT in the setDomainEnv script has different values.
If you have multiple managed servers on the same domain and same machine, create a separate startManagedWeblogic script to start your managed servers and set the Debug Port in that script.
If you use Node Manager to start your managed servers, make sure you have the following lines set in your nodemanager.properties file, otherwise etDomainEnv.sh won't be executed:
StartScriptEnabled=true
StopScriptEnabled=true
This way, if you start the Managed Server via the Admin Console, setDomainEnv.sh will get called.
Then, you can modify the WebLogic domain script setDomainEnv.sh to set the proper DEBUG_PORT value according to the server name that needs to be started:
Use your favourite editor to change the setDomainEnv.sh file
You should find the following lines already :
if [ "${SERVER_NAME}" = "" ] ; then
SERVER_NAME="AdminServer"
export SERVER_NAME
fi
The same way, you can add :
if [ "${SERVER_NAME}" = "ManagedServer1" ] ; then
DEBUG_PORT="8454"
export DEBUG_PORT
fi
if [ "${SERVER_NAME}" = "ManagedServer2" ] ; then
DEBUG_PORT="8455"
export DEBUG_PORT
fi
I got an error when I using the AWS IoT Embedded C SDK to run on Raspberry Pi 3, It will be appreciate if someone can help.. thanks!
below the info. in my aws_iot_config.h
define AWS_IOT_MQTT_HOST "a3osulxxxxxxxx.iot.us-east-1.amazonaws.com"
define AWS_IOT_MQTT_PORT 8883
define AWS_IOT_MQTT_CLIENT_ID "CsPi6" <br/>
define AWS_IOT_MY_THING_NAME "CsPi6"
define AWS_IOT_ROOT_CA_FILENAME "root-CA.pem"
define AWS_IOT_CERTIFICATE_FILENAME "certificate.pem.crt"
define AWS_IOT_PRIVATE_KEY_FILENAME "private.pem.key"
below the output :
Connecting...
ERROR: iot_tls_connect L#143 TCP Connection error
ERROR: main L#173 Error(-3) connecting to a3osulxxxxxxxx.iot.us-east-1.amazonaws.com:8883
Subscribing...
ERROR: main L#195 Error subscribing
ERROR: main L#235 An error occurred in the loop.
Beside, I tried to ping the endpoint "a3osulxxxxxxxx.iot.us-east-1.amazonaws.com" by using Rpi, it failed. But it success if I use the Mac terminal to ping.
pi#raspberrypi:~ $ ping a3osulxxxxxxxx.iot.us-east-1.amazonaws.com<br/>
ping: unknown host a3osulxxxxxxxx.iot.us-east-1.amazonaws.com<br/>
I am using Net::OpenSSH module to make an ssh connection using ssh key authentication.
my $ssh_handle = Net::OpenSSH->new(user_id#host_name)
I am trying to capture different exception scenarios that may occur during an ssh connection attempt. I am using Try::Tiny for that.
In particular, I am trying to capture scenario where a wrong hostname/IP address is passed in the parameter.
In this scenario, Net::OpenSSH module throws the following error in the console "ssh: Could not resolve hostname x.x.x.: Name or service not known".
I know that $ssh_handle->error gives the error message (in case of any error)
after a connection attempt. But in case of a wrong hostname/IP scenario, it contains a generic message "unable to establish master SSH connection: master process exited unexpectedly".
I believe this is a common error message for many error scenarios. So I can not pin poing "wrong hostname" error.
Is there any way to capture the error string "ssh: Could not resolve hostname x.x.x.: Name or service not known" ?
Redirect the master SSH stderr stream to some file and consult it afterwards:
# untested!
open my $ssherr_fh, '>', 'openssh-err.log' or die $!;
my $ssh = Net::OpenSSH->new(user_id#host_name,
master_stderr_fh => $ssherr_fh);
if ($ssh->error) {
open my $f, '<', 'openssh-err.log';
my #err = <$f>;
print "ssh failed:\n#err\n";
}