├── go.mod ├── .gitignore ├── README.md ├── sshagent.go ├── go.sum ├── sshagent_windows.go ├── pageant_windows.go └── LICENSE /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/xanzy/ssh-agent 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/Microsoft/go-winio v0.5.2 7 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d 8 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 9 | ) 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssh-agent 2 | 3 | Create a new [agent.Agent](https://godoc.org/golang.org/x/crypto/ssh/agent#Agent) on any type of OS (so including Windows) from any [Go](https://golang.org) application. 4 | 5 | ## Limitations 6 | 7 | When compiled for Windows, it will support [Pageant](http://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter9.html#pageant) as the SSH authentication agent or Windows native SSH agent. 8 | 9 | ## Credits 10 | 11 | Big thanks to [Давид Мзареулян (David Mzareulyan)](https://github.com/davidmz) for creating the [go-pageant](https://github.com/davidmz/go-pageant) package! 12 | 13 | ## Issues 14 | 15 | If you have an issue: report it on the [issue tracker](https://github.com/xanzy/ssh-agent/issues) 16 | 17 | ## Author 18 | 19 | Sander van Harmelen () 20 | 21 | ## License 22 | 23 | The files `pageant_windows.go` and `sshagent_windows.go` have their own license (see file headers). The rest of this package is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 24 | -------------------------------------------------------------------------------- /sshagent.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015, Sander van Harmelen 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | //go:build !windows 18 | // +build !windows 19 | 20 | package sshagent 21 | 22 | import ( 23 | "errors" 24 | "fmt" 25 | "net" 26 | "os" 27 | 28 | "golang.org/x/crypto/ssh/agent" 29 | ) 30 | 31 | // New returns a new agent.Agent that uses a unix socket 32 | func New() (agent.Agent, net.Conn, error) { 33 | if !Available() { 34 | return nil, nil, errors.New("SSH agent requested but SSH_AUTH_SOCK not-specified") 35 | } 36 | 37 | sshAuthSock := os.Getenv("SSH_AUTH_SOCK") 38 | 39 | conn, err := net.Dial("unix", sshAuthSock) 40 | if err != nil { 41 | return nil, nil, fmt.Errorf("Error connecting to SSH_AUTH_SOCK: %v", err) 42 | } 43 | 44 | return agent.NewClient(conn), conn, nil 45 | } 46 | 47 | // Available returns true is a auth socket is defined 48 | func Available() bool { 49 | return os.Getenv("SSH_AUTH_SOCK") != "" 50 | } 51 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= 2 | github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 5 | github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= 6 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 7 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= 8 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 9 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 10 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 11 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 12 | golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 13 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 14 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 15 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= 16 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 17 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= 18 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 19 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 20 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 21 | -------------------------------------------------------------------------------- /sshagent_windows.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 David Mzareulyan 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | // and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, 7 | // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 8 | // is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial 11 | // portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 14 | // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 16 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | // 19 | 20 | //go:build windows 21 | // +build windows 22 | 23 | package sshagent 24 | 25 | import ( 26 | "errors" 27 | "io" 28 | "net" 29 | "sync" 30 | 31 | "github.com/Microsoft/go-winio" 32 | "golang.org/x/crypto/ssh/agent" 33 | ) 34 | 35 | const ( 36 | sshAgentPipe = `\\.\pipe\openssh-ssh-agent` 37 | ) 38 | 39 | // Available returns true if Pageant is running 40 | func Available() bool { 41 | if pageantWindow() != 0 { 42 | return true 43 | } 44 | conn, err := winio.DialPipe(sshAgentPipe, nil) 45 | if err != nil { 46 | return false 47 | } 48 | conn.Close() 49 | return true 50 | } 51 | 52 | // New returns a new agent.Agent and the (custom) connection it uses 53 | // to communicate with a running pagent.exe instance (see README.md) 54 | func New() (agent.Agent, net.Conn, error) { 55 | if pageantWindow() != 0 { 56 | return agent.NewClient(&conn{}), nil, nil 57 | } 58 | conn, err := winio.DialPipe(sshAgentPipe, nil) 59 | if err != nil { 60 | return nil, nil, errors.New( 61 | "SSH agent requested, but could not detect Pageant or Windows native SSH agent", 62 | ) 63 | } 64 | return agent.NewClient(conn), nil, nil 65 | } 66 | 67 | type conn struct { 68 | sync.Mutex 69 | buf []byte 70 | } 71 | 72 | func (c *conn) Close() { 73 | c.Lock() 74 | defer c.Unlock() 75 | c.buf = nil 76 | } 77 | 78 | func (c *conn) Write(p []byte) (int, error) { 79 | c.Lock() 80 | defer c.Unlock() 81 | 82 | resp, err := query(p) 83 | if err != nil { 84 | return 0, err 85 | } 86 | 87 | c.buf = append(c.buf, resp...) 88 | 89 | return len(p), nil 90 | } 91 | 92 | func (c *conn) Read(p []byte) (int, error) { 93 | c.Lock() 94 | defer c.Unlock() 95 | 96 | if len(c.buf) == 0 { 97 | return 0, io.EOF 98 | } 99 | 100 | n := copy(p, c.buf) 101 | c.buf = c.buf[n:] 102 | 103 | return n, nil 104 | } 105 | -------------------------------------------------------------------------------- /pageant_windows.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 David Mzareulyan 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | // and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, 7 | // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 8 | // is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial 11 | // portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 14 | // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 16 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | // 19 | 20 | //go:build windows 21 | // +build windows 22 | 23 | package sshagent 24 | 25 | // see https://github.com/Yasushi/putty/blob/master/windows/winpgntc.c#L155 26 | // see https://github.com/paramiko/paramiko/blob/master/paramiko/win_pageant.py 27 | 28 | import ( 29 | "encoding/binary" 30 | "errors" 31 | "fmt" 32 | "sync" 33 | "syscall" 34 | "unsafe" 35 | 36 | "golang.org/x/sys/windows" 37 | ) 38 | 39 | // Maximum size of message can be sent to pageant 40 | const MaxMessageLen = 8192 41 | 42 | var ( 43 | ErrPageantNotFound = errors.New("pageant process not found") 44 | ErrSendMessage = errors.New("error sending message") 45 | 46 | ErrMessageTooLong = errors.New("message too long") 47 | ErrInvalidMessageFormat = errors.New("invalid message format") 48 | ErrResponseTooLong = errors.New("response too long") 49 | ) 50 | 51 | const ( 52 | agentCopydataID = 0x804e50ba 53 | wmCopydata = 74 54 | ) 55 | 56 | type copyData struct { 57 | dwData uintptr 58 | cbData uint32 59 | lpData unsafe.Pointer 60 | } 61 | 62 | var ( 63 | lock sync.Mutex 64 | 65 | user32dll = windows.NewLazySystemDLL("user32.dll") 66 | winFindWindow = winAPI(user32dll, "FindWindowW") 67 | winSendMessage = winAPI(user32dll, "SendMessageW") 68 | 69 | kernel32dll = windows.NewLazySystemDLL("kernel32.dll") 70 | winGetCurrentThreadID = winAPI(kernel32dll, "GetCurrentThreadId") 71 | ) 72 | 73 | func winAPI(dll *windows.LazyDLL, funcName string) func(...uintptr) (uintptr, uintptr, error) { 74 | proc := dll.NewProc(funcName) 75 | return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) } 76 | } 77 | 78 | // Query sends message msg to Pageant and returns response or error. 79 | // 'msg' is raw agent request with length prefix 80 | // Response is raw agent response with length prefix 81 | func query(msg []byte) ([]byte, error) { 82 | if len(msg) > MaxMessageLen { 83 | return nil, ErrMessageTooLong 84 | } 85 | 86 | msgLen := binary.BigEndian.Uint32(msg[:4]) 87 | if len(msg) != int(msgLen)+4 { 88 | return nil, ErrInvalidMessageFormat 89 | } 90 | 91 | lock.Lock() 92 | defer lock.Unlock() 93 | 94 | paWin := pageantWindow() 95 | 96 | if paWin == 0 { 97 | return nil, ErrPageantNotFound 98 | } 99 | 100 | thID, _, _ := winGetCurrentThreadID() 101 | mapName := fmt.Sprintf("PageantRequest%08x", thID) 102 | pMapName, _ := syscall.UTF16PtrFromString(mapName) 103 | 104 | mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName) 105 | if err != nil { 106 | return nil, err 107 | } 108 | defer syscall.CloseHandle(mmap) 109 | 110 | ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0) 111 | if err != nil { 112 | return nil, err 113 | } 114 | defer syscall.UnmapViewOfFile(ptr) 115 | 116 | mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:] 117 | 118 | copy(mmSlice, msg) 119 | 120 | mapNameBytesZ := append([]byte(mapName), 0) 121 | 122 | cds := copyData{ 123 | dwData: agentCopydataID, 124 | cbData: uint32(len(mapNameBytesZ)), 125 | lpData: unsafe.Pointer(&(mapNameBytesZ[0])), 126 | } 127 | 128 | resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds))) 129 | 130 | if resp == 0 { 131 | return nil, ErrSendMessage 132 | } 133 | 134 | respLen := binary.BigEndian.Uint32(mmSlice[:4]) 135 | if respLen > MaxMessageLen-4 { 136 | return nil, ErrResponseTooLong 137 | } 138 | 139 | respData := make([]byte, respLen+4) 140 | copy(respData, mmSlice) 141 | 142 | return respData, nil 143 | } 144 | 145 | func pageantWindow() uintptr { 146 | nameP, _ := syscall.UTF16PtrFromString("Pageant") 147 | h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP))) 148 | return h 149 | } 150 | -------------------------------------------------------------------------------- /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 | 203 | --------------------------------------------------------------------------------