Forum Discussion
Vincent_Li_9688
May 22, 2012Historic F5 Account
How to upload cert through Management :: KeyCertificate :: certificate_import_from_file
Hi ,
I adopted the Perl Certificate Info script https://devcentral.f5.com/wiki/iControl.PlCertificateInfo.ashx, and attempt to add new feature like uploading certificate to BIGIP according ...
Alex__Applebaum
Aug 14, 2012Employee
1) The method expects you to pass an array for the cert_ids and file_names fields
you all are sending a single string
my $sCert_ids = "vli_cert";
SOAP::Data->name(cert_ids => $sCert_ids),
Ex. it should be something like:
my $cert_id = "vli_cert"
my $cert_ids = [ $cert_id ]
SOAP::Data->name(cert_ids => $cert_ids),
or for simplicity just put a [ ] around the arguments.
SOAP::Data->name(cert_ids => [ $sCert_ids ]),
$cert_id
2) More importantly, this particular method looks for a file on the bigip itself.
If it can find the file locally, it does upload the file into the LTM Certificate Section but seems to ignore the cert_id fields.
Ex. if I submit:
filename = /var/tmp/pki-2048/bigip/website.pem
cert_id = test-iControl-upload
it creates a file called "website.crt"
If you want to upload a file to the bigip before "importing" to the LTM Certificate section, you could use something like:
https://devcentral.f5.com/wiki/iControl.System__ConfigSync__upload_file.ashx
If you want to upload a file directly from your desktop, I would just use the "certificate_import_from_pem" method which you can garble up the file as one big string:
ex.
something like:
{
local $/=undef;
open FILE, "$sLocalFile" or die "Couldn't open file: $!";
$file_data = ;
close FILE;
}
....
{
$soapResponse = $KeyCertificate->certificate_import_from_pem(
SOAP::Data->name(mode => $sMode ),
SOAP::Data->name(cert_ids => [ $cert_id ] ),
SOAP::Data->name(pem_data => [ $file_data ] ),
SOAP::Data->name(overwrite => 1 ),
);
&checkResponse($soapResponse);
}
which does honor the cert_id field coincidently and writes file whatever you provide there.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects