When importing a certificate, the filter for allowable Names is incorrect
Migrated from: https://tracker.clearos.com/view.php?id=22161
Reported by: Nick Howitt
When you import a certificate, you have to give it a name but the restrictions on the allowable names has been incorrectly implemented. The filter in line 747 of /usr/clearos/apps/certificate_manager/libraries/External_Certificates.php is currently:
return strlen($name) > 3 && preg_match("%^[a-zA-Z0-9\\-_]+(\\.[a-zA-Z0-9\\-_])*$%", $name);
This will allow "test", "test.1", "test.1.2.3" but not "test.123". If you have a period in the name you must have only one character after it before having another period. It looks like the test string is incorrect and needs a "+" after the last "]" to read:
return strlen($name) > 3 && preg_match("%^[a-zA-Z0-9\\-_]+(\\.[a-zA-Z0-9\\-_]+)*$%", $name);
Then it will insist on at least one character after the period, but allow as many as you want. This will allow you to input an FQDN as a name but will not allow a name ending in a period.