Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

Network Change & Configuration Management

Reply
Highlighted

how to use HTTPS with NetMRI API

Techie
Posts: 14
3322     0

Hello,

 

I have a problem when trying to use the API with https instead of http.
When I replace the http://<netmri> url in the Perl new method by https://<netmri>, I get the following message:

 

HTTP 501 Protocol scheme 'https' is not supported (Crypt:Smiley FrustratedSLeay or IO:Smiley Frustratedocket:Smiley FrustratedSL not installed) https://ncb1721.nw.shared.fortis/api/base_uri.json?version=2.9.0 at /appl/dcnvp00/Common/Scripts/Tools/NMS/lib/BNP_API2.pm line 148

 

I have read in the release notes that in a future release, http will not be supported anymore (and I suppose this will be the case for accessing the API - I use the API outside the NetMRI solution on a Red-Hat machine).

 

Does anybody know what I have to do to make it use https ?

 

Note: I already use https for accessing the GUI.

 

Thanks in advance for any advice.

 

Bernard Baudoux.

Highlighted

Re: how to use HTTPS with NetMRI API

Adviser
Posts: 353
3323     0
Looks like you need to install some additional Perl modules, I would run yum search to find those and install them. If that doesn’t work you can install them directly from CPAN, but my bet is Red Hat already has them packaged for you.
Highlighted

Re: how to use HTTPS with NetMRI API

Adviser
Posts: 423
3323     0

You add this to your script

 

# comment this out if you are running HTTP only
$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Highlighted

Re: how to use HTTPS with NetMRI API

Techie
Posts: 14
3323     0

I though these modules would be installed by default on the NetMRI box.  Am I wrong ?

 

Thanks.

Highlighted

Re: how to use HTTPS with NetMRI API

Techie
Posts: 14
3323     0

Thanks, I will try to add this statement in my script.

Is it to be performed in every script ?

 

Thanks,

Bernard.

 

Highlighted

Re: how to use HTTPS with NetMRI API

Adviser
Posts: 353
3323     0
I thought you said you were running it on an external Red Hat system?
Highlighted

Re: how to use HTTPS with NetMRI API

Adviser
Posts: 353
3323     0
That is necessary if your certificate does not match the host name, and also I believe if it is signed by a non-public CA (unless you install the CA cert on the client machine).
Highlighted

Re: how to use HTTPS with NetMRI API

Adviser
Posts: 423
3323     0

It would also help if you posted the script

 

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Highlighted

Re: how to use HTTPS with NetMRI API

Techie
Posts: 14
3323     0

the script just tries to open the API.  Here is the coding:

 

sub OpenAPI
 {
  my $Yml = '/appl/dcnvp00/Common/Scripts/Tools/NMS/etc/.netmri.yml';
  my ($foo, $Username, $foo) = split(/ /, `grep username $Yml`); chomp($Username);
  my ($foo, $Password, $foo) = split(/ /, `grep password $Yml`); chomp($Password);
  my ($foo, $URL, $foo)      = split(/ /, `grep url $Yml`);      chomp($URL);
  $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
  $easy = new NetMRI::API({
                           api_version => 2.9,
                           url => $URL,
                           username => $Username,
                           password => $Password,
                        });
  return($easy);
 }

 

I get the error mesage at the "new" line.

 

It runs indeed on an external Rad Hat machine, but I think http code 501 is at server level, am I wrong ?  Red Hat is just the client.

 

Thanks,

Bernard.

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You