Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PROC HTTP equivalent of curl option --insecure/-k

Tags:

http

sas

I can access a REST API using curl by sending a system command and using pipe as below

filename fn pipe "curl -k -u &user.:&pass. 'https://blahblah.com/rest/api/content/108428908/child/attachment' ";

data new;
infile fn;
input;
put _infile_;
run;

This works, but I'd like to use PROC HTTP so I get the response back in a .json file rather than in the log, and I can use SAS password encryption. Here's my PROC HTTP code:

filename out "/blah/blahblah/output.json";

proc http
  url    = 'https://blahblah.com/rest/api/content/108428908/child/attachment'
  method = "GET"
  webusername = "&user"
  webpassword = "&pass"
  out    = out
  ;
run;

This works as far as giving me a json file, but the json file I get back says "User not permitted to view attachments on content", which is the response I was getting from curl before adding the -k option (i.e. --insecure).

So how can I do the equivalent of -k in PROC HTTP? (Tell SAS not to check the SSL Cert). Modifying any options outside of those which can be specified within the .SAS file is not an option, as I don't have the access to change those.

like image 634
IceCreamToucan Avatar asked Mar 05 '23 21:03

IceCreamToucan


2 Answers

Is setting the SSLREQCERT flag an option? According to this it looks like you can use the ALLOW option to tell the server to allow connections that fail the SSL handshake.

like image 96
drldcsta Avatar answered Mar 12 '23 13:03

drldcsta


The most correct answer here is to NOT ignore the SSL issue and instead add the certificate to the appropriate trust manager/key store on the machine where you are running PROC HTTP. The method by which to do this varies by OS and SAS version. This documentation page will provide some insight into how to do this.

like image 26
FriedEgg Avatar answered Mar 12 '23 12:03

FriedEgg