Last active
February 22, 2016 23:29
-
-
Save jcjones/f140919a4d2d41216bee to your computer and use it in GitHub Desktop.
Useful views for the ct-sql database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW `le_certificate` AS | |
SELECT | |
`certificate`.`certID` AS `certID`, | |
`certificate`.`serial` AS `serial`, | |
`certificate`.`issuerID` AS `issuerID`, | |
`certificate`.`subject` AS `subject`, | |
`certificate`.`notBefore` AS `notBefore`, | |
`certificate`.`notAfter` AS `notAfter` | |
FROM | |
`certificate` | |
WHERE | |
(`certificate`.`issuerID` = (SELECT | |
`issuer`.`issuerID` | |
FROM | |
`issuer` | |
WHERE | |
(`issuer`.`commonName` = 'Let\'s Encrypt Authority X1'))); | |
CREATE VIEW `unexpired_certificate` AS | |
SELECT | |
`certificate`.`certID` AS `certID`, | |
`certificate`.`serial` AS `serial`, | |
`certificate`.`issuerID` AS `issuerID`, | |
`certificate`.`subject` AS `subject`, | |
`certificate`.`notBefore` AS `notBefore`, | |
`certificate`.`notAfter` AS `notAfter` | |
FROM | |
`certificate` | |
WHERE | |
(NOW() BETWEEN `certificate`.`notBefore` AND `certificate`.`notAfter`); | |
CREATE VIEW `le_current_certificate` AS | |
SELECT | |
`certificate`.`certID` AS `certID`, | |
`certificate`.`serial` AS `serial`, | |
`certificate`.`issuerID` AS `issuerID`, | |
`certificate`.`subject` AS `subject`, | |
`certificate`.`notBefore` AS `notBefore`, | |
`certificate`.`notAfter` AS `notAfter` | |
FROM | |
`certificate` | |
WHERE | |
((`certificate`.`issuerID` = (SELECT | |
`issuer`.`issuerID` | |
FROM | |
`issuer` | |
WHERE | |
(`issuer`.`commonName` = 'Let\'s Encrypt Authority X1'))) | |
AND (NOW() BETWEEN `certificate`.`notBefore` AND `certificate`.`notAfter`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment