Skip to content

Commit

Permalink
changed notBefore,notAfter to timestamp type
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdiba committed Apr 30, 2015
1 parent 589bcf9 commit d6bbdd0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
18 changes: 4 additions & 14 deletions cert_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,12 @@
"validity": {
"properties": {
"notAfter": {
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
},
"type": "string"
"format": "date_hour_minute_second",
"type": "date"
},
"notBefore": {
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
},
"type": "string"
"format": "date_hour_minute_second",
"type": "date"
}
}
},
Expand Down
18 changes: 4 additions & 14 deletions schema_all_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,12 @@
"validity": {
"properties": {
"notAfter": {
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
},
"type": "string"
"format": "date_hour_minute_second",
"type": "date"
},
"notBefore": {
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
},
"type": "string"
"format": "date_hour_minute_second",
"type": "date"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/certAnalyzer/analyserPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,10 @@ func certtoStored(cert *x509.Certificate, parentSignature, domain, ip string, TS
stored.Subject.OrgUnit = cert.Subject.OrganizationalUnit
stored.Subject.CommonName = cert.Subject.CommonName

stored.Validity.NotBefore = cert.NotBefore.UTC().String()
stored.Validity.NotAfter = cert.NotAfter.UTC().String()
nbtime := cert.NotBefore.UTC()
natime := cert.NotAfter.UTC()
stored.Validity.NotBefore = fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%02d", nbtime.Year(), nbtime.Month(), nbtime.Day(), nbtime.Hour(), nbtime.Minute(), nbtime.Second())
stored.Validity.NotAfter = fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%02d", natime.Year(), natime.Month(), natime.Day(), natime.Hour(), natime.Minute(), natime.Second())

stored.X509v3Extensions = getCertExtensions(cert)

Expand Down

4 comments on commit d6bbdd0

@jvehent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should change the structs as well to treat them as time.Time by default

@0xdiba
Copy link
Contributor Author

@0xdiba 0xdiba commented on d6bbdd0 Apr 30, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not currently doing that with first and lastSeenTimestamp
https://github.com/mozilla/TLS-Observer/blob/master/src/certificate/certificate.go#L22-L23

I wonder if ES will be able to use them if I store them as time.Time .

@jvehent
Copy link
Contributor

@jvehent jvehent commented on d6bbdd0 May 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would have to change the doctype to match the format it ends up with when golang marshals it as json. Probably not urgent to do.

@0xdiba
Copy link
Contributor Author

@0xdiba 0xdiba commented on d6bbdd0 May 1, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.