[% USE CPList; USE CPIcons; USE CPScalar; USE SSL; WRAPPER 'master_templates/master.tmpl' app_key = 'manage_ssl_hosts' theme = "bootstrap" include_legacy_stylesheets = 1 scripts = '/js/sorttable.js'; SET ONE_DAY = 60 * 60 * 24; SET NEARLY_EXPIRED_WINDOW = 30 * ONE_DAY; SET MINIMUM_MODULUS_LENGTH = SSL.DEFAULT_KEY_SIZE; MACRO floor(n) GET n FILTER format("%d"); MACRO ceiling(n) GET n + 1 FILTER format("%d"); IF !sslvhosts.size %]

[% locale.maketext('SSL Hosts') %]

[% locale.maketext('There are no secure sites configured on your server!') %]
[% ELSE %] [% PROCESS '_ajaxapp_header.tmpl' -%]

[% locale.maketext('Installed SSL Hosts') %]

[% IF httpd_is_enabled -%] [% END -%] [% SET sslvhosts = sslvhosts.sort('host'); SET now = CPANEL.now(); SET warn_icon = CPIcons.get_common_icon_markup("warning", 16); SET error_icon = CPIcons.get_common_icon_markup("error", 16); SET expiration_dates = sslvhosts.ofeach('crt').ofeach('not_after'); FOR expdate = expiration_dates; expiration_dates.${loop.index} = expdate + 1; END; SET expiration_dates = locale.get_lookup_hash_of_multi_epoch_datetime( expiration_dates, 'date_format_short' ); # Removed datetimes because it slows the page down so much SET expire_error_msg = locale.maketext('The certificate has expired.'); SET self_signed_warn_msg = locale.maketext('Self-signed certificates will cause browser warnings.'); SET key_critical_msg = locale.maketext('A key that does not use [asis,ECDSA] or at least [numf,_1]-bit [asis,RSA] does not provide adequate security.', MINIMUM_MODULUS_LENGTH); SET self_signed = locale.maketext('[comment]- Self Signed -[comment,The decorating dashes are meant to visually distinguish this label from a certificate authority name.]'); SET expire_today = locale.maketext('The certificate will expire today.'); FOR hostdata = sslvhosts; SET host = hostdata.sslhost; SET user = hostdata.user; SET ip = hostdata.ip; SET iptype = hostdata.iptype; SET docroot = hostdata.docroot; IF ! user.defined(); SET user = 'nobody'; END; SET issuer = self_signed; SET issuer_warn = 1; IF ! hostdata.crt.is_self_signed; SET issuer = hostdata.crt.${'issuer.organizationName'}; SET issuer_warn = 0; END; SET not_after = hostdata.crt.not_after; SET expiration_time = not_after + 1; SET expired = (not_after < now); SET nearly_expired = ((not_after - now) < NEARLY_EXPIRED_WINDOW); IF !expired && nearly_expired; SET daysUntilExpiration = ceiling((not_after - now) / ONE_DAY); SET expires_today = (floor((not_after - now) / ONE_DAY) == 0 ? ((not_after - now) % ONE_DAY) > 0 : 0); IF expires_today; SET expire_warn_msg = expire_today; ELSE; SET expire_warn_msg = locale.maketext('Your certificate will expire in [quant,_1,day,days].', daysUntilExpiration); END; END; SET domains_list = [host]; domains_list = domains_list.merge( hostdata.aliases.unique() ).sort(); %] [% IF httpd_is_enabled -%] [% END -%] [% END; %]
[% locale.maketext('Domains') %][% locale.maketext('IP Address') %] [% locale.maketext('IP Address Type') %] [% locale.maketext('Is Primary Website on IP Address?') %] [% locale.maketext('Is [output,acronym,SNI,Server Name Indication] Required?') %][% locale.maketext('Document Root') %] [% locale.maketext('Owner') %] [% locale.maketext('Issuer') %] [% locale.maketext('Expires') %] [% locale.maketext('Key Type') %] [% locale.maketext('Actions') %]
    [% FOR domain = domains_list -%]
  • [% IF hostdata.crt.domains && SSL.validate_domains_lists_have_match(hostdata.crt.domains, domain); SET cert_icon = 'fa-lock'; SET cert_class = 'working'; ELSE; SET cert_icon = 'fa-unlock'; SET cert_class = 'not-working'; END; -%] [% IF domain.match('[*]') -%] [% domain FILTER html %] [% ELSE -%] [% domain FILTER html %] [% END -%]
  • [% END -%]
[% ip %] [% iptype %] [% hostdata.is_primary_on_ip ? locale.maketext('Yes') : locale.maketext('No') %] [% hostdata.needs_sni ? locale.maketext('Yes') : locale.maketext('No') %][% docroot.html().breakOn('_') %] [% user %]
[% issuer %] [% IF issuer_warn %][% warn_icon %][% END %]
[% expiration_dates.${expiration_time} %] [% IF expired %] [% error_icon %] [% ELSIF nearly_expired %] [% warn_icon %] [% END %]
[% hostdata.key_type_label.html() %] [% IF hostdata.key_critical %] [% error_icon %] [% END %]
[% locale.maketext('Delete') %] [% IF httpd_is_enabled && !hostdata.is_primary_on_ip && !host.match('[*]') -%] [% locale.maketext('Make Primary') %] [% END -%]
[% PROCESS '_ajaxapp_footer.tmpl' -%] [% END; END; -%]