[
https://issues.apache.org/jira/browse/TC-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16130662#comment-16130662
]
ASF GitHub Bot commented on TC-187:
-----------------------------------
Github user rawlinp commented on a diff in the pull request:
https://github.com/apache/incubator-trafficcontrol/pull/360#discussion_r133738664
--- Diff: traffic_ops/app/lib/API/DeliveryService/SslKeys.pm ---
@@ -161,30 +172,42 @@ sub view_by_hostname {
return $self->alert( { Error => " - A delivery service
does not exist for a host with hostanme of $key" } );
}
- my $xml_id = $ds->xml_id;
+ my $ds_id = $ds->id;
if ( !$version ) {
$version = 'latest';
}
- $key = "$xml_id-$version";
+ $key = "ds_$ds_id-$version";
my $response_container = $self->riak_get( "ssl", $key );
my $response = $response_container->{"response"};
- $response->is_success()
- ? $self->success( decode_json( $response->content ) )
- : $self->alert( { Error => " - A record for ssl key
$key could not be found. Response was: " . $response->content } );
+ if ($response->is_success()) {
+ my $ssl_keys = decode_json( $response->content );
+ $ssl_keys->{certificate}->{csr} =
decode_base64($ssl_keys->{certificate}->{csr}),
+ $ssl_keys->{certificate}->{crt} =
decode_base64($ssl_keys->{certificate}->{crt}),
+ $ssl_keys->{certificate}->{key} =
decode_base64($ssl_keys->{certificate}->{key}),
+ $self->success( $ssl_keys )
+ } else {
+ $self->alert( { Error => " - A record for ssl key $key
could not be found. Response was: " . $response->content } );
+ }
}
}
sub delete {
my $self = shift;
- my $key = $self->param('xmlid');
+ my $xml_id = $self->param('xmlid');
my $version = $self->param('version');
my $response_container;
my $response;
if ( !&is_admin($self) ) {
return $self->alert( { Error => " - You must be an ADMIN to
perform this operation!" } );
}
else {
+ my $ds = $self->db->resultset('Deliveryservice')->search( {
xml_id => $xml_id })->single();
+ if (!$ds) {
+ return $self->alert( { Error => " - Could not found
delivery service with xml_id=$xml_id!" } );
+ }
+ my $ds_id = $ds->id;
+ my $key = "ds_$ds_id";
--- End diff --
preexisting keys won't be deletable?
> Update delivery service makes SSL keys invalid
> ----------------------------------------------
>
> Key: TC-187
> URL: https://issues.apache.org/jira/browse/TC-187
> Project: Traffic Control
> Issue Type: Bug
> Components: Traffic Ops
> Reporter: Zhilin Huang
> Assignee: Zhilin Huang
> Labels: ssl, xml-id
>
> Modify xml-id or subdomain in a https delivery service will make existing SSL
> keys invalid.
> And there is problem to generate keys if using "http and https" together with
> 1 host_regex, and 1 path_regex.
> BTW, the certificate returned by RESTful API is not consistent with that GUI.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)