Invalid key alias error while creating a virtual host

Hi,

I am trying to create a secure virtual host on port 443 and have created TLS keystore and reference as below

hen I try to create a virtualhost using the below request I get invalid keyalias error

<VirtualHost name="secure">
 <HostAliases>
 <HostAlias>test.com</HostAlias>
 </HostAliases>
 <Interfaces/>
 <Port>443</Port>
 <OCSPStapling>off</OCSPStapling>
 <SSLInfo>
 <Enabled>true</Enabled>
 <ClientAuthEnabled>false</ClientAuthEnabled>
 <KeyStore>ref://apigeetestkeystoreref</KeyStore>
 <KeyAlias>mykeyalias</KeyAlias>
 </SSLInfo>
 </VirtualHost>

keystore is apigeetestkeystore and reference name is apigeetestkeystoreref

By Verifying the keystore using management api

apigee_host:port/v1/o/{org_name}/e/{env_name}/keystores/apigeetestkeystore

{
    "aliases": [
        {
            "aliasName": "mykeyalias",
            "cert": "mykeyalias-cert",
            "key": ""
        }
    ],
    "certs": [
        "mykeyalias-cert"
    ],
    "keys": [
        ""
    ],
    "name": "apigeetestkeystore"
}

All configurations seems fine can someone pls let me know if am missing anything ?

I get the below error

{
    "code": "messaging.config.beans.InvalidKeyAliasReferenceInVirtualHost",
    "message": "VirtualHost secure has invalid keyalias reference mykeyalias. Context Organization:uat;Environment:dev",
    "contexts": []
}

0 3 440
3 REPLIES 3

Not applicable

This looks correct, but still I will suggest to delete and retry the alias creation.

GArnaud
Participant I

Well... I 'm experiencing the exact same issue.

 

I'm trying to create a VirtualHost based on reference.

 

The POST /virtualhosts body:

<VirtualHost name="new-vhost.com">
    <HostAliases>
        <HostAlias>api.server.com</HostAlias>
    </HostAliases>
    <Interfaces/>
    <Port>443</Port>
    <SSLInfo>
        <Enabled>true</Enabled>
        <ClientAuthEnabled>false</ClientAuthEnabled>
        <KeyStore>ref://new-api.server.com</KeyStore>
        <KeyAlias>2022-api-server-com</KeyAlias>
    </SSLInfo>
</VirtualHost>
 
My Keystore :
{
    "aliases": [
        {
            "aliasName""2022-api-server-com",
            "cert""2022-api-server-com-cert",
            "key"""
        }
    ],
    "certs": [ "2022-api-server-com-cert" ],
    "keys": [ "" ],
    "name""new-server.com"
}
 
and my Ref:
{
    "name""new-api.server.com",
    "refers""new-server.com",
    "resourceType""KeyStore"
}


Any idea?
 
Thank you in advance.

Hi

Certificate is missing key file. Cerificate should contain chain and key file. I also face same issue. Resolved by adding key file.