Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DB schema to store target domains under domains column #68

Closed
jvehent opened this issue Dec 6, 2015 · 6 comments
Closed

Update DB schema to store target domains under domains column #68

jvehent opened this issue Dec 6, 2015 · 6 comments

Comments

@jvehent
Copy link
Contributor

jvehent commented Dec 6, 2015

I propose that we change the DB schema to store all domains from the subject and subjectaltname x509 fields under a single domains columns, thus simplifying queries that want to look for both values (eg. WHERE subject ~ 'mozilla' OR subjectaltname ~ 'mozilla').

The subject column which now contains the CN value only should be modified to contain the whole X509 subject line: CN, O, OU, C, ...

@0xdiba
Copy link
Contributor

0xdiba commented Dec 6, 2015

I totally agree with both.
Probably the same thing must be done to the issuer column.

Should we make these fields jsonb fields for consistency or
go with different fields for all of them ? ( subject_cn, subject_o etc... )

@jvehent
Copy link
Contributor Author

jvehent commented Dec 6, 2015

A different column for each seems overkill, but better in line with how databases are supposed to work.
jsonb would allow us to query inside without require multiple columns, I like that options (select subject->>'CN').
Or we can just store the string: C=US, ST=California, L=Mountain View, O=Google Inc, CN=*.google.com

Whichever you think is best.

@jvehent
Copy link
Contributor Author

jvehent commented Dec 14, 2015

Another side effect of the current code is that a number of CA certs don't have a CN, and their subject columns are empty in the database. For example:

observatory=> select count(id) from certificates where is_ca='t' and subject='';
 count 
-------
    68

@0xdiba
Copy link
Contributor

0xdiba commented Dec 14, 2015

Yes a lot of CAs have an empty CN.
This will be solved by transforming the subject and issuer columns to type jsonb and storing all the fields that identify the subject or issuer ( CN, C , O ...).

@0xdiba
Copy link
Contributor

0xdiba commented Dec 17, 2015

Isn't this solved with the merging of #77 ?

@jvehent
Copy link
Contributor Author

jvehent commented Dec 17, 2015

Yep. 👍

@jvehent jvehent closed this as completed Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants