Azure gateway issues with wild card certificates

Within my current company, we are using azure application gateway to host the application and it is a nice load balancer but with a let’s encrypt wild card certificate I kept on getting the following message on the “Backend health” page where we were trying to use https from the application gateway to the server (keeping things secure is always nice 🙂 )

The Common Name (CN) of the backend server certificate does not match the host header entered in the health probe configuration (v2 SKU) or the FQDN in the backend pool (v1 SKU). Verify if the hostname matches with the CN of the backend server certificate. To learn more visit - https://aka.ms/backendcertcnmismatch.

The main problem is using a wild card certificate e.g. for example.com and a listener pointing to a single subdomain e.g. test.example.com, is that we have to set up “Health probes” to confirm that the backend server was actually hosting test.example.com instead of checking example.com.

So, the nginx daemon was running on the linux server using the wild card certificate we generated via azure functions to generate the let’s encrypt certificate using the hostname of test.example.com and then setup a health probe on the application gateway as below.

and then the health probe will start to work instead of giving the error above, below are the health probes with a status of 200

If the above doesn’t help, just shout.

Morse code

As a test, I was asked to write a morse code task where some of the signals weren’t able to be determined from the input. So in this case instead of having either the dot (.) or dash (-) we have a question mark (?) where it could be either a dot / dash.

Here is an image of the morse code alphabet of dots / dashes and here is a link to a view of the “tree” of the morse code of the dichotomic search, basically binary search of the morse code.

So, we are only going down 3 levels, below are some tests to confirm that the process is working fine.

  • .- = A
  • . = E
  • … = S
  • -.- = K
  • ? = ET
  • -? = NM

So, I approached this test by thinking that I need to have an “item” that stores the current value (e.g. character) and left / right item, and here is my item.h definition.

class item {
    private:
        char value;
        item *left;
        item *right;
    public:
        item(char value,item *left,item *right);
        item(char value);
        item(item *left,item *right);

        item();

        char getValue();

        item* leftItem();
        item* rightItem();
};

And then to build the 3 levels of the search tree

    item* head = new item(
        new item('e',
            new item('i', 
                new item('s'),
                new item('u')
            ),
            new item('a',
                new item('r'),
                new item('w')
            )
        ),
        new item('t',
            new item('n', 
                new item('d'),
                new item('k')
            ),
            new item('m',
                new item('g'),
                new item('o')
            )
        )
    );

and then the last part was literally reading in the signal to be processed and going down the tree either left / right or both for undermined signal.

string output(string signal, item* codes) {
    string ret="";
    if (signal.size() ==0 ) 
        return string(1,codes->getValue());
    for (string::size_type i=0; i < signal.size();i++) {
        if ('?' == signal[i]) {
            ret += output("."+signal.substr(i+1),codes);
            ret += output("-"+signal.substr(i+1),codes);
            return ret;
        } else if ('.' == signal[i]) {
            return output(signal.substr(i+1),codes->leftItem());
        } else if ('-' == signal[i]) {
            return output(signal.substr(i+1),codes->rightItem());
        } else {
            throw invalid_argument(string("Invalid character at this point of the string ").append(signal));
        }
    }
    return ret;
}

If you want to view the whole code, here is the link to the zip file of the morse code.