Skip to content

Commit

Permalink
Merge pull request #50 from napalm-automation-community/use-http-head…
Browse files Browse the repository at this point in the history
…er-authentication

Replace user/password in URL with HTTP header Basic authentication, to avoid credentials ending up in log files
  • Loading branch information
jbemmel authored Nov 6, 2023
2 parents 3cb7106 + c80e96a commit 1197aef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions napalm_srl/srl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Napalm driver for SR Linux.
Read https://napalm.readthedocs.io for more information.
"""
"""
import base64
import json
import logging
Expand Down Expand Up @@ -2592,11 +2592,11 @@ def _jsonrpcPost(self, json_data, timeout=None):
"Accept": "application/json",
}
proto = "https" if (self.jsonrpc_port==443 or (self.jsonrpc_port!=80 and not self.insecure)) else "http"
geturl = f"{proto}://{self.username}:{self.password}@{self.hostname}:{self.jsonrpc_port}/jsonrpc"
geturl = f"{proto}://{self.hostname}:{self.jsonrpc_port}/jsonrpc"
cert = ( self.tls_cert, self.tls_key ) if self.tls_cert and self.tls_key else None
resp = self.jsonrpc_session.post(geturl, headers=headers, json=json_data,
timeout=timeout if timeout else self.timeout,
cert=cert,
auth=(self.username, self.password), cert=cert,
verify=False if self.skip_verify else self.tls_ca)
resp.raise_for_status()
return resp.json() if resp.text else ""
Expand Down

0 comments on commit 1197aef

Please sign in to comment.