Skip to content

Commit c95b51e

Browse files
authored
doc: add security documentation (#24)
1 parent c26e820 commit c95b51e

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

docs/.sphinx/.wordlist.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,27 @@ APIs
77
balancer
88
Charmhub
99
CLI
10+
crypto
11+
cryptographic
1012
DCO
1113
Diátaxis
1214
Dqlite
1315
dropdown
1416
EBS
1517
EKS
18+
Etag
1619
enablement
1720
favicon
1821
Furo
1922
Git
2023
GitHub
24+
github
25+
golang
26+
GPG
2127
Grafana
28+
gz
2229
IAM
30+
InRelease
2331
installable
2432
JSON
2533
Juju
@@ -44,12 +52,14 @@ Numbat
4452
observability
4553
OEM
4654
OLM
55+
openpgp
4756
Permalink
4857
PR
4958
pre
5059
PRs
5160
Quickstart
5261
ReadMe
62+
RSA
5363
reST
5464
reStructuredText
5565
roadmap
@@ -64,3 +74,4 @@ UUID
6474
VM
6575
webhook
6676
YAML
77+
YAMLs

docs/reference/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
cmd/index
77
chisel-releases/index
88
Manifest <manifest>
9+
Security Documentation <security>
910
```

docs/reference/security.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
(chisel_security_ref)=
2+
3+
# Chisel Cryptographic Documentation
4+
5+
Chisel downloads Debian packages from
6+
[archive.ubuntu.com](https://archive.ubuntu.com/), and extracts only selected
7+
few files from each package. The slice definition files in
8+
[chisel-releases](https://github.com/canonical/chisel-releases) specify the
9+
files to extract.
10+
11+
Chisel is written in Go.
12+
13+
## Detailed Process
14+
15+
1. Chisel downloads and parses the YAMLs from
16+
[chisel-releases](https://github.com/canonical/chisel-releases) repo[^1]. The
17+
Go package [net/http](https://pkg.go.dev/net/http) is used and a tarball is
18+
downloaded over HTTPS. Checksum of the tarball is not checked after downloading.
19+
20+
Chisel maintains a cache of these files[^2]. When making new requests to
21+
download a release, Chisel reads the Etag from cache and checks whether the
22+
cache is still valid. If it is valid, the cached release YAMLs are used.
23+
24+
1. Chisel downloads a few *InRelease* files from the [Ubuntu Archive
25+
but](http://archive.ubuntu.com) these files are never cached. The InRelease
26+
files are signed by GPG, and Chisel verifies[^3] the integrity using the [Ubuntu
27+
Archive Automatic Signing
28+
Key](https://keyserver.ubuntu.com/pks/lookup?search=f6ecb3762474eda9d21b7022871920d1991bc93c&fingerprint=on&op=index).[^4]
29+
The key is specified in the [chisel.yaml in
30+
chisel-releases](https://github.com/canonical/chisel-releases/blob/a442b2e7208128df6366f859b7a858c0d3fce925/chisel.yaml#L47).
31+
The Go package [golang.org/x/crypto/openpgp](http://golang.org/x/crypto/openpgp)
32+
is used for these purposes.
33+
34+
1. After parsing the *InRelease* files, Chisel downloads *Packages.gz* and
35+
subsequently *Packages* from the archive. Downloads are performed over HTTP and
36+
later the digests are cross-checked[^5]. The Go package
37+
[hash](https://pkg.go.dev/hash) is used. Chisel maintains a cache of these
38+
downloaded files. Each file is stored in the cache with their digest as the
39+
filename.
40+
41+
1. The specified files in the slice definition files are extracted from the
42+
downloaded Debian packages.
43+
44+
## (Relevant) Packages used by Chisel
45+
46+
Following lists the relevant packages used by Chisel to support its
47+
cryptographic needs:
48+
49+
* [golang.org/x/crypto/openpgp](http://golang.org/x/crypto/openpgp) (Go package)
50+
51+
Additionally these Go standard library packages are used:
52+
53+
* [net/http](https://pkg.go.dev/net/http)
54+
* [hash](https://pkg.go.dev/hash)
55+
56+
## Cryptographic technology being exposed to the user
57+
58+
Chisel needs a GPG public key specified in the [chisel.yaml in
59+
chisel-releases](https://github.com/canonical/chisel-releases/blob/a442b2e7208128df6366f859b7a858c0d3fce925/chisel.yaml#L47)
60+
to verify the signed InRelease files it downloads from the Ubuntu Archive. This
61+
file (chisel.yaml) is exposed to the user and Users can very much specify a
62+
different key on their forks.
63+
64+
The default public key in the official repository is the RSA/4096-bit [Ubuntu
65+
Archive Automatic Signing Key
66+
(2018)](https://keyserver.ubuntu.com/pks/lookup?search=f6ecb3762474eda9d21b7022871920d1991bc93c&fingerprint=on&op=index)
67+
with ID 871920D1991BC93C.
68+
69+
```
70+
pub (4)rsa4096/f6ecb3762474eda9d21b7022871920d1991bc93c 2018-09-17T15:01:46Z
71+
uid Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>
72+
```
73+
74+
75+
[^1]: [https://github.com/canonical/chisel/blob/v1.2.0/internal/setup/fetch.go#L32](https://github.com/canonical/chisel/blob/v1.2.0/internal/setup/fetch.go#L32)
76+
77+
[^2]: [https://github.com/canonical/chisel/blob/v1.2.0/internal/cache/cache.go](https://github.com/canonical/chisel/blob/v1.2.0/internal/cache/cache.go)
78+
79+
[^3]: The chain of trust here is that we fully trust GitHub so when we download the chisel-release from it we are also "downloading" the public keys. So, because the public keys are trusted, the downloads from the Ubuntu archives can also be trusted.
80+
81+
[^4]: [https://github.com/canonical/chisel/blob/v1.2.0/internal/archive/archive.go#L285](https://github.com/canonical/chisel/blob/v1.2.0/internal/archive/archive.go#L285)
82+
83+
[^5]: [https://github.com/canonical/chisel/blob/v1.2.0/internal/cache/cache.go#L72-L78](https://github.com/canonical/chisel/blob/v1.2.0/internal/cache/cache.go#L72-L78)

0 commit comments

Comments
 (0)