├── httpmi ├── __init__.py ├── tests │ ├── __init__.py │ ├── base.py │ └── test_api.py ├── exception.py ├── api.py └── ipmi.py ├── requirements.txt ├── .gitignore ├── test-requirements.txt ├── .stestr.conf ├── .travis.yml ├── Dockerfile ├── setup.cfg ├── tox.ini ├── setup.py ├── Contributing.md ├── README.md ├── Code-of-Conduct.md └── LICENSE /httpmi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /httpmi/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask 2 | pyghmi 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | .tox 4 | .stestr 5 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | hacking 2 | stestr 3 | oslotest 4 | -------------------------------------------------------------------------------- /.stestr.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | test_path=${TESTS_DIR:-./httpmi/tests/} 3 | top_dir=./ 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: python 3 | python: 4 | - "2.7" 5 | - "3.6" 6 | install: pip install tox-travis 7 | script: tox 8 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7-stretch 2 | 3 | ADD . /opt/httpmi 4 | RUN pip install -U /opt/httpmi 5 | RUN pip install uwsgi 6 | 7 | CMD uwsgi --http 127.0.0.1:5000 \ 8 | --wsgi httpmi.api \ 9 | --callable app \ 10 | --master \ 11 | --http-workers 16 12 | -------------------------------------------------------------------------------- /httpmi/tests/base.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Oath Inc 2 | # Licensed under the terms of the Apache 2.0 license. See LICENSE file in 3 | # https://github.com/yahoo/httpmi 4 | 5 | from oslotest import base 6 | 7 | 8 | class TestCase(base.BaseTestCase): 9 | """Test case base class for all unit tests.""" 10 | -------------------------------------------------------------------------------- /httpmi/tests/test_api.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Oath Inc 2 | # Licensed under the terms of the Apache 2.0 license. See LICENSE file in 3 | # https://github.com/yahoo/httpmi 4 | 5 | from httpmi.tests import base 6 | 7 | 8 | class PowerTestCase(base.TestCase): 9 | def test_foo(self): 10 | pass 11 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = httpmi 3 | summary = An HTTP proxy for IPMI commands. 4 | description-file = 5 | README.md 6 | author = Oath 7 | author-email = jim.rollenhagen@oath.com 8 | classifier = 9 | Intended Audience :: Information Technology 10 | Intended Audience :: System Administrators 11 | License :: OSI Approved :: Apache Software License 12 | Operating System :: POSIX :: Linux 13 | Programming Language :: Python 14 | Programming Language :: Python :: 2 15 | Programming Language :: Python :: 2.7 16 | Programming Language :: Python :: 3 17 | Programming Language :: Python :: 3.6 18 | 19 | [files] 20 | packages = 21 | httpmi 22 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | minversion = 1.8 3 | skipsdist = True 4 | envlist = py36,py27,pep8 5 | 6 | [testenv] 7 | usedevelop = True 8 | install_command = pip install -U {opts} {packages} 9 | setenv = VIRTUAL_ENV={envdir} 10 | LANGUAGE=en_US 11 | LC_ALL=en_US.UTF-8 12 | TESTS_DIR=./httpmi/tests/ 13 | deps = 14 | -r{toxinidir}/requirements.txt 15 | -r{toxinidir}/test-requirements.txt 16 | commands = 17 | stestr run {posargs} 18 | 19 | [testenv:pep8] 20 | basepython = python3 21 | whitelist_externals = bash 22 | commands = 23 | flake8 24 | 25 | [flake8] 26 | # H102 -> we use Oath's license header 27 | ignore = H102 28 | filename = *.py 29 | exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build 30 | 31 | [travis] 32 | python = 33 | 2.7: py27 34 | 3.6: py36, pep8 35 | -------------------------------------------------------------------------------- /httpmi/exception.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Oath Inc 2 | # Licensed under the terms of the Apache 2.0 license. See LICENSE file in 3 | # https://github.com/yahoo/httpmi 4 | 5 | 6 | class BaseException(Exception): 7 | _msg_fmt = 'An unknown error occurred.' 8 | 9 | def __init__(self, message=None, **kwargs): 10 | if not message: 11 | try: 12 | message = self._msg_fmt % kwargs 13 | except Exception as e: 14 | # get what we can out if something went wrong 15 | message = self._msg_fmt 16 | 17 | super(BaseException, self).__init__(message) 18 | 19 | 20 | class InvalidPowerState(BaseException): 21 | _msg_fmt = ('Invalid power state: %(state)s. Acceptable values are ' 22 | '"on", "off".') 23 | 24 | 25 | class InvalidBootDevice(BaseException): 26 | _msg_fmt = ('Invalid boot device: %(device)s. Acceptable values are ' 27 | '"network", "hd".') 28 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import setuptools 17 | 18 | # In python < 2.7.4, a lazy loading of package `pbr` will break 19 | # setuptools if some other modules registered functions in `atexit`. 20 | # solution from: http://bugs.python.org/issue15881#msg170215 21 | try: 22 | import multiprocessing # noqa 23 | except ImportError: 24 | pass 25 | 26 | setuptools.setup( 27 | setup_requires=['pbr'], 28 | pbr=True) 29 | -------------------------------------------------------------------------------- /httpmi/api.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Oath Inc 2 | # Licensed under the terms of the Apache 2.0 license. See LICENSE file in 3 | # https://github.com/yahoo/httpmi 4 | 5 | from flask import Flask 6 | from flask import jsonify 7 | from flask import request 8 | 9 | from httpmi import ipmi 10 | 11 | 12 | app = Flask(__name__) 13 | 14 | CREDS_KEYS = ('bmc', 'user', 'password') 15 | CREDS_OPTIONAL_KEYS = ('port',) 16 | 17 | 18 | def _get_bmc_credentials(): 19 | creds = {k: request.form[k] for k in CREDS_KEYS} 20 | for key in CREDS_OPTIONAL_KEYS: 21 | val = request.form.get(key) 22 | if val: 23 | creds[key] = val 24 | return creds 25 | 26 | 27 | @app.route('/power', methods=['GET', 'POST']) 28 | def power(): 29 | creds = _get_bmc_credentials() 30 | if request.method == 'GET': 31 | return jsonify({'state': ipmi.get_power(creds)}) 32 | 33 | # TODO(jroll) add a wait parameter here or make it feel like real IPMI? 34 | new_state = request.form['state'] 35 | return jsonify({'state': ipmi.set_power(creds, new_state)}) 36 | 37 | 38 | @app.route('/boot-device', methods=['GET', 'POST']) 39 | def boot_device(): 40 | creds = _get_bmc_credentials() 41 | if request.method == 'GET': 42 | return jsonify({'device': ipmi.get_boot_device(creds)}) 43 | 44 | new_device = request.form['device'] 45 | return jsonify({'device': ipmi.set_boot_device(creds, new_device)}) 46 | -------------------------------------------------------------------------------- /Contributing.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | First, thanks for taking the time to contribute to our project! The following 4 | information provides a guide for making contributions. 5 | 6 | ## Code of Conduct 7 | By participating in this project, you agree to abide by the [Oath Code of 8 | Conduct](Code-of-Conduct.md). Everyone is welcome to submit a pull request or 9 | open an issue to improve the documentation, add improvements, or report bugs. 10 | 11 | ## How to Ask a Question 12 | If you simply have a question that needs an answer, [create an 13 | issue](https://help.github.com/articles/creating-an-issue/), and label it as a 14 | question. 15 | 16 | ## How To Contribute 17 | 18 | ### Report a Bug or Request a Feature 19 | If you encounter any bugs while using this software, or want to request a new 20 | feature or enhancement, feel free to [create an 21 | issue](https://help.github.com/articles/creating-an-issue/) to report it, make 22 | sure you add a label to indicate what type of issue it is. 23 | 24 | ### Contribute Code 25 | Pull requests are welcome for bug fixes. If you want to implement something 26 | new, please [request a feature first](#report-a-bug-or-request-a-feature) so we 27 | can discuss it. 28 | 29 | #### Creating a Pull Request 30 | Please follow [best 31 | practices](https://github.com/trein/dev-best-practices/wiki/Git-Commit-Best-Practices) 32 | for creating git commits. 33 | 34 | When your code is ready to be submitted, you can [submit a pull 35 | request](https://help.github.com/articles/creating-a-pull-request/) to begin 36 | the code review process. 37 | -------------------------------------------------------------------------------- /httpmi/ipmi.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Oath Inc 2 | # Licensed under the terms of the Apache 2.0 license. See LICENSE file in 3 | # https://github.com/yahoo/httpmi 4 | 5 | from pyghmi.ipmi import command 6 | 7 | from httpmi import exception 8 | 9 | 10 | VALID_POWER_STATES = ('power on', 'power off') 11 | VALID_BOOT_DEVICES = ('pxe', 'disk') 12 | IRONIC_TO_PYGHMI = { 13 | 'power on': 'on', 14 | 'power off': 'off', 15 | 'pxe': 'network', 16 | 'disk': 'hd', 17 | } 18 | PYGHMI_TO_IRONIC = {v: k for k, v in IRONIC_TO_PYGHMI.items()} 19 | 20 | 21 | def _connect(credentials): 22 | return command.Command(bmc=credentials['bmc'], 23 | port=int(credentials.get('port', 623)), 24 | userid=credentials['user'], 25 | password=credentials['password']) 26 | 27 | 28 | def get_power(credentials): 29 | state = _connect(credentials).get_power()['powerstate'] 30 | return PYGHMI_TO_IRONIC[state] 31 | 32 | 33 | def set_power(credentials, state): 34 | if state not in VALID_POWER_STATES: 35 | raise exception.InvalidPowerState(state=state) 36 | state = IRONIC_TO_PYGHMI[state] 37 | res = _connect(credentials).set_power(state) 38 | if 'powerstate' in res: 39 | # already in the desired state, return immediately 40 | return PYGHMI_TO_IRONIC[res['powerstate']] 41 | elif 'pendingpowerstate' in res: 42 | # for now, just return the pending state 43 | # consider adding an optional wait here, to wait for the actual change 44 | return PYGHMI_TO_IRONIC[res['pendingpowerstate']] 45 | 46 | 47 | def get_boot_device(credentials): 48 | data = _connect(credentials).get_bootdev() 49 | return PYGHMI_TO_IRONIC[data['bootdev']] 50 | 51 | 52 | def set_boot_device(credentials, device, persist=False, uefiboot=False): 53 | if device not in VALID_BOOT_DEVICES: 54 | raise exception.InvalidBootDevice(device=device) 55 | device = IRONIC_TO_PYGHMI[device] 56 | new_device = _connect(credentials).set_bootdev( 57 | device, persist=persist, uefiboot=uefiboot)['bootdev'] 58 | return PYGHMI_TO_IRONIC[new_device] 59 | 60 | 61 | # TODO(jroll) ironic also supports: 62 | # get sensors data 63 | # inject nmi 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # httpmi 2 | > An HTTP proxy for IPMI commands. 3 | 4 | [![Build Status](https://travis-ci.org/yahoo/httpmi.svg?branch=master)](https://travis-ci.org/yahoo/httpmi) 5 | 6 | IPMI is an unencrypted protocol that works over UDP. httpmi provides an 7 | HTTP proxy to arbitrary IPMI hosts, as securing HTTP is well-understood. This 8 | provides infrastructure operators the ability to perform IPMI control between 9 | locations more securely. 10 | 11 | ## Table of Contents 12 | 13 | - [Background](#background) 14 | - [Install](#install) 15 | - [Usage](#usage) 16 | - [Contribute](#contribute) 17 | - [License](#license) 18 | 19 | ## Background 20 | 21 | Oath runs a number of edge sites which we wish to control from a central 22 | location. Instead of keeping credentials in the edge site and controlling 23 | servers from there, we use httpmi to proxy credentials and commands into the 24 | site. 25 | 26 | ## Install 27 | 28 | Install httpmi via pip. As it isn't currently on PyPI, just clone the 29 | repository and run `pip install .` from the root. 30 | 31 | We recommend running the app with uWSGI, which looks something like:: 32 | 33 | $ uwsgi --http 127.0.0.1:5000 --wsgi httpmi.api --callable app --master 34 | 35 | For whatever reason, this doesn't currently work from inside the repository, 36 | so `cd` somewhere else first. 37 | 38 | ## Usage 39 | 40 | Every API call uses form data for command parameters and credentials. Every 41 | API call must pass the BMC IP address and credentials in the keys 42 | `bmc`, `user`, and `password`. Some API calls have additional parameters. 43 | 44 | * `GET /power` - returns the current power state of the machine. No additional 45 | parameters required. Example response: 46 | 47 | {"state": "on"} 48 | 49 | Response value may be "on" or "off". 50 | 51 | * `POST /power` - set the power state for the machine. Returns immediately with 52 | the pending power state of the machine if it is changing, or the current 53 | state if the machine is already in the requested state. Takes one parameter, 54 | "state", which may be "on" or "off". Example response: 55 | 56 | {"state": "on"} 57 | 58 | Response value may be "on" or "off". 59 | 60 | Some examples in curl:: 61 | 62 | $ curl -X POST \ 63 | --form user=admin --form password=password \ 64 | --form bmc=10.88.209.247 --form port=6230 65 | --form state=off \ 66 | http://localhost:5000/power 67 | 68 | {"state":"off"} 69 | 70 | $ curl -X GET \ 71 | --form user=admin --form password=password \ 72 | --form bmc=10.88.209.247 --form port=6230 \ 73 | http://localhost:5000/power 74 | 75 | {"state":"off"} 76 | 77 | $ curl -X POST \ 78 | --form user=admin --form password=password \ 79 | --form bmc=10.88.209.247 --form port=6230 \ 80 | --form device=hd \ 81 | http://localhost:5000/boot-device 82 | 83 | {"device":"hd"} 84 | 85 | $ curl -X GET \ 86 | --form user=admin --form password=password \ 87 | --form bmc=10.88.209.247 --form port=6230 \ 88 | http://localhost:5000/boot-device 89 | 90 | {"device":"hd"} 91 | 92 | ## Contribute 93 | 94 | Please refer to [the contributing.md file](Contributing.md) for information 95 | about how to get involved. We welcome issues, questions, and pull requests. 96 | Pull Requests are welcome. 97 | 98 | ## License 99 | 100 | This project is licensed under the terms of the Apache 2.0 open source license. 101 | Please refer to [LICENSE](LICENSE) for the full terms. 102 | -------------------------------------------------------------------------------- /Code-of-Conduct.md: -------------------------------------------------------------------------------- 1 | # Oath Open Source Code of Conduct 2 | 3 | ## Summary 4 | This Code of Conduct is our way to encourage good behavior and discourage bad behavior in our open source community. We invite participation from many people to bring different perspectives to support this project. We pledge to do our part to foster a welcoming and professional environment free of harassment. We expect participants to communicate professionally and thoughtfully during their involvement with this project. 5 | 6 | Participants may lose their good standing by engaging in misconduct. For example: insulting, threatening, or conveying unwelcome sexual content. We ask participants who observe conduct issues to report the incident directly to the project's Response Team at opensource-conduct@oath.com. Oath will assign a respondent to address the issue. We may remove harassers from this project. 7 | 8 | This code does not replace the terms of service or acceptable use policies of the websites used to support this project. We acknowledge that participants may be subject to additional conduct terms based on their employment which may govern their online expressions. 9 | 10 | ## Details 11 | This Code of Conduct makes our expectations of participants in this community explicit. 12 | * We forbid harassment and abusive speech within this community. 13 | * We request participants to report misconduct to the project’s Response Team. 14 | * We urge participants to refrain from using discussion forums to play out a fight. 15 | 16 | ### Expected Behaviors 17 | We expect participants in this community to conduct themselves professionally. Since our primary mode of communication is text on an online forum (e.g. issues, pull requests, comments, emails, or chats) devoid of vocal tone, gestures, or other context that is often vital to understanding, it is important that participants are attentive to their interaction style. 18 | 19 | * **Assume positive intent.** We ask community members to assume positive intent on the part of other people’s communications. We may disagree on details, but we expect all suggestions to be supportive of the community goals. 20 | * **Respect participants.** We expect participants will occasionally disagree. Even if we reject an idea, we welcome everyone’s participation. Open Source projects are learning experiences. Ask, explore, challenge, and then respectfully assert if you agree or disagree. If your idea is rejected, be more persuasive not bitter. 21 | * **Welcoming to new members.** New members bring new perspectives. Some may raise questions that have been addressed before. Kindly point them to existing discussions. Everyone is new to every project once. 22 | * **Be kind to beginners.** Beginners use open source projects to get experience. They might not be talented coders yet, and projects should not accept poor quality code. But we were all beginners once, and we need to engage kindly. 23 | * **Consider your impact on others.** Your work will be used by others, and you depend on the work of others. We expect community members to be considerate and establish a balance their self-interest with communal interest. 24 | * **Use words carefully.** We may not understand intent when you say something ironic. Poe’s Law suggests that without an emoticon people will misinterpret sarcasm. We ask community members to communicate plainly. 25 | * **Leave with class.** When you wish to resign from participating in this project for any reason, you are free to fork the code and create a competitive project. Open Source explicitly allows this. Your exit should not be dramatic or bitter. 26 | 27 | ### Unacceptable Behaviors 28 | Participants remain in good standing when they do not engage in misconduct or harassment. To elaborate: 29 | * **Don't be a bigot.** Calling out project members by their identity or background in a negative or insulting manner. This includes, but is not limited to, slurs or insinuations related to protected or suspect classes e.g. race, color, citizenship, national origin, political belief, religion, sexual orientation, gender identity and expression, age, size, culture, ethnicity, genetic features, language, profession, national minority statue, mental or physical ability. 30 | * **Don't insult.** Insulting remarks about a person’s lifestyle practices. 31 | * **Don't dox.** Revealing private information about other participants without explicit permission. 32 | * **Don't intimidate.** Threats of violence or intimidation of any project member. 33 | * **Don't creep.** Unwanted sexual attention or content unsuited for the subject of this project. 34 | * **Don't disrupt.** Sustained disruptions in a discussion. 35 | * **Let us help.** Refusal to assist the Response Team to resolve an issue in the community. 36 | 37 | We do not list all forms of harassment, nor imply some forms of harassment are not worthy of action. Any participant who *feels* harassed or *observes* harassment, should report the incident. Victim of harassment should not address grievances in the public forum, as this often intensifies the problem. Report it, and let us address it off-line. 38 | 39 | ### Reporting Issues 40 | If you experience or witness misconduct, or have any other concerns about the conduct of members of this project, please report it by contacting our Response Team at opensource-conduct@oath.com who will handle your report with discretion. Your report should include: 41 | * Your preferred contact information. We cannot process anonymous reports. 42 | * Names (real or usernames) of those involved in the incident. 43 | * Your account of what occurred, and if the incident is ongoing. Please provide links to or transcripts of the publicly available records (e.g. a mailing list archive or a public IRC logger), so that we can review it. 44 | * Any additional information that may be helpful to achieve resolution. 45 | 46 | After filing a report, a representative will contact you directly to review the incident and ask additional questions. If a member of the Oath Response Team is named in an incident report, that member will be recused from handling your incident. If the complaint originates from a member of the Response Team, it will be addressed by a different member of the Response Team. We will consider reports to be confidential for the purpose of protecting victims of abuse. 47 | 48 | ### Scope 49 | Oath will assign a Response Team member with admin rights on the project and legal rights on the project copyright. The Response Team is empowered to restrict some privileges to the project as needed. Since this project is governed by an open source license, any participant may fork the code under the terms of the project license. The Response Team’s goal is to preserve the project if possible, and will restrict or remove participation from those who disrupt the project. 50 | 51 | This code does not replace the terms of service or acceptable use policies that are provided by the websites used to support this community. Nor does this code apply to communications or actions that take place outside of the context of this community. Many participants in this project are also subject to codes of conduct based on their employment. This code is a social-contract that informs participants of our social expectations. It is not a terms of service or legal contract. 52 | 53 | ## License and Acknowledgment. 54 | This text is shared under the [CC-BY-4.0 license](https://creativecommons.org/licenses/by/4.0/). This code is based on a study conducted by the [TODO Group](https://todogroup.org/) of many codes used in the open source community. If you have feedback about this code, contact our Response Team at the address listed above. 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | --------------------------------------------------------------------------------