@@ -256,30 +256,30 @@ def __init__(
256256
257257 def _setup_proxy_certificates (self ):
258258 """Setup HTTPS proxy certificates from environment variable.
259-
259+
260260 Detects HTTPS_CA_CERTIFICATES environment variable and combines
261261 proxy certificates with system certificates for SSL verification.
262262 """
263263 https_ca_certificates = os .getenv ("HTTPS_CA_CERTIFICATES" )
264264 if not https_ca_certificates :
265265 return
266-
266+
267267 try :
268268 # Create secure temporary directory
269269 cert_dir = tempfile .mkdtemp (prefix = "opencti_proxy_certs_" )
270-
270+
271271 # Write proxy certificate to temp file
272272 proxy_cert_file = os .path .join (cert_dir , "proxy-ca.crt" )
273273 with open (proxy_cert_file , "w" ) as f :
274274 f .write (https_ca_certificates )
275-
275+
276276 # Find system certificates
277277 system_cert_paths = [
278278 "/etc/ssl/certs/ca-certificates.crt" , # Debian/Ubuntu
279- "/etc/pki/tls/certs/ca-bundle.crt" , # RHEL/CentOS
280- "/etc/ssl/cert.pem" , # Alpine/BSD
279+ "/etc/pki/tls/certs/ca-bundle.crt" , # RHEL/CentOS
280+ "/etc/ssl/cert.pem" , # Alpine/BSD
281281 ]
282-
282+
283283 # Create combined certificate bundle
284284 combined_cert_file = os .path .join (cert_dir , "combined-ca-bundle.crt" )
285285 with open (combined_cert_file , "w" ) as combined :
@@ -290,25 +290,26 @@ def _setup_proxy_certificates(self):
290290 combined .write (sys_certs .read ())
291291 combined .write ("\n " )
292292 break
293-
293+
294294 # Add proxy certificate
295295 combined .write (https_ca_certificates )
296-
296+
297297 # Update ssl_verify to use combined certificate bundle
298298 self .ssl_verify = combined_cert_file
299-
299+
300300 # Set environment variables for urllib and other libraries
301301 os .environ ["REQUESTS_CA_BUNDLE" ] = combined_cert_file
302302 os .environ ["SSL_CERT_FILE" ] = combined_cert_file
303-
304- self .app_logger .info ("Proxy certificates configured" , {
305- "cert_bundle" : combined_cert_file
306- })
307-
303+
304+ self .app_logger .info (
305+ "Proxy certificates configured" ,
306+ {"cert_bundle" : combined_cert_file },
307+ )
308+
308309 except Exception as e :
309- self .app_logger .warning ("Failed to setup proxy certificates" , {
310- "error" : str (e )
311- } )
310+ self .app_logger .warning (
311+ "Failed to setup proxy certificates" , { " error" : str (e )}
312+ )
312313
313314 def set_applicant_id_header (self , applicant_id ):
314315 self .request_headers ["opencti-applicant-id" ] = applicant_id
0 commit comments