├── VERSION ├── .dockerignore ├── Dockerfile ├── registry ├── Dockerfile └── start.sh ├── README.md ├── make.sh ├── Makefile ├── generate_cert.go └── LICENSE /VERSION: -------------------------------------------------------------------------------- 1 | 0.3 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | #Dockerfile 3 | #.dockerignore 4 | generate_cert-* 5 | LICENSE 6 | make.sh 7 | README.md 8 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | FROM golang:1.7 3 | 4 | ADD . /go/src/github.com/SvenDowideit/generate_cert 5 | WORKDIR /go/src/github.com/SvenDowideit/generate_cert 6 | 7 | # Download (but not install) dependencies 8 | RUN go get -d -v ./... 9 | 10 | CMD ["make", "all"] 11 | -------------------------------------------------------------------------------- /registry/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry:2 2 | 3 | ADD https://github.com/SvenDowideit/generate_cert/releases/download/0.3/generate_cert-0.3-linux-amd64 /usr/local/bin/generate_cert 4 | RUN chmod 755 /usr/local/bin/generate_cert 5 | 6 | COPY start.sh /usr/local/bin/ 7 | 8 | ENTRYPOINT 9 | CMD ["start.sh"] 10 | -------------------------------------------------------------------------------- /registry/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ ! -f "/certs/cert.pem" ]]; then 4 | mkdir -p /certs 5 | cd /certs/ 6 | generate_cert --cert=ca.pem --key=cakey.pem 7 | hostlist="$(ip a | grep "inet " | sed 's/.*inet \(.*\)\/.*/\1/g' | tr "\n" ",")$(hostname)" 8 | generate_cert --host=${hostlist} --ca=ca.pem --ca-key=cakey.pem --cert=servercert.pem --key=serverkey.pem 9 | fi 10 | 11 | export REGISTRY_HTTP_TLS_CERTIFICATE=/certs/servercert.pem 12 | export REGISTRY_HTTP_TLS_KEY=/certs/serverkey.pem 13 | 14 | registry serve /etc/docker/registry/config.yml 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generate_cert 2 | 3 | generate the tls certs needed for Docker TLS socket. 4 | 5 | run: 6 | 7 | - `./make.sh` 8 | 9 | Which will generate the certificate files you need and put them into your `~/.docker` dir 10 | 11 | Then copy the certs from `~/.docker/` to your boot2docker and start the server with them: 12 | 13 | - `sudo docker -d --tlsverify --tlscacert=ca.pem --tlscert=servercert.pem --tlskey=serverkey.pem -H tcp://0.0.0.0:2376 -D` 14 | 15 | then back on your OSX box, you can run: 16 | 17 | - docker -H 192.168.59.103:2376 --tls version 18 | 19 | ## Building 20 | 21 | There's a Makefile, which then uses the Dockerfile to generate Linux, OSX and Windows binaries 22 | -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | go build generate_cert.go 4 | 5 | mkdir -p ${HOME}/.docker/boot2docker 6 | cp generate_cert ${HOME}/.docker/ 7 | 8 | # TODO: https://github.com/docker/docker/issues/7418 9 | # When I use DOCKER_CONFIG tls doesn't seem to work as documented 10 | #cd ${HOME}/.docker/boot2docker 11 | cd ${HOME}/.docker 12 | 13 | ./generate_cert --cert=ca.pem --key=cakey.pem 14 | ./generate_cert --host=boot2docker,192.168.59.103 --ca=ca.pem --ca-key=cakey.pem --cert=servercert.pem --key=serverkey.pem 15 | ./generate_cert --ca=ca.pem --ca-key=cakey.pem --cert=cert.pem --key=key.pem 16 | 17 | #echo "to use the 'boot2docker' tls certificates, set:" 18 | #echo " export DOCKER_CONFIG=${HOME}/.docker/boot2docker" 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION := $(shell cat VERSION) 2 | GITSHA1 := $(shell git rev-parse --short HEAD) 3 | GOARCH := amd64 4 | GOFLAGS := -ldflags "-X main.Version=$(VERSION) -X main.GitSHA=$(GITSHA1) -s" 5 | PREFIX := generate_cert 6 | DOCKER_IMAGE := generate_cert-golang 7 | DOCKER_CONTAINER := generate_cert-cli-build 8 | DOCKER_SRC_PATH := /go/src/github.com/SvenDowideit/generate_cert 9 | 10 | default: dockerbuild 11 | @true # stop from matching "%" later 12 | 13 | 14 | # Build binaries in Docker container. The `|| true` hack is a temporary fix for 15 | # https://github.com/dotcloud/docker/issues/3986 16 | dockerbuild: clean 17 | docker build -t "$(DOCKER_IMAGE)" . 18 | docker run --name "$(DOCKER_CONTAINER)" "$(DOCKER_IMAGE)" 19 | docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-darwin-$(GOARCH) . || true 20 | docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-linux-$(GOARCH) . || true 21 | docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-windows-$(GOARCH).exe . || true 22 | docker rm "$(DOCKER_CONTAINER)" 23 | 24 | 25 | # Remove built binaries and Docker container. Silent errors if container not found. 26 | clean: 27 | rm -f $(PREFIX)-* 28 | docker rm "$(DOCKER_CONTAINER)" 2>/dev/null || true 29 | 30 | 31 | release: all 32 | echo "release $(VERSION)" 33 | github-release release -u SvenDowideit -r generate_cert -t $(VERSION) --draft 34 | github-release upload -u SvenDowideit -r generate_cert -t $(VERSION) -f $(PREFIX)-$(VERSION)-darwin-$(GOARCH) -n $(PREFIX)-$(VERSION)-darwin-$(GOARCH) 35 | github-release upload -u SvenDowideit -r generate_cert -t $(VERSION) -f $(PREFIX)-$(VERSION)-linux-$(GOARCH) -n $(PREFIX)-$(VERSION)-linux-$(GOARCH) 36 | github-release upload -u SvenDowideit -r generate_cert -t $(VERSION) -f $(PREFIX)-$(VERSION)-windows-$(GOARCH).exe -n $(PREFIX)-$(VERSION)-windows-$(GOARCH).exe 37 | 38 | all: darwin linux windows 39 | @true # stop "all" from matching "%" later 40 | 41 | # Native Go build per OS/ARCH combo. 42 | %: 43 | CGO_ENABLED=0 GOOS=$@ GOARCH=$(GOARCH) go build $(GOFLAGS) -a -installsuffix cgo -o $(PREFIX)-$(VERSION)-$@-$(GOARCH)$(if $(filter windows, $@),.exe) 44 | 45 | 46 | # This binary will be installed at $GOBIN or $GOPATH/bin. Requires proper 47 | # $GOPATH setup AND the location of the source directory in $GOPATH. 48 | goinstall: 49 | go install $(GOFLAGS) 50 | 51 | buildregistry: 52 | docker build -t registry registry 53 | 54 | runregistry: 55 | docker run --rm -it --net host -p 5000:5000 registry 56 | -------------------------------------------------------------------------------- /generate_cert.go: -------------------------------------------------------------------------------- 1 | // Usage: 2 | // Generate CA 3 | // ./generate_cert --cert ca.pem --key ca-key.pem 4 | // Generate CA overwriting existing files 5 | // ./generate_cert --cert ca.pem --key ca-key.pem --overwrite 6 | // Generate signed certificate 7 | // ./generate_cert --host 127.0.0.1 --cert cert.pem --key key.pem --ca ca.pem --ca-key ca-key.pem 8 | package main 9 | 10 | import ( 11 | "crypto/rand" 12 | "crypto/rsa" 13 | "crypto/tls" 14 | "crypto/x509" 15 | "crypto/x509/pkix" 16 | "encoding/pem" 17 | "flag" 18 | "fmt" 19 | "log" 20 | "math/big" 21 | "net" 22 | "os" 23 | "strings" 24 | "time" 25 | ) 26 | 27 | var ( 28 | host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for") 29 | certFile = flag.String("cert", "", "Output file for certificate") 30 | keyFile = flag.String("key", "", "Output file for key") 31 | ca = flag.String("ca", "", "Certificate authority file to sign with") 32 | caKey = flag.String("ca-key", "", "Certificate authority key file to sign with") 33 | overwrite = flag.Bool("overwrite", false, "Overwrite existing files") 34 | org = flag.String("org", "Boot2Docker", "Organization to generate a certificate for") 35 | days = flag.Int("days", 365, "How long till expiry of a signed certificate - def 365 days") 36 | ) 37 | 38 | const ( 39 | RSABITS = 2048 40 | ) 41 | 42 | func main() { 43 | flag.Parse() 44 | 45 | if *certFile == "" { 46 | log.Fatalf("Missing required parameter: --cert") 47 | } 48 | 49 | if *keyFile == "" { 50 | log.Fatalf("Missing required parameter: --key") 51 | } 52 | 53 | if *ca == "" { 54 | if *caKey != "" { 55 | log.Fatalf("Must provide both --ca and --ca-key") 56 | } 57 | if !*overwrite { 58 | if err := checkFilesExist(*certFile, *keyFile); err != nil { 59 | log.Fatalf("Preventing overwrite: %v", err) 60 | } 61 | } 62 | if err := GenerateCA(*certFile, *keyFile); err != nil { 63 | log.Fatalf("Failure to generate CA: %s", err) 64 | } 65 | } else { 66 | if !*overwrite { 67 | if err := checkFilesExist(*certFile, *keyFile); err != nil { 68 | log.Fatalf("Preventing overwrite: %v", err) 69 | } 70 | } 71 | if err := GenerateCert(strings.Split(*host, ","), *certFile, *keyFile, *ca, *caKey); err != nil { 72 | log.Fatalf("Failure to generate cert: %s", err) 73 | } 74 | } 75 | } 76 | 77 | // newCertificate creates a new template 78 | func newCertificate() *x509.Certificate { 79 | notBefore := time.Now() 80 | notAfter := notBefore.Add(time.Hour * 24 * time.Duration(*days)) 81 | 82 | serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) 83 | serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) 84 | if err != nil { 85 | log.Fatalf("failed to generate serial number: %s", err) 86 | } 87 | 88 | return &x509.Certificate{ 89 | SerialNumber: serialNumber, 90 | Subject: pkix.Name{ 91 | Organization: []string{*org}, 92 | }, 93 | NotBefore: notBefore, 94 | NotAfter: notAfter, 95 | 96 | KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, 97 | // ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, 98 | BasicConstraintsValid: true, 99 | } 100 | } 101 | 102 | // checkFilesExist will verify that the specified files do not exist. 103 | // If they do it will return an error listing the existing files. 104 | // Other errors from os.Stat are returned. 105 | func checkFilesExist(files ...string) error { 106 | existingFiles := make([]string, 0, len(files)) 107 | for _, file := range files { 108 | _, err := os.Stat(file) 109 | if !os.IsNotExist(err) { 110 | if err != nil { 111 | return err 112 | } 113 | existingFiles = append(existingFiles, fmt.Sprintf("%q", file)) 114 | } 115 | } 116 | if len(existingFiles) > 0 { 117 | return fmt.Errorf("the following files already exist: %s. To overwrite files, add `--overwrite`.", strings.Join(existingFiles, " ")) 118 | } 119 | return nil 120 | } 121 | 122 | // GenerateCA generates a new certificate authority 123 | // and stores the resulting certificate and key file 124 | // in the arguments. 125 | func GenerateCA(certFile, keyFile string) error { 126 | log.Printf("Generating a new certificate authority.") 127 | template := newCertificate() 128 | template.IsCA = true 129 | template.KeyUsage |= x509.KeyUsageCertSign 130 | 131 | priv, err := rsa.GenerateKey(rand.Reader, RSABITS) 132 | if err != nil { 133 | return err 134 | } 135 | 136 | derBytes, err := x509.CreateCertificate(rand.Reader, template, template, &priv.PublicKey, priv) 137 | if err != nil { 138 | return err 139 | } 140 | 141 | certOut, err := os.Create(certFile) 142 | if err != nil { 143 | return err 144 | } 145 | pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) 146 | certOut.Close() 147 | 148 | keyOut, err := os.OpenFile(keyFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) 149 | if err != nil { 150 | return err 151 | } 152 | pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}) 153 | keyOut.Close() 154 | 155 | return nil 156 | } 157 | 158 | // GenerateCert generates a new certificate signed using the provided 159 | // certificate authority files and stores the result in the certificate 160 | // file and key provided. The provided host names are set to the 161 | // appropriate certificate fields. 162 | func GenerateCert(hosts []string, certFile, keyFile, caFile, caKeyFile string) error { 163 | template := newCertificate() 164 | if len(hosts) == 1 && hosts[0] == "" { 165 | // client cert. 166 | log.Print("no --host parameters, making a client cert") 167 | template.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth} 168 | template.KeyUsage = x509.KeyUsageDigitalSignature 169 | } else { 170 | log.Print("Generating a server cert") 171 | for _, h := range hosts { 172 | if ip := net.ParseIP(h); ip != nil { 173 | template.IPAddresses = append(template.IPAddresses, ip) 174 | } else { 175 | template.DNSNames = append(template.DNSNames, h) 176 | } 177 | } 178 | } 179 | 180 | tlsCert, err := tls.LoadX509KeyPair(caFile, caKeyFile) 181 | if err != nil { 182 | return err 183 | } 184 | 185 | priv, err := rsa.GenerateKey(rand.Reader, RSABITS) 186 | if err != nil { 187 | return err 188 | } 189 | 190 | x509Cert, err := x509.ParseCertificate(tlsCert.Certificate[0]) 191 | if err != nil { 192 | return err 193 | } 194 | 195 | derBytes, err := x509.CreateCertificate(rand.Reader, template, x509Cert, &priv.PublicKey, tlsCert.PrivateKey) 196 | if err != nil { 197 | return err 198 | } 199 | 200 | certOut, err := os.Create(certFile) 201 | if err != nil { 202 | return err 203 | } 204 | pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) 205 | certOut.Close() 206 | 207 | keyOut, err := os.OpenFile(keyFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) 208 | if err != nil { 209 | return err 210 | } 211 | pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}) 212 | keyOut.Close() 213 | 214 | return nil 215 | } 216 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------