I am trying to automate the process of updating the SSL certificate for ArcGIS Server using cURL. I first get a token then use that to access this URL: https://domain.com:6443/arcgis/admin/machines/MACHINE.NAME/sslcertificates/importExistingServerCerti.... The server is in a private network and we are using our own CA, which works fine, but when I try the above URL I get this response: "Unable to find root ca certificate"
How do I fix this problem so I can automate this process?
Thanks,
Steve
Additional Info:
I decided since it's been more two weeks since I originally posted this and no one has replied that I probably didn't give enough information. The private CA Certificate is installed in the machine's certificate store in the Trusted Root Certification Authorities folder. I also tried to install it into ArcGIS Server here: https://domain.com:6443/arcgis/admin/machines/MACHINE.NAME/sslcertificates/importRootOrIntermediate which worked well enough, but I still got the same error as above.
Any advice would be greatly appreciated.
The ImportRootOrIntermediate Admin API call is for a root or intermediate issuing CA, not for the certificate that ArcGIS Server will use. The wording of your comment made it sound like you tried to import the machine certificate using that command. Have you tried importing the necessary root and intermediate certificates for your organization?
@StevenMorgan Did you find a resolution to this issue? I am having the same issue and not having any luck finding solution.
Thanks,
Noel
I finally found a solution, after months of research with trial and error (mostly error). This solution is written in PHP using cURL.
Step #1 Generate a token:
$param = 'username=admin_user&password=admin_pass&client=ip&ip=10.10.10.15&f=json';
$url = 'https://domain.com:6443/arcgis/admin/generateToken';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
$token = $obj->token;
$pfx = <curl_file_create('/folder/to/your/cert.pfx');
$params = array('token' => $token,'certPassword' => '<cert password>',
'alias' => '<unique name>, 'certFile' => $pfx,'f' => 'json');
$url = 'https:/domain.com:6443/arcgis/admin/machines/MACHINE NAME/
sslcertificates/importExistingServerCertificate';
$ch = curl_init();
curl_setopt<($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("multipart/form-data"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$res = curl_exec($ch);
curl_close($ch);