Net::OpenSSH::Gateway->find_gateway fails when ControlPersist option is set - perl

I am trying to create a persistent gateway connection using Net::OpenSSH::Gateway. Below is the code snippet I am using for the same.
my %proxy_opts = (
host => $host,
port=>$port,
password=>$password,
user=>$user ,
scheme=>"ssh",
ssh_cmd => '/usr/bin/ssh',
master_opts =>
[ -o=>"StrictHostKeyChecking=no",
-o=>"TCPKeepAlive=no",
-o=>"ServerAliveInterval=30",
-o=>"ServerAliveCountMax=90",
-o=>"ControlPath=/tmp/ssh-master-%h_%p_%r",
-o=>"ControlPersist=yes"
]
);
my %gateway_settings = ( proxies=>[ {%proxy_opts} ]);
my $gateway = Net::OpenSSH::Gateway->find_gateway(%gateway_settings, errors=>$errors);
I get the error below. But if I remove the option ControlPath and ControlPersist the entire thing works fine.
[ERROR ] unable to establish master SSH connection: bad ssh master at
/root/.libnet-openssh-perl/spangeni-j1.zscaler.-31930-744378, socket
owned by pid 31933 (pid 31931 expected)

I think it's a bug in the module. The module Net::OpenSSH::Gateway doesn't exist on CPAN, and the author already said that:
I have not published it on CPAN yet because, even it is already
functional, I have found some problems with its internal architecture
that I want to solve first. -Source
And also if you see the documentation of Net::OpenSSH you'll see that gateway is an experimental feature.
BTW what version of OpenSSH are you using? ControlPersist requires OpenSSH 5.6 or newer.

If you have tunnels enabled on the gateway machine, you don't need to use Net::OpenSSH::Gateway at all.
my $ssh_g=Net::OpenSSH->new($gateway);
my $proxy_command=$ssh_g->make_remote_command({tunnel => 1}, $host, 22);
my $ssh=Net::OpenSSH->new($host,
master_opts => [-o => "ProxyCommand=$proxy_command"]);

Related

Can not create jms-queue in wildfly using jboss-cli

I started wildfly 24 server with standalone-full.xml profile, when i run following command in jboss-cli to create jms-queue i get following error
[standalone#localhost:9990 /] jms-queue --profile=full add --queue-address=foo --entries=["java:/jms/queue/foo"]
WFLYCTL0175: Resource [
("subsystem" => "messaging-activemq"),
("server" => "default")
] does not exist; a resource at address [
("subsystem" => "messaging-activemq"),
("server" => "default"),
("jms-queue" => "foo")
] cannot be created until all ancestor resources have been added
What am i missing here? Any reference docs to create the jms server, queues?
Update:
I tried to create the server using web console first
And it filed with the required capabilities are not available, any documentation refernece that indicates what are the required capabilities i need to added prior configuring JMS
Yes don't use the profile parameter which is used in domain mode.
jms-queue add --queue-address=foo --entries=["java:/jms/queue/foo"]
works properly.
The issue is i was using wildfly "WildFly Preview EE 9.1 Distribution" the correct verirsion is "Jakarta EE 8 Full & Web Distribution"

Why I get 500 Error while on XAMPP while loading CodeIgniter 3 database library?

I have gone through number of threads on stackoverflow and on other forums to find the answer but could not find relevant answer. People have applied different approaches but none has worked for me thus far.
I am using CI 3 on XAMPP and whenever I load database library in the model, I run into 500 Error.
Here is my CI database config info:
'hostname' => 'localhost',
'username' => 'my_user',
'password' => 'my_pass',
'database' => 'prod_db',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
PHP ini db libraries are as below:
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
My model code is as below:
class loginmodel extends CI_Model {
public function validate_login($username, $password) {
$this->load->database();
$var = 0;
return $var;
}
}
Whenever I remove $this->load->database(); from the model, my code runs and i am able to redirect to a "Login Failed" page. BUT, whenever I load my database library in autoload.php or load it in above model, code fails.
Autoload.php
$autoload['libraries'] = array('database');
Apache error logs showed below errors but I could not figure as why this was happening.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_pdo_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
Please advise.
EDIT:
I verified all config to be OK and as stated in the comments, I added environment variables to windows and verified through PHPInfo that mysqli and mysqlnd were loaded.
Despite getting all the config right, error still persisted and I did a clean install of CI to reproduce library load failure. This time CI returned an error that db access was denied.
I then realized that after migration, database user was not created in the new environment. So once I created the desired user and assigned it required privileges, I was able to run the code just fine.
Therefore, if anyone encounters such issue in future, below steps might help:
First and foremost, verify if your desired user can access the
database.
Modify your .htaccess to use your desired URL schemes only after
verifying that database connection is working
Then verify that absolute path is available in PHP.ini on XAMPP.
Plus, verify that PHP is added in the environment variables. My
Values on Windows 10 are as follows: Variable Name: PHP , Variable
Value: C:\xampp\php\ext
In CI, mysqli is selected as database driver
In PHP.ini mysqli extension is enabled. i.e. php_mysqli.dll
Echo PHPInfo to verify that mysqli and mysqlnd are available in your
installation.
If nothing works, do a clean install of CI on a separate directory and load database library after setting up your database configuration and before setting up .htaccess until you can reproduce the error.
Hope that error will be eliminated!

Using logstash for email alert

I installed logstash 5.5.2 in our windows server and I would like to send an email alert when I identify some sentences.
My output section is the following:
output {
tcp {
host => "host.com"
port => 1234
codec => "json_lines"
}
if "The message was Server with id " in [log_message] {
email {
to => "<myName#company.com>"
from => "<otherName#company.com>"
subject => "Issue appearance"
body => "The input is: %{incident}"
domain => "smtp.intra.company.com"
port => 25
#via => "smtp"
}
}
}
During my debug I got the following messages:
[2017-09-11T13:19:39,181][ERROR][logstash.plugins.registry] Problems loading a plugin with {:type=>"output", :name=>"email", :path=>"logstash/outputs/email", :error_message=>"NameError", :error_class=>NameError
[2017-09-11T13:19:39,186][DEBUG][logstash.plugins.registry] Problems loading the plugin with {:type=>"output", :name=>"email"}
[2017-09-11T13:19:39,195][ERROR][logstash.agent ] Cannot create pipeline {:reason=>"Couldn't find any output plugin named 'email'. Are you sure this is correct? Trying to load the email output plugin resulted in this error: Problems loading the requested plugin named email of type output.
Which I guess says that I don't have the email plugin installed.
Can someone suggest a way to fix this?
Using another solution is not an option, just in case that someone suggests it.
Thanks and regards,
Fotis
I tried to follow the instructions in the official documentation
But the option of creating an offline plugin pack didn't work.
So what I did, was to create a running logstash instance on my client, run the command to install the output-email plugin logstash-plugin install logstash-output-email and afterwards I copied this instance on my server(which had no internet access).

pe_upgrade based module not being applied

OS: Oracle Linux (hey, I'd have preferred CentOS)
Puppet Enterprise 3.3.0 with puppetlabs-stdlib (v4.3.2)
The puppetlabs-pe_upgrade module should allow me to update the puppet enterprise client software on my target nodes, so I wrote this module.
It lives in /etc/puppetlabs/puppet/modules/eeep_upgrade and all it's files are owned by root:pe-puppet. For some reason, the module is apparently not being added to the catalog during runs. I ran 'puppet agent -t --debug' and nothing is executed nor are errors generated. 'puppet parser validate' and puppet-lint and neither found any errors. I probably have an extra colon somewhere.
class { '::pe_upgrade:eeep_pupgrade':
version => '3.6.2',
answersfile => 'pe/answers/agent.txt.erb',
download_dir => 'puppet:///eeep_pupgrade/files/pe/3.6.2',
timeout => '3600',
}

Another facebook Fatal error: Uncaught CurlException

I am using latest base_facebook.php https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php in order to authenticate the user to my web application via facebook.
Everything was working fine until today. I am getting suddenly a message in my web application like this
Fatal error: Uncaught CurlException: 7: Failed to connect to
2a03:2880:10:6f01:face:b00c:0:8: Network is unreachable thrown in
/var/www/pygmaxia2.gr/templates/pygmaxia2gr/base_facebook.php on line
977
Yesterday I was working normally and today all day long with no problem. The problem seemed to apear when I deleted a folder that I didn't need and was totally irrelevant with the file. When I do ctrl F5 for refresh with firefox, the message disappears and everything seems to work. But after a while It appears again just by clicking around in the page.
I have seen many have this problem but in my case there is no solution yet. The problem appears and disappears by itself without something visible causing it. I also need to mention that I am on a ubuntu 12.04 system and today I did an update. Do you think that it would disrupt the ipv6 related files? But still why is it going away periodically and then reappearing again? Also there is no firewall in my System.
Thank you
It seems that Facebook is down now in several country for more than an hour.... Just wait !
I'm having the exact same problem at the very moment, and it seems to me I can't connect to developers.facebook.com altogether.
Set Proxy To Connect Facebook.com
## Find Code In base_facebook.php ##
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.2',
);
And Add option
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.2',
CURLOPT_PROXY => '199.200.120.140:8089',
);
I encountered a similar curl exception since it was attempting to use IPv6 but was unable to.
Could get it working after I forced curl to use IPv4 via curl_setopt(). Followed the suggestion in this link - http://www.tech-and-dev.com/2012/07/how-to-fix-facebook-connect-error.html