├── Dashboard.png ├── .github └── PULL_REQUEST_TEMPLATE.md ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── src ├── main │ ├── resources │ │ ├── log4j2.xml │ │ └── config.yaml │ └── java │ │ └── AWSHealthCheck │ │ ├── Config.java │ │ ├── AWSHelper.java │ │ └── Lambda.java └── sam.yaml ├── LICENSE ├── deploy.sh ├── CONTRIBUTING.md ├── README.md ├── pom.xml └── THIRD-PARTY /Dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amazon-archives/aws-lambda-java-AWSHealth-check/HEAD/Dashboard.png -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | 6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 7 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM amazoncorretto:8 2 | ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto 3 | RUN yum install -y wget 4 | RUN wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo 5 | RUN sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo 6 | RUN yum install -y apache-maven && yum clean all 7 | COPY src /build/src 8 | COPY pom.xml /build 9 | WORKDIR /build 10 | RUN mvn clean package shade:shade 11 | -------------------------------------------------------------------------------- /src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Suggest deploying to us-east-1 due to SES 3 | export AWS_DEFAULT_REGION=us-east-1 4 | #Change the below, an s3 bucket to store lambda code for deploy 5 | #Must be in same region as lambda (ie DEFAULT_REGION) 6 | export CONFIG_BUCKET=changeme 7 | export CONFIG_FILE=config.yaml 8 | #Change below to set the save bucket for saving site fingerprint data. 9 | export BUCKET=changeme 10 | 11 | if [[ ! -f bin/AWSHealthCheck-1.0-SNAPSHOT.jar ]]; then 12 | echo "AWSHealthCheck-1.0-SNAPSHOT.jar not found! Run build.sh first." 13 | exit 1 14 | fi 15 | 16 | aws cloudformation package \ 17 | --template-file src/sam.yaml \ 18 | --output-template-file deploy.sam.yaml \ 19 | --s3-bucket $CONFIG_BUCKET \ 20 | --s3-prefix automate-lambda-java-AWSHealth-check-build 21 | aws cloudformation deploy \ 22 | --template-file deploy.sam.yaml \ 23 | --stack-name automate-lambda-java-AWSHealth-check-build \ 24 | --capabilities CAPABILITY_IAM \ 25 | --parameter-overrides DEFAULTREGION=$AWS_DEFAULT_REGION CONFIGFILE=$CONFIG_FILE BUCKET=$BUCKET 26 | -------------------------------------------------------------------------------- /src/main/resources/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Refer to https://docs.aws.amazon.com/health/latest/APIReference/API_EventFilter.html for limitations of filter 3 | # Regions to check for the AWSHealth API data (cannot exceed 10) 4 | # "global" Region is for "global services" not tied to specific Regions; ex.: IAM, Route53, MarketPlace 5 | regions: 6 | - "global" 7 | - "ap-northeast-1" 8 | - "ap-northeast-2" 9 | # - "ap-northeast-3" 10 | # - "ap-south-1" 11 | # - "ap-southeast-1" 12 | # - "ap-southeast-2" 13 | # - "ca-central-1" 14 | # - "eu-central-1" 15 | - "eu-west-1" 16 | # - "eu-west-2" 17 | # - "eu-west-3" 18 | # - "sa-east-1" 19 | - "us-east-1" 20 | - "us-east-2" 21 | - "us-west-1" 22 | - "us-west-2" 23 | 24 | # Category to check for the AWSHealth API data 25 | category: 26 | - "issue" 27 | - "scheduledChange" 28 | - "accountNotification" 29 | 30 | # Status codes to check for for the AWSHealth API data 31 | status: 32 | - "open" 33 | - "upcoming" 34 | # - "closed" 35 | 36 | # Resource tags to filter for for the AWSHealth API data 37 | tags: 38 | # - {"key": "value"} 39 | # - {"key2": "value"} 40 | 41 | # SES settings 42 | ses_region: "us-east-1" 43 | ses_from: "changeme@domain.com" # Sender 44 | ses_send: "changeme@domain.com,changeme2@domain.com" # Recipient list separated by comma 45 | 46 | # Email template for sending blocked IP found notification. 47 | email_template: "check-AWSHealth\n\n 48 | New AWSHealth API update(s) found: \n\n 49 | %s\n" 50 | ... -------------------------------------------------------------------------------- /src/main/java/AWSHealthCheck/Config.java: -------------------------------------------------------------------------------- 1 | package AWSHealthCheck; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | public class Config { 8 | private List regions; 9 | private List category; 10 | private List status; 11 | private Collection> tags; 12 | private String ses_region; 13 | private String ses_from; 14 | private String ses_send; 15 | private String email_template; 16 | 17 | public List getRegions() { 18 | return regions; 19 | } 20 | 21 | public void setRegions(List regions) { 22 | this.regions = regions; 23 | } 24 | 25 | public String getSes_region() { 26 | return ses_region; 27 | } 28 | 29 | public void setSes_region(String ses_region) { 30 | this.ses_region = ses_region; 31 | } 32 | 33 | public String getSes_from() { 34 | return ses_from; 35 | } 36 | 37 | public void setSes_from(String ses_from) { 38 | this.ses_from = ses_from; 39 | } 40 | 41 | public String getSes_send() { 42 | return ses_send; 43 | } 44 | 45 | public void setSes_send(String ses_send) { 46 | this.ses_send = ses_send; 47 | } 48 | 49 | public String getEmail_template() { 50 | return email_template; 51 | } 52 | 53 | public void setEmail_template(String email_template) { 54 | this.email_template = email_template; 55 | } 56 | 57 | public List getCategory() { 58 | return category; 59 | } 60 | 61 | public void setCategory(List category) { 62 | this.category = category; 63 | } 64 | 65 | public List getStatus() { 66 | return status; 67 | } 68 | 69 | public void setStatus(List status) { 70 | this.status = status; 71 | } 72 | 73 | public Collection> getTags() { 74 | return tags; 75 | } 76 | 77 | public void setTags(Collection> tags) { 78 | this.tags = tags; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check [existing open](https://github.com/awslabs/aws-lambda-java-AWSHealth-check/issues), or [recently closed](https://github.com/awslabs/aws-lambda-java-AWSHealth-check/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *master* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/aws-lambda-java-AWSHealth-check/labels/help%20wanted) issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](https://github.com/awslabs/aws-lambda-java-AWSHealth-check/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | 61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. 62 | -------------------------------------------------------------------------------- /src/sam.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: 'AWS::Serverless-2016-10-31' 3 | Parameters: 4 | DEFAULTREGION: 5 | Type: String 6 | Description: "Region for running the solution" 7 | CONFIGFILE: 8 | Type: String 9 | Description: "Configuration file name " 10 | BUCKET: 11 | Type: String 12 | Description: "S3 Bucket to store the AWSHealth.describeevents() resultset history and SHA256 fingerprint" 13 | 14 | Resources: 15 | AWSHealthChecking: 16 | Type: 'AWS::Serverless::Function' 17 | Properties: 18 | FunctionName: AWSHealthCheckingLambda 19 | Description: "Function for checking new AWSHealth events" 20 | MemorySize: 256 21 | Timeout: 60 22 | Handler: AWSHealthCheck.Lambda::handleRequest 23 | Runtime: java8 24 | CodeUri: ../bin/AWSHealthCheck-1.0-SNAPSHOT.jar 25 | Role: !GetAtt AWSHealthCheckingLambdaIAMRole.Arn 26 | Environment: 27 | Variables: 28 | DEFAULT_REGION: !Ref DEFAULTREGION 29 | CONFIG_FILE: !Ref CONFIGFILE 30 | BUCKET: !Ref BUCKET 31 | Events: 32 | DailyEvent: # Run every 5 min 33 | Properties: 34 | Schedule: cron(*/5 * * * ? *) 35 | Type: Schedule 36 | 37 | AWSHealthCheckingLambdaIAMRole: 38 | Type: "AWS::IAM::Role" 39 | Properties: 40 | Path: "/" 41 | ManagedPolicyArns: #This policy is for Lambda invoke / logging 42 | - "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" 43 | Policies: 44 | - 45 | PolicyName: "root" 46 | PolicyDocument: 47 | Version: "2012-10-17" 48 | Statement: 49 | - #Policy to allow Organizations account description 50 | Effect: "Allow" 51 | Action: 52 | - organizations:DescribeAccount 53 | Resource: "*" 54 | - #Policy to allow SES sending 55 | Effect: "Allow" 56 | Action: 57 | - ses:SendEmail 58 | - ses:SendRawEmail 59 | Resource: "*" 60 | - #Policy to allow reading, storing, and deleting S3 file 61 | Effect: Allow 62 | Action: 63 | - s3:GetObject 64 | - s3:GetObjectAcl 65 | - s3:GetObjectVersion 66 | - s3:PutObject 67 | - s3:PutObjectAcl 68 | - s3:DeleteObject 69 | - s3:DeleteObjectVersion 70 | - s3:ListBucket 71 | - s3:GetBucketLocation 72 | Resource: !Sub arn:aws:s3:::${BUCKET}/* 73 | - #Policy to allow reading, storing, and deleting S3 file 74 | Effect: Allow 75 | Action: 76 | - s3:GetObject 77 | - s3:GetObjectAcl 78 | - s3:GetObjectVersion 79 | - s3:PutObject 80 | - s3:PutObjectAcl 81 | - s3:DeleteObject 82 | - s3:DeleteObjectVersion 83 | - s3:ListBucket 84 | - s3:GetBucketLocation 85 | Resource: !Sub arn:aws:s3:::${BUCKET} 86 | - #Policy to allow CloudWatch 87 | Effect: "Allow" 88 | Action: 89 | - cloudwatch:* 90 | Resource: "*" 91 | - #Policy to allow AWS Health 92 | Effect: "Allow" 93 | Action: 94 | - health:* 95 | Resource: "*" 96 | AssumeRolePolicyDocument: 97 | Version: "2012-10-17" 98 | Statement: 99 | - 100 | Sid: "AllowLambdaServiceToAssumeRole" 101 | Effect: "Allow" 102 | Action: 103 | - "sts:AssumeRole" 104 | Principal: 105 | Service: 106 | - "lambda.amazonaws.com" 107 | 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AWS Lambda Java module for periodic checking of new AWS Health events 2 | 3 | Java SAM Lambda module for periodical checking of AWS Health API for new events and notify via SES if updates are found. 4 | 5 | ![screenshot](Dashboard.png) 6 | 7 | ## License Summary 8 | 9 | This sample code is made available under a modified MIT license. See the LICENSE file. 10 | 11 | ## AWS Costs 12 | AWS Lambda Invocation (Usually Free https://aws.amazon.com/free/) 13 | Amazon SES (Usually Free https://aws.amazon.com/free/) 14 | Minimal Amazon S3 Usage 15 | AWS Support for AWS Health API access (Requires at least Business Support Plan) 16 | https://aws.amazon.com/premiumsupport/pricing 17 | 18 | ## Prerequisites 19 | awscli - https://aws.amazon.com/cli/ 20 | 21 | configure AWS credentials for target account 22 | `aws configure` 23 | 24 | Verified Amazon SES Sender email 25 | https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html 26 | If you verify an email, you can send from/to that address. 27 | To send to other addresses, you need to move SES out of sandbox mode: 28 | https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html 29 | 30 | Docker (For building the Java jar package with the necessary dependencies) - https://www.docker.com/ 31 | 32 | ## Building 33 | Run build.sh to build a new lambda deployment package. 34 | This requires Docker, as it builds the package in an Amazon Linux container. 35 | 36 | `sh build.sh` 37 | 38 | ## Deploying (SAM / Script) 39 | Update the values in deploy.sh for your AWS account details. 40 | CONFIG_BUCKET: S3 Bucket to use for storing the deployment artifacts 41 | CONFIG_FILE: Configuration file name 42 | BUCKET: Bucket for - 43 | 1. Keeping previous AWS Health API call result history and SHA256 fingerprint 44 | for the last Health API call result that had returned events. 45 | 46 | And then run deploy.sh 47 | 48 | `sh deploy.sh` 49 | 50 | ## Deploy Manually (Lambda Console) 51 | 1. Create a lambda function (Java 8 runtime) 52 | 2. Create a lambda IAM execution role with ses:, s3:, organizations:DescribeAccount:, health: 53 | 3. Upload to console from AWSHealthCheck-1.0-SNAPSHOT.jar produced by running 'build.sh'. 54 | 4. Update ENV Variables in Lambda console 55 | CONFIG_FILE: Configuration file name 56 | DEFAULT_REGION: Bucket Region 57 | BUCKET: Bucket for storing previous AWS Health API call history and SHA256 fingerprint. 58 | 5. Create a trigger (CloudWatch Event) 59 | 60 | ## Manually Running / Testing 61 | Once the lambda is created, find it in the AWS Lambda console.\ 62 | You can create a test event with any test event parameter(this solution does not parse passed in Lambda parameter) 63 | for manual/user-initiated execution. 64 | ```json 65 | {} 66 | ``` 67 | 68 | https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-test-function.html 69 | 70 | ## Customize the settings 71 | Edit the contents of src/config.yaml 72 | 73 | ```yaml 74 | # Refer to https://docs.aws.amazon.com/health/latest/APIReference/API_EventFilter.html for limitations of filter 75 | # Regions to check for the AWSHealth API data (cannot exceed 10) 76 | regions: 77 | - "ap-northeast-1" 78 | - "ap-northeast-2" 79 | # - "ap-northeast-3" 80 | # - "ap-south-1" 81 | # - "ap-southeast-1" 82 | # - "ap-southeast-2" 83 | # - "ca-central-1" 84 | # - "eu-central-1" 85 | - "eu-west-1" 86 | # - "eu-west-2" 87 | # - "eu-west-3" 88 | # - "sa-east-1" 89 | - "us-east-1" 90 | - "us-east-2" 91 | - "us-west-1" 92 | - "us-west-2" 93 | 94 | # Category to check for the AWSHealth API data 95 | category: 96 | - "issue" 97 | - "scheduledChange" 98 | - "accountNotification" 99 | 100 | # Status codes to check for for the AWSHealth API data 101 | status: 102 | - "open" 103 | - "upcoming" 104 | # - "closed" 105 | 106 | # Resource tags to filter for for the AWSHealth API data 107 | tags: 108 | # - {"key": "value"} 109 | # - {"key2": "value"} 110 | 111 | # SES settings 112 | ses_region: "us-east-1" 113 | ses_from: "changeme" # Sender 114 | ses_send: "changeme" # Recipient list separated by comma 115 | 116 | # Email template for sending blocked IP found notification. 117 | email_template: "check-AWSHealth\n\n 118 | New AWSHealth API update(s) found: \n\n 119 | %s\n" 120 | ``` 121 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | AWSHealthCheck 5 | AWSHealthCheck 6 | jar 7 | 1.0-SNAPSHOT 8 | AWSHealthCheck 9 | http://maven.apache.org 10 | 11 | 1.8 12 | 1.8 13 | 14 | 15 | 16 | 17 | src/main/resources 18 | ${project.build.directory}/classes 19 | 20 | **/log4j2.xml 21 | **/config.yaml 22 | 23 | 24 | 25 | 26 | 27 | org.apache.maven.plugins 28 | maven-shade-plugin 29 | 2.4.3 30 | 31 | false 32 | 33 | 34 | 35 | package 36 | 37 | shade 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-shade-plugin 45 | 2.4.3 46 | 47 | 48 | package 49 | 50 | shade 51 | 52 | 53 | 54 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | com.github.edwgiz 64 | maven-shade-plugin.log4j2-cachefile-transformer 65 | 2.8.1 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | com.amazonaws 74 | aws-java-sdk-bom 75 | 1.11.492 76 | pom 77 | 78 | 79 | com.amazonaws 80 | aws-java-sdk-core 81 | 1.11.492 82 | 83 | 84 | com.amazonaws 85 | aws-java-sdk-s3 86 | 1.11.492 87 | 88 | 89 | com.amazonaws 90 | aws-java-sdk-health 91 | 1.11.492 92 | 93 | 94 | com.amazonaws 95 | aws-java-sdk-organizations 96 | 1.11.492 97 | 98 | 99 | com.amazonaws 100 | aws-java-sdk-sts 101 | 1.11.492 102 | 103 | 104 | com.amazonaws 105 | aws-java-sdk-ses 106 | 1.11.492 107 | 108 | 109 | com.amazonaws 110 | aws-java-sdk-lambda 111 | 1.11.492 112 | 113 | 114 | com.amazonaws 115 | aws-java-sdk-cloudwatch 116 | 1.11.492 117 | 118 | 119 | com.amazonaws 120 | aws-java-sdk-logs 121 | 1.11.492 122 | 123 | 124 | com.amazonaws 125 | aws-lambda-java-core 126 | 1.2.0 127 | 128 | 129 | com.amazonaws 130 | aws-lambda-java-log4j2 131 | 1.1.0 132 | 133 | 134 | org.apache.logging.log4j 135 | log4j-core 136 | 2.11.1 137 | 138 | 139 | org.apache.logging.log4j 140 | log4j-api 141 | 2.11.1 142 | 143 | 144 | commons-io 145 | commons-io 146 | 2.6 147 | 148 | 149 | org.yaml 150 | snakeyaml 151 | 1.23 152 | 153 | 154 | javax.mail 155 | javax.mail-api 156 | 1.6.2 157 | 158 | 159 | com.sun.mail 160 | javax.mail 161 | 1.6.2 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/main/java/AWSHealthCheck/AWSHelper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | * software and associated documentation files (the "Software"), to deal in the Software 6 | * without restriction, including without limitation the rights to use, copy, modify, 7 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 11 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 12 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 13 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 14 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Helper class for AWS API calls 18 | * 19 | * @author Paul Hyung Yuel Kim 20 | * @version 1.0 21 | * @since 2019-02-06 22 | */ 23 | package AWSHealthCheck; 24 | 25 | import com.amazonaws.SdkClientException; 26 | import com.amazonaws.services.cloudwatch.model.*; 27 | import com.amazonaws.services.health.AWSHealth; 28 | import com.amazonaws.services.health.AWSHealthClientBuilder; 29 | import com.amazonaws.services.health.model.*; 30 | import com.amazonaws.services.organizations.*; 31 | import com.amazonaws.services.cloudwatch.*; 32 | import com.amazonaws.services.organizations.model.DescribeAccountRequest; 33 | import com.amazonaws.services.s3.AmazonS3; 34 | import com.amazonaws.services.s3.AmazonS3ClientBuilder; 35 | import com.amazonaws.services.s3.model.*; 36 | import com.amazonaws.services.securitytoken.AWSSecurityTokenService; 37 | import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder; 38 | import com.amazonaws.services.securitytoken.model.GetCallerIdentityRequest; 39 | import com.amazonaws.services.simpleemail.*; 40 | import com.amazonaws.services.simpleemail.model.RawMessage; 41 | import com.amazonaws.services.simpleemail.model.SendRawEmailRequest; 42 | import com.amazonaws.services.simpleemail.model.SendRawEmailResult; 43 | import org.apache.commons.io.FileUtils; 44 | import org.apache.logging.log4j.LogManager; 45 | import org.apache.logging.log4j.Logger; 46 | import java.io.File; 47 | import java.io.IOException; 48 | import java.util.*; 49 | 50 | public final class AWSHelper { 51 | 52 | // Initialize the Log4j LOGGER. 53 | private static final Logger LOGGER = LogManager.getLogger(AWSHelper.class); 54 | 55 | private AWSHelper(){} 56 | 57 | /*private static class SingletonHelper { 58 | private static final AWSHelper INSTANCE = new AWSHelper(); 59 | } 60 | 61 | public static AWSHelper getInstance() { 62 | return SingletonHelper.INSTANCE; 63 | }*/ 64 | 65 | public static class OrganizationHelper { 66 | private static final AWSOrganizations CLIENT = AWSOrganizationsClientBuilder.defaultClient(); 67 | 68 | public static String getAccountName(String accountID) { 69 | LOGGER.debug("Querying AWS account name info"); 70 | DescribeAccountRequest request = new DescribeAccountRequest(); 71 | request.setAccountId(accountID); 72 | return CLIENT.describeAccount(request).getAccount().getName(); 73 | } 74 | 75 | public static String getAccountEmail(String accountID) { 76 | LOGGER.debug("Querying AWS account email info"); 77 | DescribeAccountRequest request = new DescribeAccountRequest(); 78 | request.setAccountId(accountID); 79 | return CLIENT.describeAccount(request).getAccount().getEmail(); 80 | } 81 | } 82 | 83 | public static class STSHelper { 84 | private static final AWSSecurityTokenService CLIENT = AWSSecurityTokenServiceClientBuilder.defaultClient(); 85 | 86 | public static String getAccountID() { 87 | LOGGER.debug("Querying AWS accountID"); 88 | GetCallerIdentityRequest request = new GetCallerIdentityRequest(); 89 | return CLIENT.getCallerIdentity(request).getAccount(); 90 | } 91 | } 92 | 93 | public static class S3Helper { 94 | private static AmazonS3 client; 95 | 96 | /* List bucket object result limit per REQUEST to 1 week on the assumption 97 | * that the job will run in 5 minute interval and store the results to s3. 98 | * 60 min * 24 hrs * 7 days + 1 (Hash result object) = 2017 99 | */ 100 | public static final Integer MAX_KEYS = 2017; 101 | 102 | /* 103 | * Lazy initialize S3 CLIENT 104 | */ 105 | private static void buildS3Client(String region) { 106 | client = AmazonS3ClientBuilder.standard().withRegion(region).build(); 107 | } 108 | 109 | private static void buildS3Client() { 110 | client = AmazonS3ClientBuilder.defaultClient(); 111 | } 112 | 113 | public static PutObjectResult uploadFile(String bucket, File localFile, String remoteFilename, String region) { 114 | buildS3Client(region); 115 | return upload(bucket, localFile, remoteFilename); 116 | } 117 | 118 | public static PutObjectResult uploadFile(String bucket, File localFile, String remoteFilename) { 119 | buildS3Client(); 120 | return upload(bucket, localFile, remoteFilename); 121 | } 122 | 123 | private static PutObjectResult upload(String bucket, File localFile, String remoteFilename){ 124 | LOGGER.debug("Uploading " + localFile.getName() + " to " + bucket + "/" + remoteFilename); 125 | return client.putObject(bucket, remoteFilename, localFile); 126 | } 127 | 128 | public static void downloadFile(String bucket, String localFilename, String remoteFilename, String region) { 129 | buildS3Client(region); 130 | download(bucket, localFilename, remoteFilename); 131 | } 132 | 133 | public static void downloadFile(String bucket, String localFilename, String remoteFilename) { 134 | buildS3Client(); 135 | download(bucket, localFilename, remoteFilename); 136 | } 137 | 138 | private static void download(String bucket, String localFilename, String remoteFilename) { 139 | LOGGER.debug("Downloading " + bucket + "/" + remoteFilename + " to " + localFilename); 140 | try { 141 | S3Object s3object = client.getObject(bucket, remoteFilename); 142 | S3ObjectInputStream inputStream = s3object.getObjectContent(); 143 | FileUtils.copyInputStreamToFile(inputStream, new File(localFilename)); 144 | } catch (AmazonS3Exception | IOException e) { 145 | LOGGER.error(e.getMessage()); 146 | } 147 | } 148 | 149 | public static List listBucketContents(String bucket, String region) { 150 | buildS3Client(region); 151 | return listBucket(bucket); 152 | } 153 | 154 | public static List listBucketContents(String bucket) { 155 | buildS3Client(); 156 | return listBucket(bucket); 157 | } 158 | 159 | private static List listBucket(String bucket) { 160 | List objects = new ArrayList<>(); 161 | 162 | try { 163 | ListObjectsV2Request request = new ListObjectsV2Request().withBucketName(bucket); 164 | ListObjectsV2Result result; 165 | 166 | do { 167 | request.setMaxKeys(MAX_KEYS); 168 | result = client.listObjectsV2(request); 169 | 170 | for (S3ObjectSummary objectSummary : result.getObjectSummaries()) { 171 | objects.add(objectSummary); 172 | } 173 | 174 | String token = result.getNextContinuationToken(); 175 | request.setContinuationToken(token); 176 | } while (result.isTruncated()); 177 | } catch (AmazonS3Exception e) { 178 | LOGGER.error(e.getMessage()); 179 | } 180 | return objects; 181 | } 182 | 183 | public static List deleteFiles(String bucket, String region, List keys) { 184 | buildS3Client(region); 185 | return deleteObjects(bucket, keys); 186 | } 187 | 188 | public static List deleteFiles(String bucket, List keys) { 189 | buildS3Client(); 190 | return deleteObjects(bucket, keys); 191 | } 192 | 193 | private static List deleteObjects(String bucket, List keys) { 194 | List deletedKeys = new ArrayList<>(); 195 | 196 | try { 197 | /* 198 | * Divide the list of keys to delete into 500 (instead of 1000, to be safe) chunks due to 199 | * S3 java sdk issue: 200 | * "Attempting to delete more than 1000 keys from S3 gives confusing MalformedXML", 201 | * https://github.com/aws/aws-sdk-java/issues/1293 202 | */ 203 | int chunkSize = 500; 204 | List> keysList = new ArrayList<>(); 205 | for (int i=0; i < keys.size(); i += chunkSize) { 206 | int end = Math.min(keys.size(), i + chunkSize); 207 | keysList.add(keys.subList(i, end)); 208 | } 209 | 210 | for (List i : keysList) { 211 | DeleteObjectsRequest request = new DeleteObjectsRequest(bucket); 212 | List keys2 = new ArrayList<>(); 213 | for (String j: i) { 214 | keys2.add(new DeleteObjectsRequest.KeyVersion(j)); 215 | } 216 | request.setKeys(keys2); 217 | DeleteObjectsResult result = client.deleteObjects(request); 218 | 219 | for (DeleteObjectsResult.DeletedObject k: result.getDeletedObjects()) { 220 | deletedKeys.add(k.getKey()); 221 | } 222 | } 223 | } catch (AmazonS3Exception e) { 224 | LOGGER.error(e.getMessage()); 225 | } 226 | 227 | return deletedKeys; 228 | } 229 | 230 | public static boolean doesFileExist(String bucket, String key, String region) { 231 | buildS3Client(region); 232 | return doesObjectExist(bucket, key); 233 | } 234 | 235 | public static boolean doesFileExist(String bucket, String key) { 236 | buildS3Client(); 237 | return doesObjectExist(bucket, key); 238 | } 239 | 240 | private static boolean doesObjectExist(String bucket, String key) { 241 | boolean result = false; 242 | try { 243 | result = client.doesObjectExist(bucket, key); 244 | } catch (SdkClientException e) { 245 | LOGGER.error(e.getMessage()); 246 | } 247 | 248 | return result; 249 | } 250 | 251 | } 252 | 253 | public static class SESHelper { 254 | private static AmazonSimpleEmailService client; 255 | 256 | public static void sendRawEmail(String sender, String recipient, RawMessage rawMessage, String region) { 257 | client = AmazonSimpleEmailServiceClientBuilder.standard().withRegion(region).build(); 258 | sendRawMessage(sender, recipient, rawMessage); 259 | 260 | } 261 | 262 | public static void sendRawEmail(String sender, String recipient, RawMessage rawMessage) { 263 | client = AmazonSimpleEmailServiceClientBuilder.defaultClient(); 264 | sendRawMessage(sender, recipient, rawMessage); 265 | } 266 | 267 | private static void sendRawMessage(String sender, String recipient, RawMessage rawMessage) { 268 | LOGGER.debug("Sending Email: sender-" + sender + " recipient-" + recipient + " message-" + rawMessage); 269 | SendRawEmailRequest request = new SendRawEmailRequest(); 270 | request.setSource(sender); 271 | request.setDestinations(Arrays.asList(recipient.split(","))); 272 | request.setRawMessage(rawMessage); 273 | SendRawEmailResult result = client.sendRawEmail(request); 274 | LOGGER.info(result.toString()); 275 | } 276 | } 277 | 278 | public static class CloudWatchHelper { 279 | private static final AmazonCloudWatch CLIENT = AmazonCloudWatchClientBuilder.defaultClient(); 280 | private static final List DATA_LIST = new ArrayList<>(); 281 | 282 | public static boolean addMetricData(Map data) { 283 | String dimensionName = ""; 284 | String dimensionValue = ""; 285 | if (data.containsKey("dimensionName")) { 286 | dimensionName = data.get("dimensionName"); 287 | } 288 | if (data.containsKey("dimensionValue")) { 289 | dimensionValue = data.get("dimensionValue"); 290 | } 291 | Dimension dimension = new Dimension().withName(dimensionName).withValue(dimensionValue); 292 | 293 | String metricName = ""; 294 | Double metricData = 0.0; 295 | if (data.containsKey("metricName")) { 296 | metricName = data.get("metricName"); 297 | } 298 | if (data.containsKey("metricData")) { 299 | metricData = Double.parseDouble(data.get("metricData")); 300 | } 301 | MetricDatum datum = new MetricDatum() 302 | .withMetricName(metricName) 303 | .withUnit(StandardUnit.None) 304 | .withValue(metricData) 305 | .withDimensions(dimension); 306 | 307 | return DATA_LIST.add(datum); 308 | } 309 | 310 | public static String putMetricData(String namespace) { 311 | if (namespace == null || namespace.trim() == "") { 312 | namespace = "AWS-Health-Checker"; 313 | } 314 | PutMetricDataRequest request = new PutMetricDataRequest() 315 | .withNamespace(namespace) 316 | .withMetricData(DATA_LIST); 317 | 318 | PutMetricDataResult response = CLIENT.putMetricData(request); 319 | DATA_LIST.clear(); 320 | return response.toString(); 321 | } 322 | } 323 | 324 | public static class AWSHealthHelper { 325 | private static final AWSHealth CLIENT = AWSHealthClientBuilder.defaultClient(); 326 | 327 | public static List describeEvents(List region, List category, 328 | List status, Collection> tags, 329 | List startTimes, List endTimes) { 330 | List result = new ArrayList<>(); 331 | 332 | /* 333 | * TODO: Modify config.yaml, AWSHealthCheck.Config.java, and this method to add more filters. 334 | * https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEvents.html 335 | */ 336 | EventFilter filter = new EventFilter(); 337 | filter.setRegions(region); 338 | filter.setEventStatusCodes(status); 339 | filter.setEventTypeCategories(category); 340 | filter.setTags(tags); 341 | if (startTimes != null) filter.setStartTimes(startTimes); 342 | if (endTimes != null) filter.setEndTimes(endTimes); 343 | DescribeEventsRequest request = new DescribeEventsRequest(); 344 | request.setFilter(filter); 345 | DescribeEventsResult response = CLIENT.describeEvents(request); 346 | 347 | result.addAll(response.getEvents()); 348 | 349 | while (response.getNextToken() != null) { 350 | request.setNextToken(response.getNextToken()); 351 | response = CLIENT.describeEvents(request); 352 | result.addAll(response.getEvents()); 353 | } 354 | return result; 355 | } 356 | 357 | public static List describeEventDetails(Collection eventArns) { 358 | List result; 359 | 360 | DescribeEventDetailsRequest request_detail = new DescribeEventDetailsRequest(); 361 | request_detail.setEventArns(eventArns); 362 | DescribeEventDetailsResult response = CLIENT.describeEventDetails(request_detail); 363 | result = response.getSuccessfulSet(); 364 | return result; 365 | } 366 | 367 | public static List describeAffectedEntities(Collection eventArns) { 368 | List result = new ArrayList<>(); 369 | 370 | EntityFilter filter = new EntityFilter(); 371 | filter.setEventArns(eventArns); 372 | 373 | DescribeAffectedEntitiesRequest request_detail_entity = new DescribeAffectedEntitiesRequest(); 374 | request_detail_entity.setFilter(filter); 375 | DescribeAffectedEntitiesResult response = CLIENT.describeAffectedEntities(request_detail_entity); 376 | result.addAll(response.getEntities()); 377 | 378 | while (response.getNextToken() != null) { 379 | request_detail_entity.setNextToken(response.getNextToken()); 380 | response = CLIENT.describeAffectedEntities(request_detail_entity); 381 | result.addAll(response.getEntities()); 382 | } 383 | return result; 384 | } 385 | 386 | } 387 | 388 | } -------------------------------------------------------------------------------- /src/main/java/AWSHealthCheck/Lambda.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this 5 | * software and associated documentation files (the "Software"), to deal in the Software 6 | * without restriction, including without limitation the rights to use, copy, modify, 7 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 11 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 12 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 13 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 14 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Automate AWSHealth API calls and event notifications 18 | * 19 | * A script, for lambda use, to check for AWSHealth events and notify via SES. 20 | * 21 | * @author Paul Hyung Yuel Kim 22 | * @version 1.0 23 | * @since 2019-02-06 24 | */ 25 | package AWSHealthCheck; 26 | 27 | import com.amazonaws.services.health.model.AffectedEntity; 28 | import com.amazonaws.services.health.model.DateTimeRange; 29 | import com.amazonaws.services.health.model.EventDetails; 30 | import com.amazonaws.services.lambda.runtime.Context; 31 | import com.amazonaws.services.health.model.Event; 32 | import com.amazonaws.services.lambda.runtime.RequestStreamHandler; 33 | import com.amazonaws.services.s3.model.S3ObjectSummary; 34 | import com.amazonaws.services.simpleemail.model.RawMessage; 35 | import org.apache.logging.log4j.LogManager; 36 | import org.apache.logging.log4j.Logger; 37 | import org.yaml.snakeyaml.Yaml; 38 | import org.yaml.snakeyaml.constructor.Constructor; 39 | import javax.mail.Message; 40 | import javax.mail.MessagingException; 41 | import javax.mail.Session; 42 | import javax.mail.internet.InternetAddress; 43 | import javax.mail.internet.MimeBodyPart; 44 | import javax.mail.internet.MimeMessage; 45 | import javax.mail.internet.MimeMultipart; 46 | import java.io.*; 47 | import java.lang.reflect.InvocationTargetException; 48 | import java.lang.reflect.Method; 49 | import java.nio.ByteBuffer; 50 | import java.nio.charset.StandardCharsets; 51 | import java.security.MessageDigest; 52 | import java.security.NoSuchAlgorithmException; 53 | import java.text.DateFormat; 54 | import java.text.SimpleDateFormat; 55 | import java.time.ZonedDateTime; 56 | import java.util.*; 57 | import java.util.stream.Collectors; 58 | 59 | public class Lambda implements RequestStreamHandler { 60 | private static final Logger LOGGER = LogManager.getLogger(Lambda.class); 61 | private static final String REGION = System.getenv("DEFAULT_REGION"); 62 | private static final String BUCKET = System.getenv("BUCKET"); 63 | private static final String PERSIST_FILE_PATH = "/tmp/"; 64 | private static final String PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT = 65 | AWSHelper.OrganizationHelper.getAccountName(AWSHelper.STSHelper.getAccountID()) 66 | + "EventsNotificationSent.ser"; 67 | private static final String PERSIST_HASH_RESULT = 68 | AWSHelper.OrganizationHelper.getAccountName(AWSHelper.STSHelper.getAccountID()) 69 | + "AWSHealthCheckHashResult.txt"; 70 | private static final String PERSIST_FILE_NAME = 71 | AWSHelper.OrganizationHelper.getAccountName(AWSHelper.STSHelper.getAccountID()) 72 | + "AWSHealthCheckResultEvents_%s.txt"; 73 | private static final Integer MAX_FETCH_MONTHS_PERIOD = 3; 74 | private Config config; 75 | 76 | // EventDetail with affected list of resources 77 | class EventDetailWithResources { 78 | private EventDetails eventDetail; 79 | private List eventResources = new ArrayList<>(); 80 | 81 | EventDetailWithResources(EventDetails e) { 82 | this.eventDetail = e; 83 | } 84 | 85 | EventDetails getEventDetail() { 86 | return eventDetail; 87 | } 88 | 89 | List getEventResources() { 90 | return eventResources; 91 | } 92 | } 93 | 94 | public void handleRequest(InputStream inputStream, OutputStream outputStream, 95 | Context context) throws IOException { 96 | List resultEvents = new ArrayList<>(); 97 | 98 | String events = getAWSHealthEvents(resultEvents); 99 | 100 | /* Track the list of events that had notifications sent out; we'll need them in case describeEvents call 101 | * have filter for excluding 'closed' events since the users will want 'event closed' notifications 102 | * when they're closed. 103 | */ 104 | if (!config.getStatus().contains("closed")) { 105 | try { 106 | List pastEvent = loadEvents(); 107 | Set s1; 108 | if (pastEvent != null) { 109 | s1 = new HashSet<>(pastEvent.stream().map(Event::getArn).collect(Collectors.toList())); 110 | } else { 111 | s1 = new HashSet<>(); 112 | } 113 | Set s2; 114 | if (resultEvents != null) { 115 | s2 = new HashSet<>(resultEvents.stream().map(Event::getArn).collect(Collectors.toList())); 116 | } 117 | else { 118 | s2 = new HashSet<>(); 119 | } 120 | s1.removeAll(s2); // List of events that was closed since the last notification 121 | List recentlyClosedEvents = new ArrayList<>(s1); 122 | 123 | events += getDetaildEventDescriptionWithAffectedResources(recentlyClosedEvents, 124 | resultEvents.size() + 1); 125 | } catch (IOException | ClassNotFoundException e) { 126 | LOGGER.error(e.getMessage()); 127 | } 128 | } 129 | 130 | // Check if new events are found since the last notification 131 | if (events.trim().length() > 0) { 132 | String shaHash = getSHAHash(events); 133 | String shaHashOnFile = ""; 134 | 135 | if (AWSHelper.S3Helper.doesFileExist(BUCKET, PERSIST_HASH_RESULT, REGION)) { 136 | AWSHelper.S3Helper.downloadFile(BUCKET, PERSIST_FILE_PATH + PERSIST_HASH_RESULT, 137 | PERSIST_HASH_RESULT, REGION); 138 | shaHashOnFile = readFileContents(PERSIST_FILE_PATH + PERSIST_HASH_RESULT); 139 | } 140 | 141 | if (shaHash.compareTo(shaHashOnFile) != 0) { 142 | // Send notification and persist the new hash result. 143 | writeFileContents(PERSIST_FILE_PATH + PERSIST_HASH_RESULT, shaHash); 144 | File f = new File(PERSIST_FILE_PATH + PERSIST_HASH_RESULT); 145 | AWSHelper.S3Helper.uploadFile(BUCKET, f, PERSIST_HASH_RESULT, REGION); 146 | 147 | String emailContent = String.format(config.getEmail_template(), events); 148 | 149 | RawMessage rawMessage = prepareRawMessage(emailContent); 150 | 151 | if (rawMessage != null) { 152 | AWSHelper.SESHelper.sendRawEmail(config.getSes_from(), config.getSes_send(), rawMessage, 153 | config.getSes_region()); 154 | LOGGER.info(String.format("Sending email to %s\n", config.getSes_send())); 155 | } 156 | 157 | LOGGER.info(emailContent); 158 | } else { 159 | LOGGER.info("No new AWS Health events found since the last notification."); 160 | } 161 | } else { 162 | LOGGER.info("No new AWS Health events found since the last notification."); 163 | } 164 | 165 | // Persist event results for keeping history and conduct bucket housekeeping 166 | persistEventResult(events); 167 | truncateEventResultsFromS3(); 168 | 169 | // Overwrite with the current 'open' event list 170 | if (!config.getStatus().contains("closed")) persistEvents(resultEvents); 171 | } 172 | 173 | public Lambda() { 174 | config = loadConfig(); 175 | } 176 | 177 | private Config loadConfig() { 178 | String configPath = System.getenv("CONFIG_FILE"); 179 | if (configPath == null || configPath.trim() == "") { 180 | configPath = "../config.yaml"; 181 | } else { 182 | configPath = "../" + configPath; 183 | } 184 | 185 | LOGGER.info("Loading config settings from: " + configPath); 186 | Yaml yaml = new Yaml(new Constructor(Config.class)); 187 | InputStream inputStream = this.getClass().getResourceAsStream(configPath); 188 | 189 | Config config = yaml.load(inputStream); 190 | return config; 191 | } 192 | 193 | private String getAWSHealthEvents(List resultEvents) { 194 | /* 195 | * describeEvents call will return all the past events. Therefore, limit the result set by adding event 196 | * start time filter. 197 | */ 198 | if (config.getStatus().contains("closed")) { 199 | DateTimeRange startTime = new DateTimeRange(); 200 | Date from = Date.from(ZonedDateTime.now().minusMonths(MAX_FETCH_MONTHS_PERIOD).toInstant()); 201 | Date to = Date.from(ZonedDateTime.now().toInstant()); 202 | startTime.setFrom(from); 203 | startTime.setTo(to); 204 | List startTimes = new ArrayList<>(); 205 | startTimes.add(startTime); 206 | 207 | resultEvents.addAll(AWSHelper.AWSHealthHelper.describeEvents(config.getRegions(), config.getCategory(), 208 | config.getStatus(), config.getTags(), startTimes, null)); 209 | } else { 210 | resultEvents.addAll(AWSHelper.AWSHealthHelper.describeEvents(config.getRegions(), config.getCategory(), 211 | config.getStatus(), config.getTags(), null, null)); 212 | } 213 | 214 | List eventArns; 215 | if (resultEvents.size() > 0) { 216 | eventArns = resultEvents.stream().map(Event::getArn).collect(Collectors.toList()); 217 | } else { 218 | eventArns = new ArrayList<>(); 219 | } 220 | 221 | return getDetaildEventDescriptionWithAffectedResources(eventArns, 1); 222 | } 223 | 224 | private String getDetaildEventDescriptionWithAffectedResources(List eventArns, Integer eventCounterOffset) { 225 | if (eventArns.size() == 0) return ""; 226 | 227 | /* 228 | * Divide the eventArns into chunks of 5 (due to maximum length factor) since DescribeEventDetails only takes 229 | * in a maximum of 10 event ARN at a time with maximum length of 1600. 230 | * https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html 231 | */ 232 | int chunkSize = 5; 233 | List> eventArnsLists = new ArrayList<>(); 234 | for (int i=0; i < eventArns.size(); i += chunkSize) { 235 | int end = Math.min(eventArns.size(), i + chunkSize); 236 | eventArnsLists.add(eventArns.subList(i, end)); 237 | } 238 | 239 | // Get eventDetails and affectedResources from the events returned 240 | List resultEventsDetail = new ArrayList<>(); 241 | List resultEventsDetailDetail = new ArrayList<>(); 242 | for (List i : eventArnsLists) { 243 | resultEventsDetail.addAll(AWSHelper.AWSHealthHelper.describeEventDetails(i)); 244 | resultEventsDetailDetail.addAll(AWSHelper.AWSHealthHelper.describeAffectedEntities(i)); 245 | } 246 | 247 | List eventDetailWithResources = new ArrayList<>(); 248 | for (EventDetails i : resultEventsDetail) { 249 | EventDetailWithResources row = new EventDetailWithResources(i); 250 | 251 | // Find relevant resources for the event and add them to eventResources list\ 252 | List affectedEntities = resultEventsDetailDetail.stream() 253 | .filter(affectedEntity -> affectedEntity.getEventArn() 254 | .compareTo(i.getEvent().getArn()) == 0 ? true : false) 255 | .collect(Collectors.toList()); 256 | row.getEventResources().addAll(affectedEntities); 257 | 258 | eventDetailWithResources.add(row); 259 | } 260 | 261 | // Sort to print in the most recent event order 262 | Collections.sort(eventDetailWithResources, (e1,e2) -> e2.eventDetail.getEvent().getStartTime() 263 | .compareTo(e1.eventDetail.getEvent().getStartTime())); 264 | 265 | int num = eventCounterOffset; 266 | StringBuilder output = new StringBuilder(); 267 | for (EventDetailWithResources i : eventDetailWithResources) { 268 | 269 | output.append("Event " + num++ + ")" + System.getProperty("line.separator")); 270 | 271 | // Use reflection to build event summary string 272 | List methods = Arrays.asList(i.getEventDetail().getEvent().getClass().getMethods()); 273 | 274 | /* 275 | * Consistent output string is required for proper comparision via SHA256 signature 276 | * Sort the returned methods array as they're not guaranteed to be in order 277 | * https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html 278 | */ 279 | Collections.sort(methods, Comparator.comparing(Method::getName)); 280 | for (Method m: methods) { 281 | try { 282 | if (m.getName().startsWith("get") && m.getName() != "getClass" 283 | && m.getParameterTypes().length == 0) { 284 | output.append(m.getName().replace("get", "") 285 | + ": " + m.invoke(i.getEventDetail().getEvent()) 286 | + System.getProperty("line.separator")); 287 | } 288 | } catch (IllegalAccessException | InvocationTargetException ex) { 289 | LOGGER.error(ex.getMessage()); 290 | output.setLength(0); 291 | } 292 | } 293 | output.append(System.getProperty("line.separator")); 294 | 295 | output.append("\tSummary:" + System.getProperty("line.separator") + System.getProperty("line.separator")); 296 | // Get event summary and tabify each line 297 | output.append(i.eventDetail.getEventDescription().getLatestDescription() 298 | .replaceAll("(?m)^", "\t") + System.getProperty("line.separator")); 299 | if (i.getEventResources().size() > 0) { 300 | if (i.getEventResources().get(0).getEntityArn() != null && !i.getEventResources().get(0) 301 | .getEntityArn().isEmpty()) { 302 | output.append("\t\tAffected resources:" + System.getProperty("line.separator") 303 | + System.getProperty("line.separator")); 304 | } 305 | } 306 | for (AffectedEntity j : i.getEventResources()) { 307 | // Check if this is an actual affected entity 308 | if (j.getEntityArn() == null || j.getEntityArn().isEmpty()) { 309 | continue; 310 | } 311 | output.append("\t\t" + "ARN: " + j.getEntityArn() + System.getProperty("line.separator")); 312 | if (j.getEntityUrl() != null && !j.getEntityUrl().isEmpty()) { 313 | output.append("\t\t" + "URL: " + j.getEntityUrl() + System.getProperty("line.separator")); 314 | } 315 | if (j.getEntityValue() != null && !j.getEntityValue().isEmpty()) { 316 | output.append("\t\t" + "Value: " + j.getEntityValue() + System.getProperty("line.separator")); 317 | } 318 | if (j.getStatusCode() != null && !j.getStatusCode().isEmpty()) { 319 | output.append("\t\t" + "Status Code: " + j.getStatusCode() + System.getProperty("line.separator")); 320 | } 321 | if (j.getLastUpdatedTime() != null) { 322 | output.append("\t\t" + "Last Updated Time: " + j.getLastUpdatedTime() 323 | + System.getProperty("line.separator")); 324 | } 325 | 326 | Map tags = j.getTags(); 327 | if (tags != null) { 328 | List> sortedTags = tags.entrySet().stream() 329 | .filter((Map.Entry e) -> e.getValue() == null) 330 | .sorted(Comparator.comparing((Map.Entry e) -> e.getKey()) 331 | .thenComparing(Map.Entry::getValue)) 332 | .collect(Collectors.toList()); 333 | if (sortedTags.size() > 0) { 334 | output.append("\t\t" + "Tags: " + System.getProperty("line.separator")); 335 | } 336 | for (Map.Entry k : sortedTags) { 337 | output.append("\t\t\t" + "Key: " + k.getKey() + "\tValue: " + k.getValue() 338 | + System.getProperty("line.separator")); 339 | } 340 | } 341 | } 342 | output.append(System.getProperty("line.separator")); 343 | output.append(System.getProperty("line.separator")); 344 | output.append(System.getProperty("line.separator")); 345 | } 346 | return output.toString(); 347 | } 348 | 349 | /* 350 | * Persist the getAWSHealthEvents() result 351 | */ 352 | private void persistEventResult(String events) { 353 | DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss"); 354 | Date date = new Date(); 355 | String fileName = String.format(PERSIST_FILE_NAME, dateFormat.format(date)); 356 | 357 | writeFileContents(PERSIST_FILE_PATH + fileName, events); 358 | File f = new File(PERSIST_FILE_PATH + fileName); 359 | AWSHelper.S3Helper.uploadFile(BUCKET, f, fileName, REGION); 360 | } 361 | 362 | private void persistEvents(List resultEvents) throws IOException { 363 | ObjectOutputStream oos = new ObjectOutputStream( 364 | new FileOutputStream(PERSIST_FILE_PATH+PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT)); 365 | oos.writeObject(resultEvents); 366 | oos.close(); 367 | File f = new File(PERSIST_FILE_PATH+PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT); 368 | AWSHelper.S3Helper.uploadFile(BUCKET, f, PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT, REGION); 369 | } 370 | 371 | private List loadEvents() throws IOException, ClassNotFoundException { 372 | List list = null; 373 | 374 | if (AWSHelper.S3Helper.doesFileExist(BUCKET, PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT, REGION)) { 375 | AWSHelper.S3Helper.downloadFile(BUCKET, PERSIST_FILE_PATH+PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT, 376 | PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT, REGION); 377 | } 378 | 379 | File f = new File(PERSIST_FILE_PATH+PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT); 380 | if (f.exists()) { 381 | ObjectInputStream ois = new ObjectInputStream( 382 | new FileInputStream(PERSIST_FILE_PATH+PERSIST_EVENTS_WITH_NOTIFICATIONS_SENT)); 383 | list = (List) ois.readObject(); // cast is needed. 384 | ois.close(); 385 | } 386 | 387 | return list; 388 | } 389 | 390 | /* 391 | * Truncate getAWSHealthEvents() results older than the threshold from the bucket 392 | */ 393 | private void truncateEventResultsFromS3() { 394 | List bucketObjects = AWSHelper.S3Helper.listBucketContents(BUCKET, REGION); 395 | bucketObjects.sort(Comparator.comparing(S3ObjectSummary::getLastModified)); 396 | if (bucketObjects.size() > AWSHelper.S3Helper.MAX_KEYS) { 397 | List keys = new ArrayList<>(); 398 | for (int i = 0; i < (bucketObjects.size() - AWSHelper.S3Helper.MAX_KEYS); i++) { 399 | keys.add(bucketObjects.get(i).getKey()); 400 | } 401 | List result = AWSHelper.S3Helper.deleteFiles(BUCKET, REGION, keys); 402 | if (result.size() != keys.size()) { 403 | Set setKeys = new HashSet<>(keys); 404 | Set setResult = new HashSet<>(result); 405 | setKeys.removeAll(setResult); 406 | LOGGER.error("S3 delete failed for the following files: "); 407 | for (String i : setKeys) { 408 | LOGGER.error(i); 409 | } 410 | } 411 | } 412 | } 413 | 414 | private RawMessage prepareRawMessage(String emailContent) { 415 | RawMessage rawMessage = null; 416 | try { 417 | Session session = Session.getDefaultInstance(new Properties()); 418 | MimeMessage message = new MimeMessage(session); 419 | message.setSubject("[aws-lambda-java-AWSHealth-check] Found new health events", "UTF-8"); 420 | message.setFrom(new InternetAddress(config.getSes_from())); 421 | message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(config.getSes_send())); 422 | 423 | // Create a multipart/alternative child container. 424 | MimeMultipart msg_body = new MimeMultipart("alternative"); 425 | 426 | // Create a wrapper for the HTML and text parts. 427 | MimeBodyPart wrap = new MimeBodyPart(); 428 | 429 | // Define the text part. 430 | MimeBodyPart textPart = new MimeBodyPart(); 431 | textPart.setContent(emailContent, "text/plain; charset=UTF-8"); 432 | 433 | // Add the text and HTML parts to the child container. 434 | msg_body.addBodyPart(textPart); 435 | 436 | // Add the child container to the wrapper object. 437 | wrap.setContent(msg_body); 438 | 439 | // Create a multipart/mixed parent container. 440 | MimeMultipart msg = new MimeMultipart("mixed"); 441 | 442 | // Add the parent container to the message. 443 | message.setContent(msg); 444 | 445 | // Add the multipart/alternative part to the message. 446 | msg.addBodyPart(wrap); 447 | 448 | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); 449 | message.writeTo(outputStream); 450 | rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray())); 451 | 452 | } catch (IOException | MessagingException e) { 453 | LOGGER.error(e.getMessage()); 454 | } 455 | 456 | return rawMessage; 457 | } 458 | 459 | private String getSHAHash(String data) { 460 | String hashResult = ""; 461 | try { 462 | MessageDigest digest = MessageDigest.getInstance("SHA-256"); 463 | byte[] encodedhash = digest.digest(data.getBytes(StandardCharsets.UTF_8)); 464 | hashResult = bytesToHex(encodedhash); 465 | } catch (NoSuchAlgorithmException e) { 466 | LOGGER.error(e.getMessage()); 467 | } 468 | return hashResult; 469 | } 470 | 471 | private static String bytesToHex(byte[] hash) { 472 | StringBuffer hexString = new StringBuffer(); 473 | for (int i = 0; i < hash.length; i++) { 474 | String hex = Integer.toHexString(0xff & hash[i]); 475 | if (hex.length() == 1) hexString.append('0'); 476 | hexString.append(hex); 477 | } 478 | return hexString.toString(); 479 | } 480 | 481 | private String readFileContents(String fileName) { 482 | BufferedReader br = null; 483 | FileReader fr = null; 484 | StringBuilder sb = new StringBuilder(); 485 | 486 | try { 487 | fr = new FileReader(fileName); 488 | br = new BufferedReader(fr); 489 | 490 | String line; 491 | 492 | while ((line = br.readLine()) != null) { 493 | sb.append(line); 494 | } 495 | 496 | } catch (IOException e) { 497 | LOGGER.error(e.getMessage()); 498 | } 499 | 500 | return sb.toString(); 501 | } 502 | 503 | private void writeFileContents(String fileName, String data) { 504 | try { 505 | Writer fileWriter = new FileWriter(fileName, false); 506 | fileWriter.write(data); 507 | fileWriter.close(); 508 | } catch (IOException e) { 509 | LOGGER.error(e.getMessage()); 510 | } 511 | } 512 | 513 | } -------------------------------------------------------------------------------- /THIRD-PARTY: -------------------------------------------------------------------------------- 1 | License for: 2 | ============ 3 | ** AWS JDK; version 1.11.492 -- https://github.com/aws/aws-sdk-java 4 | ** Apache Log4j2; version 2.11.1 -- https://logging.apache.org/log4j/2.x 5 | ** Apache Commons IO; version 2.6 -- http://commons.apache.org/proper/commons-io 6 | ** snakeyaml; version 1.23 -- https://bitbucket.org/asomov/snakeyaml 7 | ** Maven; version 3.x.x -- https://maven.apache.org 8 | ** Maven Shade Plugin; version 2.4.3 -- https://maven.apache.org/plugins/maven-shade-plugin 9 | ** Maven Shaded Log4j Transformer; version 2.8.1 -- https://github.com/edwgiz/maven-shaded-log4j-transformer 10 | ** Docker; version 18.06.1-ce -- https://github.com/docker/docker-ce 11 | ** SAM; version 2016-10-31 -- https://github.com/awslabs/serverless-application-model 12 | 13 | Apache License 14 | Version 2.0, January 2004 15 | 16 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 17 | 18 | 1. Definitions. 19 | 20 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 21 | 22 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 23 | 24 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 25 | 26 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 27 | 28 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 31 | 32 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 33 | 34 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 35 | 36 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 37 | 38 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 39 | 40 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 41 | 42 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 43 | 44 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 45 | 46 | 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and 47 | 2. You must cause any modified files to carry prominent notices stating that You changed the files; and 48 | 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 49 | 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 50 | 51 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 52 | 53 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 54 | 55 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 56 | 57 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 58 | 59 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 60 | 61 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 62 | 63 | END OF TERMS AND CONDITIONS 64 | 65 | Note: Other license terms may apply to certain, identified software files contained within or distributed with the accompanying software if such terms are included in the directory containing the accompanying software. Such other license terms will then apply in lieu of the terms of the software license above. 66 | 67 | License for: 68 | ============ 69 | ** JavaMail; version 1.6.2 -- https://javaee.github.io/javamail 70 | 71 | COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 72 | 73 | 1. Definitions. 74 | 75 | 1.1. "Contributor" means each individual or entity that creates or 76 | contributes to the creation of Modifications. 77 | 78 | 1.2. "Contributor Version" means the combination of the Original 79 | Software, prior Modifications used by a Contributor (if any), and 80 | the Modifications made by that particular Contributor. 81 | 82 | 1.3. "Covered Software" means (a) the Original Software, or (b) 83 | Modifications, or (c) the combination of files containing Original 84 | Software with files containing Modifications, in each case including 85 | portions thereof. 86 | 87 | 1.4. "Executable" means the Covered Software in any form other than 88 | Source Code. 89 | 90 | 1.5. "Initial Developer" means the individual or entity that first 91 | makes Original Software available under this License. 92 | 93 | 1.6. "Larger Work" means a work which combines Covered Software or 94 | portions thereof with code not governed by the terms of this License. 95 | 96 | 1.7. "License" means this document. 97 | 98 | 1.8. "Licensable" means having the right to grant, to the maximum 99 | extent possible, whether at the time of the initial grant or 100 | subsequently acquired, any and all of the rights conveyed herein. 101 | 102 | 1.9. "Modifications" means the Source Code and Executable form of 103 | any of the following: 104 | 105 | A. Any file that results from an addition to, deletion from or 106 | modification of the contents of a file containing Original Software 107 | or previous Modifications; 108 | 109 | B. Any new file that contains any part of the Original Software or 110 | previous Modification; or 111 | 112 | C. Any new file that is contributed or otherwise made available 113 | under the terms of this License. 114 | 115 | 1.10. "Original Software" means the Source Code and Executable form 116 | of computer software code that is originally released under this 117 | License. 118 | 119 | 1.11. "Patent Claims" means any patent claim(s), now owned or 120 | hereafter acquired, including without limitation, method, process, 121 | and apparatus claims, in any patent Licensable by grantor. 122 | 123 | 1.12. "Source Code" means (a) the common form of computer software 124 | code in which modifications are made and (b) associated 125 | documentation included in or with such code. 126 | 127 | 1.13. "You" (or "Your") means an individual or a legal entity 128 | exercising rights under, and complying with all of the terms of, 129 | this License. For legal entities, "You" includes any entity which 130 | controls, is controlled by, or is under common control with You. For 131 | purposes of this definition, "control" means (a) the power, direct 132 | or indirect, to cause the direction or management of such entity, 133 | whether by contract or otherwise, or (b) ownership of more than 134 | fifty percent (50%) of the outstanding shares or beneficial 135 | ownership of such entity. 136 | 137 | 2. License Grants. 138 | 139 | 2.1. The Initial Developer Grant. 140 | 141 | Conditioned upon Your compliance with Section 3.1 below and subject 142 | to third party intellectual property claims, the Initial Developer 143 | hereby grants You a world-wide, royalty-free, non-exclusive license: 144 | 145 | (a) under intellectual property rights (other than patent or 146 | trademark) Licensable by Initial Developer, to use, reproduce, 147 | modify, display, perform, sublicense and distribute the Original 148 | Software (or portions thereof), with or without Modifications, 149 | and/or as part of a Larger Work; and 150 | 151 | (b) under Patent Claims infringed by the making, using or selling of 152 | Original Software, to make, have made, use, practice, sell, and 153 | offer for sale, and/or otherwise dispose of the Original Software 154 | (or portions thereof). 155 | 156 | (c) The licenses granted in Sections 2.1(a) and (b) are effective on 157 | the date Initial Developer first distributes or otherwise makes the 158 | Original Software available to a third party under the terms of this 159 | License. 160 | 161 | (d) Notwithstanding Section 2.1(b) above, no patent license is 162 | granted: (1) for code that You delete from the Original Software, or 163 | (2) for infringements caused by: (i) the modification of the 164 | Original Software, or (ii) the combination of the Original Software 165 | with other software or devices. 166 | 167 | 2.2. Contributor Grant. 168 | 169 | Conditioned upon Your compliance with Section 3.1 below and subject 170 | to third party intellectual property claims, each Contributor hereby 171 | grants You a world-wide, royalty-free, non-exclusive license: 172 | 173 | (a) under intellectual property rights (other than patent or 174 | trademark) Licensable by Contributor to use, reproduce, modify, 175 | display, perform, sublicense and distribute the Modifications 176 | created by such Contributor (or portions thereof), either on an 177 | unmodified basis, with other Modifications, as Covered Software 178 | and/or as part of a Larger Work; and 179 | 180 | (b) under Patent Claims infringed by the making, using, or selling 181 | of Modifications made by that Contributor either alone and/or in 182 | combination with its Contributor Version (or portions of such 183 | combination), to make, use, sell, offer for sale, have made, and/or 184 | otherwise dispose of: (1) Modifications made by that Contributor (or 185 | portions thereof); and (2) the combination of Modifications made by 186 | that Contributor with its Contributor Version (or portions of such 187 | combination). 188 | 189 | (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective 190 | on the date Contributor first distributes or otherwise makes the 191 | Modifications available to a third party. 192 | 193 | (d) Notwithstanding Section 2.2(b) above, no patent license is 194 | granted: (1) for any code that Contributor has deleted from the 195 | Contributor Version; (2) for infringements caused by: (i) third 196 | party modifications of Contributor Version, or (ii) the combination 197 | of Modifications made by that Contributor with other software 198 | (except as part of the Contributor Version) or other devices; or (3) 199 | under Patent Claims infringed by Covered Software in the absence of 200 | Modifications made by that Contributor. 201 | 202 | 3. Distribution Obligations. 203 | 204 | 3.1. Availability of Source Code. 205 | 206 | Any Covered Software that You distribute or otherwise make available 207 | in Executable form must also be made available in Source Code form 208 | and that Source Code form must be distributed only under the terms 209 | of this License. You must include a copy of this License with every 210 | copy of the Source Code form of the Covered Software You distribute 211 | or otherwise make available. You must inform recipients of any such 212 | Covered Software in Executable form as to how they can obtain such 213 | Covered Software in Source Code form in a reasonable manner on or 214 | through a medium customarily used for software exchange. 215 | 216 | 3.2. Modifications. 217 | 218 | The Modifications that You create or to which You contribute are 219 | governed by the terms of this License. You represent that You 220 | believe Your Modifications are Your original creation(s) and/or You 221 | have sufficient rights to grant the rights conveyed by this License. 222 | 223 | 3.3. Required Notices. 224 | 225 | You must include a notice in each of Your Modifications that 226 | identifies You as the Contributor of the Modification. You may not 227 | remove or alter any copyright, patent or trademark notices contained 228 | within the Covered Software, or any notices of licensing or any 229 | descriptive text giving attribution to any Contributor or the 230 | Initial Developer. 231 | 232 | 3.4. Application of Additional Terms. 233 | 234 | You may not offer or impose any terms on any Covered Software in 235 | Source Code form that alters or restricts the applicable version of 236 | this License or the recipients' rights hereunder. You may choose to 237 | offer, and to charge a fee for, warranty, support, indemnity or 238 | liability obligations to one or more recipients of Covered Software. 239 | However, you may do so only on Your own behalf, and not on behalf of 240 | the Initial Developer or any Contributor. You must make it 241 | absolutely clear that any such warranty, support, indemnity or 242 | liability obligation is offered by You alone, and You hereby agree 243 | to indemnify the Initial Developer and every Contributor for any 244 | liability incurred by the Initial Developer or such Contributor as a 245 | result of warranty, support, indemnity or liability terms You offer. 246 | 247 | 3.5. Distribution of Executable Versions. 248 | 249 | You may distribute the Executable form of the Covered Software under 250 | the terms of this License or under the terms of a license of Your 251 | choice, which may contain terms different from this License, 252 | provided that You are in compliance with the terms of this License 253 | and that the license for the Executable form does not attempt to 254 | limit or alter the recipient's rights in the Source Code form from 255 | the rights set forth in this License. If You distribute the Covered 256 | Software in Executable form under a different license, You must make 257 | it absolutely clear that any terms which differ from this License 258 | are offered by You alone, not by the Initial Developer or 259 | Contributor. You hereby agree to indemnify the Initial Developer and 260 | every Contributor for any liability incurred by the Initial 261 | Developer or such Contributor as a result of any such terms You offer. 262 | 263 | 3.6. Larger Works. 264 | 265 | You may create a Larger Work by combining Covered Software with 266 | other code not governed by the terms of this License and distribute 267 | the Larger Work as a single product. In such a case, You must make 268 | sure the requirements of this License are fulfilled for the Covered 269 | Software. 270 | 271 | 4. Versions of the License. 272 | 273 | 4.1. New Versions. 274 | 275 | Oracle is the initial license steward and may publish revised and/or 276 | new versions of this License from time to time. Each version will be 277 | given a distinguishing version number. Except as provided in Section 278 | 4.3, no one other than the license steward has the right to modify 279 | this License. 280 | 281 | 4.2. Effect of New Versions. 282 | 283 | You may always continue to use, distribute or otherwise make the 284 | Covered Software available under the terms of the version of the 285 | License under which You originally received the Covered Software. If 286 | the Initial Developer includes a notice in the Original Software 287 | prohibiting it from being distributed or otherwise made available 288 | under any subsequent version of the License, You must distribute and 289 | make the Covered Software available under the terms of the version 290 | of the License under which You originally received the Covered 291 | Software. Otherwise, You may also choose to use, distribute or 292 | otherwise make the Covered Software available under the terms of any 293 | subsequent version of the License published by the license steward. 294 | 295 | 4.3. Modified Versions. 296 | 297 | When You are an Initial Developer and You want to create a new 298 | license for Your Original Software, You may create and use a 299 | modified version of this License if You: (a) rename the license and 300 | remove any references to the name of the license steward (except to 301 | note that the license differs from this License); and (b) otherwise 302 | make it clear that the license contains terms which differ from this 303 | License. 304 | 305 | 5. DISCLAIMER OF WARRANTY. 306 | 307 | COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, 308 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 309 | INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE 310 | IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR 311 | NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF 312 | THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE 313 | DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY 314 | OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, 315 | REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN 316 | ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS 317 | AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 318 | 319 | 6. TERMINATION. 320 | 321 | 6.1. This License and the rights granted hereunder will terminate 322 | automatically if You fail to comply with terms herein and fail to 323 | cure such breach within 30 days of becoming aware of the breach. 324 | Provisions which, by their nature, must remain in effect beyond the 325 | termination of this License shall survive. 326 | 327 | 6.2. If You assert a patent infringement claim (excluding 328 | declaratory judgment actions) against Initial Developer or a 329 | Contributor (the Initial Developer or Contributor against whom You 330 | assert such claim is referred to as "Participant") alleging that the 331 | Participant Software (meaning the Contributor Version where the 332 | Participant is a Contributor or the Original Software where the 333 | Participant is the Initial Developer) directly or indirectly 334 | infringes any patent, then any and all rights granted directly or 335 | indirectly to You by such Participant, the Initial Developer (if the 336 | Initial Developer is not the Participant) and all Contributors under 337 | Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice 338 | from Participant terminate prospectively and automatically at the 339 | expiration of such 60 day notice period, unless if within such 60 340 | day period You withdraw Your claim with respect to the Participant 341 | Software against such Participant either unilaterally or pursuant to 342 | a written agreement with Participant. 343 | 344 | 6.3. If You assert a patent infringement claim against Participant 345 | alleging that the Participant Software directly or indirectly 346 | infringes any patent where such claim is resolved (such as by 347 | license or settlement) prior to the initiation of patent 348 | infringement litigation, then the reasonable value of the licenses 349 | granted by such Participant under Sections 2.1 or 2.2 shall be taken 350 | into account in determining the amount or value of any payment or 351 | license. 352 | 353 | 6.4. In the event of termination under Sections 6.1 or 6.2 above, 354 | all end user licenses that have been validly granted by You or any 355 | distributor hereunder prior to termination (excluding licenses 356 | granted to You by any distributor) shall survive termination. 357 | 358 | 7. LIMITATION OF LIABILITY. 359 | 360 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT 361 | (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE 362 | INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF 363 | COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE 364 | TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR 365 | CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT 366 | LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER 367 | FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR 368 | LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE 369 | POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT 370 | APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH 371 | PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH 372 | LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR 373 | LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION 374 | AND LIMITATION MAY NOT APPLY TO YOU. 375 | 376 | 8. U.S. GOVERNMENT END USERS. 377 | 378 | The Covered Software is a "commercial item," as that term is defined 379 | in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer 380 | software" (as that term is defined at 48 C.F.R. § 381 | 252.227-7014(a)(1)) and "commercial computer software documentation" 382 | as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent 383 | with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 384 | (June 1995), all U.S. Government End Users acquire Covered Software 385 | with only those rights set forth herein. This U.S. Government Rights 386 | clause is in lieu of, and supersedes, any other FAR, DFAR, or other 387 | clause or provision that addresses Government rights in computer 388 | software under this License. 389 | 390 | 9. MISCELLANEOUS. 391 | 392 | This License represents the complete agreement concerning subject 393 | matter hereof. If any provision of this License is held to be 394 | unenforceable, such provision shall be reformed only to the extent 395 | necessary to make it enforceable. This License shall be governed by 396 | the law of the jurisdiction specified in a notice contained within 397 | the Original Software (except to the extent applicable law, if any, 398 | provides otherwise), excluding such jurisdiction's conflict-of-law 399 | provisions. Any litigation relating to this License shall be subject 400 | to the jurisdiction of the courts located in the jurisdiction and 401 | venue specified in a notice contained within the Original Software, 402 | with the losing party responsible for costs, including, without 403 | limitation, court costs and reasonable attorneys' fees and expenses. 404 | The application of the United Nations Convention on Contracts for 405 | the International Sale of Goods is expressly excluded. Any law or 406 | regulation which provides that the language of a contract shall be 407 | construed against the drafter shall not apply to this License. You 408 | agree that You alone are responsible for compliance with the United 409 | States export administration regulations (and the export control 410 | laws and regulation of any other countries) when You use, distribute 411 | or otherwise make available any Covered Software. 412 | 413 | 10. RESPONSIBILITY FOR CLAIMS. 414 | 415 | As between Initial Developer and the Contributors, each party is 416 | responsible for claims and damages arising, directly or indirectly, 417 | out of its utilization of rights under this License and You agree to 418 | work with Initial Developer and Contributors to distribute such 419 | responsibility on an equitable basis. Nothing herein is intended or 420 | shall be deemed to constitute any admission of liability. 421 | NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) 422 | The code released under the CDDL shall be governed by the laws of the 423 | State of California (excluding conflict-of-law provisions). Any 424 | litigation relating to this License shall be subject to the jurisdiction 425 | of the Federal Courts of the Northern District of California and the 426 | state courts of the State of California, with venue lying in Santa Clara 427 | County, California. 428 | The GNU General Public License (GPL) Version 2, June 1991 429 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 430 | 51 Franklin Street, Fifth Floor 431 | Boston, MA 02110-1335 432 | USA 433 | 434 | Everyone is permitted to copy and distribute verbatim copies 435 | of this license document, but changing it is not allowed. 436 | 437 | Preamble 438 | 439 | The licenses for most software are designed to take away your freedom to 440 | share and change it. By contrast, the GNU General Public License is 441 | intended to guarantee your freedom to share and change free software--to 442 | make sure the software is free for all its users. This General Public 443 | License applies to most of the Free Software Foundation's software and 444 | to any other program whose authors commit to using it. (Some other Free 445 | Software Foundation software is covered by the GNU Library General 446 | Public License instead.) You can apply it to your programs, too. 447 | 448 | When we speak of free software, we are referring to freedom, not price. 449 | Our General Public Licenses are designed to make sure that you have the 450 | freedom to distribute copies of free software (and charge for this 451 | service if you wish), that you receive source code or can get it if you 452 | want it, that you can change the software or use pieces of it in new 453 | free programs; and that you know you can do these things. 454 | 455 | To protect your rights, we need to make restrictions that forbid anyone 456 | to deny you these rights or to ask you to surrender the rights. These 457 | restrictions translate to certain responsibilities for you if you 458 | distribute copies of the software, or if you modify it. 459 | 460 | For example, if you distribute copies of such a program, whether gratis 461 | or for a fee, you must give the recipients all the rights that you have. 462 | You must make sure that they, too, receive or can get the source code. 463 | And you must show them these terms so they know their rights. 464 | 465 | We protect your rights with two steps: (1) copyright the software, and 466 | (2) offer you this license which gives you legal permission to copy, 467 | distribute and/or modify the software. 468 | 469 | Also, for each author's protection and ours, we want to make certain 470 | that everyone understands that there is no warranty for this free 471 | software. If the software is modified by someone else and passed on, we 472 | want its recipients to know that what they have is not the original, so 473 | that any problems introduced by others will not reflect on the original 474 | authors' reputations. 475 | 476 | Finally, any free program is threatened constantly by software patents. 477 | We wish to avoid the danger that redistributors of a free program will 478 | individually obtain patent licenses, in effect making the program 479 | proprietary. To prevent this, we have made it clear that any patent must 480 | be licensed for everyone's free use or not licensed at all. 481 | 482 | The precise terms and conditions for copying, distribution and 483 | modification follow. 484 | 485 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 486 | 487 | 0. This License applies to any program or other work which contains a 488 | notice placed by the copyright holder saying it may be distributed under 489 | the terms of this General Public License. The "Program", below, refers 490 | to any such program or work, and a "work based on the Program" means 491 | either the Program or any derivative work under copyright law: that is 492 | to say, a work containing the Program or a portion of it, either 493 | verbatim or with modifications and/or translated into another language. 494 | (Hereinafter, translation is included without limitation in the term 495 | "modification".) Each licensee is addressed as "you". 496 | 497 | Activities other than copying, distribution and modification are not 498 | covered by this License; they are outside its scope. The act of running 499 | the Program is not restricted, and the output from the Program is 500 | covered only if its contents constitute a work based on the Program 501 | (independent of having been made by running the Program). Whether that 502 | is true depends on what the Program does. 503 | 504 | 1. You may copy and distribute verbatim copies of the Program's source 505 | code as you receive it, in any medium, provided that you conspicuously 506 | and appropriately publish on each copy an appropriate copyright notice 507 | and disclaimer of warranty; keep intact all the notices that refer to 508 | this License and to the absence of any warranty; and give any other 509 | recipients of the Program a copy of this License along with the Program. 510 | 511 | You may charge a fee for the physical act of transferring a copy, and 512 | you may at your option offer warranty protection in exchange for a fee. 513 | 514 | 2. You may modify your copy or copies of the Program or any portion of 515 | it, thus forming a work based on the Program, and copy and distribute 516 | such modifications or work under the terms of Section 1 above, provided 517 | that you also meet all of these conditions: 518 | 519 | a) You must cause the modified files to carry prominent notices 520 | stating that you changed the files and the date of any change. 521 | 522 | b) You must cause any work that you distribute or publish, that in 523 | whole or in part contains or is derived from the Program or any part 524 | thereof, to be licensed as a whole at no charge to all third parties 525 | under the terms of this License. 526 | 527 | c) If the modified program normally reads commands interactively 528 | when run, you must cause it, when started running for such 529 | interactive use in the most ordinary way, to print or display an 530 | announcement including an appropriate copyright notice and a notice 531 | that there is no warranty (or else, saying that you provide a 532 | warranty) and that users may redistribute the program under these 533 | conditions, and telling the user how to view a copy of this License. 534 | (Exception: if the Program itself is interactive but does not 535 | normally print such an announcement, your work based on the Program 536 | is not required to print an announcement.) 537 | 538 | These requirements apply to the modified work as a whole. If 539 | identifiable sections of that work are not derived from the Program, and 540 | can be reasonably considered independent and separate works in 541 | themselves, then this License, and its terms, do not apply to those 542 | sections when you distribute them as separate works. But when you 543 | distribute the same sections as part of a whole which is a work based on 544 | the Program, the distribution of the whole must be on the terms of this 545 | License, whose permissions for other licensees extend to the entire 546 | whole, and thus to each and every part regardless of who wrote it. 547 | 548 | Thus, it is not the intent of this section to claim rights or contest 549 | your rights to work written entirely by you; rather, the intent is to 550 | exercise the right to control the distribution of derivative or 551 | collective works based on the Program. 552 | 553 | In addition, mere aggregation of another work not based on the Program 554 | with the Program (or with a work based on the Program) on a volume of a 555 | storage or distribution medium does not bring the other work under the 556 | scope of this License. 557 | 558 | 3. You may copy and distribute the Program (or a work based on it, 559 | under Section 2) in object code or executable form under the terms of 560 | Sections 1 and 2 above provided that you also do one of the following: 561 | 562 | a) Accompany it with the complete corresponding machine-readable 563 | source code, which must be distributed under the terms of Sections 1 564 | and 2 above on a medium customarily used for software interchange; or, 565 | 566 | b) Accompany it with a written offer, valid for at least three 567 | years, to give any third party, for a charge no more than your cost 568 | of physically performing source distribution, a complete 569 | machine-readable copy of the corresponding source code, to be 570 | distributed under the terms of Sections 1 and 2 above on a medium 571 | customarily used for software interchange; or, 572 | 573 | c) Accompany it with the information you received as to the offer to 574 | distribute corresponding source code. (This alternative is allowed 575 | only for noncommercial distribution and only if you received the 576 | program in object code or executable form with such an offer, in 577 | accord with Subsection b above.) 578 | 579 | The source code for a work means the preferred form of the work for 580 | making modifications to it. For an executable work, complete source code 581 | means all the source code for all modules it contains, plus any 582 | associated interface definition files, plus the scripts used to control 583 | compilation and installation of the executable. However, as a special 584 | exception, the source code distributed need not include anything that is 585 | normally distributed (in either source or binary form) with the major 586 | components (compiler, kernel, and so on) of the operating system on 587 | which the executable runs, unless that component itself accompanies the 588 | executable. 589 | 590 | If distribution of executable or object code is made by offering access 591 | to copy from a designated place, then offering equivalent access to copy 592 | the source code from the same place counts as distribution of the source 593 | code, even though third parties are not compelled to copy the source 594 | along with the object code. 595 | 596 | 4. You may not copy, modify, sublicense, or distribute the Program 597 | except as expressly provided under this License. Any attempt otherwise 598 | to copy, modify, sublicense or distribute the Program is void, and will 599 | automatically terminate your rights under this License. However, parties 600 | who have received copies, or rights, from you under this License will 601 | not have their licenses terminated so long as such parties remain in 602 | full compliance. 603 | 604 | 5. You are not required to accept this License, since you have not 605 | signed it. However, nothing else grants you permission to modify or 606 | distribute the Program or its derivative works. These actions are 607 | prohibited by law if you do not accept this License. Therefore, by 608 | modifying or distributing the Program (or any work based on the 609 | Program), you indicate your acceptance of this License to do so, and all 610 | its terms and conditions for copying, distributing or modifying the 611 | Program or works based on it. 612 | 613 | 6. Each time you redistribute the Program (or any work based on the 614 | Program), the recipient automatically receives a license from the 615 | original licensor to copy, distribute or modify the Program subject to 616 | these terms and conditions. You may not impose any further restrictions 617 | on the recipients' exercise of the rights granted herein. You are not 618 | responsible for enforcing compliance by third parties to this License. 619 | 620 | 7. If, as a consequence of a court judgment or allegation of patent 621 | infringement or for any other reason (not limited to patent issues), 622 | conditions are imposed on you (whether by court order, agreement or 623 | otherwise) that contradict the conditions of this License, they do not 624 | excuse you from the conditions of this License. If you cannot distribute 625 | so as to satisfy simultaneously your obligations under this License and 626 | any other pertinent obligations, then as a consequence you may not 627 | distribute the Program at all. For example, if a patent license would 628 | not permit royalty-free redistribution of the Program by all those who 629 | receive copies directly or indirectly through you, then the only way you 630 | could satisfy both it and this License would be to refrain entirely from 631 | distribution of the Program. 632 | 633 | If any portion of this section is held invalid or unenforceable under 634 | any particular circumstance, the balance of the section is intended to 635 | apply and the section as a whole is intended to apply in other 636 | circumstances. 637 | 638 | It is not the purpose of this section to induce you to infringe any 639 | patents or other property right claims or to contest validity of any 640 | such claims; this section has the sole purpose of protecting the 641 | integrity of the free software distribution system, which is implemented 642 | by public license practices. Many people have made generous 643 | contributions to the wide range of software distributed through that 644 | system in reliance on consistent application of that system; it is up to 645 | the author/donor to decide if he or she is willing to distribute 646 | software through any other system and a licensee cannot impose that choice. 647 | 648 | This section is intended to make thoroughly clear what is believed to be 649 | a consequence of the rest of this License. 650 | 651 | 8. If the distribution and/or use of the Program is restricted in 652 | certain countries either by patents or by copyrighted interfaces, the 653 | original copyright holder who places the Program under this License may 654 | add an explicit geographical distribution limitation excluding those 655 | countries, so that distribution is permitted only in or among countries 656 | not thus excluded. In such case, this License incorporates the 657 | limitation as if written in the body of this License. 658 | 659 | 9. The Free Software Foundation may publish revised and/or new 660 | versions of the General Public License from time to time. Such new 661 | versions will be similar in spirit to the present version, but may 662 | differ in detail to address new problems or concerns. 663 | 664 | Each version is given a distinguishing version number. If the Program 665 | specifies a version number of this License which applies to it and "any 666 | later version", you have the option of following the terms and 667 | conditions either of that version or of any later version published by 668 | the Free Software Foundation. If the Program does not specify a version 669 | number of this License, you may choose any version ever published by the 670 | Free Software Foundation. 671 | 672 | 10. If you wish to incorporate parts of the Program into other free 673 | programs whose distribution conditions are different, write to the 674 | author to ask for permission. For software which is copyrighted by the 675 | Free Software Foundation, write to the Free Software Foundation; we 676 | sometimes make exceptions for this. Our decision will be guided by the 677 | two goals of preserving the free status of all derivatives of our free 678 | software and of promoting the sharing and reuse of software generally. 679 | 680 | NO WARRANTY 681 | 682 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO 683 | WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 684 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 685 | OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, 686 | EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 687 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE 688 | ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH 689 | YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL 690 | NECESSARY SERVICING, REPAIR OR CORRECTION. 691 | 692 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 693 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 694 | AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR 695 | DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL 696 | DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM 697 | (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED 698 | INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF 699 | THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR 700 | OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 701 | 702 | END OF TERMS AND CONDITIONS 703 | 704 | How to Apply These Terms to Your New Programs 705 | 706 | If you develop a new program, and you want it to be of the greatest 707 | possible use to the public, the best way to achieve this is to make it 708 | free software which everyone can redistribute and change under these terms. 709 | 710 | To do so, attach the following notices to the program. It is safest to 711 | attach them to the start of each source file to most effectively convey 712 | the exclusion of warranty; and each file should have at least the 713 | "copyright" line and a pointer to where the full notice is found. 714 | 715 | One line to give the program's name and a brief idea of what it does. 716 | Copyright (C) 717 | 718 | This program is free software; you can redistribute it and/or modify 719 | it under the terms of the GNU General Public License as published by 720 | the Free Software Foundation; either version 2 of the License, or 721 | (at your option) any later version. 722 | 723 | This program is distributed in the hope that it will be useful, but 724 | WITHOUT ANY WARRANTY; without even the implied warranty of 725 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 726 | General Public License for more details. 727 | 728 | You should have received a copy of the GNU General Public License 729 | along with this program; if not, write to the Free Software 730 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 731 | 732 | Also add information on how to contact you by electronic and paper mail. 733 | 734 | If the program is interactive, make it output a short notice like this 735 | when it starts in an interactive mode: 736 | 737 | Gnomovision version 69, Copyright (C) year name of author 738 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 739 | `show w'. This is free software, and you are welcome to redistribute 740 | it under certain conditions; type `show c' for details. 741 | 742 | The hypothetical commands `show w' and `show c' should show the 743 | appropriate parts of the General Public License. Of course, the commands 744 | you use may be called something other than `show w' and `show c'; they 745 | could even be mouse-clicks or menu items--whatever suits your program. 746 | 747 | You should also get your employer (if you work as a programmer) or your 748 | school, if any, to sign a "copyright disclaimer" for the program, if 749 | necessary. Here is a sample; alter the names: 750 | 751 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 752 | program `Gnomovision' (which makes passes at compilers) written by 753 | James Hacker. 754 | 755 | signature of Ty Coon, 1 April 1989 756 | Ty Coon, President of Vice 757 | 758 | This General Public License does not permit incorporating your program 759 | into proprietary programs. If your program is a subroutine library, you 760 | may consider it more useful to permit linking proprietary applications 761 | with the library. If this is what you want to do, use the GNU Library 762 | General Public License instead of this License. 763 | Certain source files distributed by Oracle America, Inc. and/or its 764 | affiliates are subject to the following clarification and special 765 | exception to the GPLv2, based on the GNU Project exception for its 766 | Classpath libraries, known as the GNU Classpath Exception, but only 767 | where Oracle has expressly included in the particular source file's 768 | header the words "Oracle designates this particular file as subject to 769 | the "Classpath" exception as provided by Oracle in the LICENSE file 770 | that accompanied this code." 771 | 772 | You should also note that Oracle includes multiple, independent 773 | programs in this software package. Some of those programs are provided 774 | under licenses deemed incompatible with the GPLv2 by the Free Software 775 | Foundation and others. For example, the package includes programs 776 | licensed under the Apache License, Version 2.0. Such programs are 777 | licensed to you under their original licenses. 778 | 779 | Oracle facilitates your further distribution of this package by adding 780 | the Classpath Exception to the necessary parts of its GPLv2 code, which 781 | permits you to use that code in combination with other independent 782 | modules not licensed under the GPLv2. However, note that this would 783 | not permit you to commingle code under an incompatible license with 784 | Oracle's GPLv2 licensed code by, for example, cutting and pasting such 785 | code into a file also containing Oracle's GPLv2 licensed code and then 786 | distributing the result. Additionally, if you were to remove the 787 | Classpath Exception from any of the files to which it applies and 788 | distribute the result, you would likely be required to license some or 789 | all of the other code in that distribution under the GPLv2 as well, and 790 | since the GPLv2 is incompatible with the license terms of some items 791 | included in the distribution by Oracle, removing the Classpath 792 | Exception could therefore effectively compromise your ability to 793 | further distribute the package. 794 | 795 | Proceed with caution and we recommend that you obtain the advice of a 796 | lawyer skilled in open source matters before removing the Classpath 797 | Exception or making modifications to this package which may 798 | subsequently be redistributed and/or involve the use of third party 799 | software. 800 | 801 | CLASSPATH EXCEPTION 802 | Linking this library statically or dynamically with other modules is 803 | making a combined work based on this library. Thus, the terms and 804 | conditions of the GNU General Public License version 2 cover the whole 805 | combination. 806 | 807 | As a special exception, the copyright holders of this library give you 808 | permission to link this library with independent modules to produce an 809 | executable, regardless of the license terms of these independent 810 | modules, and to copy and distribute the resulting executable under 811 | terms of your choice, provided that you also meet, for each linked 812 | independent module, the terms and conditions of the license of that 813 | module. An independent module is a module which is not derived from or 814 | based on this library. If you modify this library, you may extend this 815 | exception to your version of the library, but you are not obligated to 816 | do so. If you do not wish to do so, delete this exception statement 817 | from your version. 818 | 819 | License for: 820 | ============ 821 | ** Amazon Corretto; version 8.202.08.2 -- https://github.com/corretto/corretto-8 822 | 823 | GNU General Public License, version 2, 824 | with the Classpath Exception 825 | 826 | The GNU General Public License (GPL) 827 | 828 | Version 2, June 1991 829 | 830 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 831 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 832 | 833 | Everyone is permitted to copy and distribute verbatim copies of this license 834 | document, but changing it is not allowed. 835 | 836 | Preamble 837 | 838 | The licenses for most software are designed to take away your freedom to share 839 | and change it. By contrast, the GNU General Public License is intended to 840 | guarantee your freedom to share and change free software--to make sure the 841 | software is free for all its users. This General Public License applies to 842 | most of the Free Software Foundation's software and to any other program whose 843 | authors commit to using it. (Some other Free Software Foundation software is 844 | covered by the GNU Library General Public License instead.) You can apply it to 845 | your programs, too. 846 | 847 | When we speak of free software, we are referring to freedom, not price. Our 848 | General Public Licenses are designed to make sure that you have the freedom to 849 | distribute copies of free software (and charge for this service if you wish), 850 | that you receive source code or can get it if you want it, that you can change 851 | the software or use pieces of it in new free programs; and that you know you 852 | can do these things. 853 | 854 | To protect your rights, we need to make restrictions that forbid anyone to deny 855 | you these rights or to ask you to surrender the rights. These restrictions 856 | translate to certain responsibilities for you if you distribute copies of the 857 | software, or if you modify it. 858 | 859 | For example, if you distribute copies of such a program, whether gratis or for 860 | a fee, you must give the recipients all the rights that you have. You must 861 | make sure that they, too, receive or can get the source code. And you must 862 | show them these terms so they know their rights. 863 | 864 | We protect your rights with two steps: (1) copyright the software, and (2) 865 | offer you this license which gives you legal permission to copy, distribute 866 | and/or modify the software. 867 | 868 | Also, for each author's protection and ours, we want to make certain that 869 | everyone understands that there is no warranty for this free software. If the 870 | software is modified by someone else and passed on, we want its recipients to 871 | know that what they have is not the original, so that any problems introduced 872 | by others will not reflect on the original authors' reputations. 873 | 874 | Finally, any free program is threatened constantly by software patents. We 875 | wish to avoid the danger that redistributors of a free program will 876 | individually obtain patent licenses, in effect making the program proprietary. 877 | To prevent this, we have made it clear that any patent must be licensed for 878 | everyone's free use or not licensed at all. 879 | 880 | The precise terms and conditions for copying, distribution and modification 881 | follow. 882 | 883 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 884 | 885 | 0. This License applies to any program or other work which contains a notice 886 | placed by the copyright holder saying it may be distributed under the terms of 887 | this General Public License. The "Program", below, refers to any such program 888 | or work, and a "work based on the Program" means either the Program or any 889 | derivative work under copyright law: that is to say, a work containing the 890 | Program or a portion of it, either verbatim or with modifications and/or 891 | translated into another language. (Hereinafter, translation is included 892 | without limitation in the term "modification".) Each licensee is addressed as 893 | "you". 894 | 895 | Activities other than copying, distribution and modification are not covered by 896 | this License; they are outside its scope. The act of running the Program is 897 | not restricted, and the output from the Program is covered only if its contents 898 | constitute a work based on the Program (independent of having been made by 899 | running the Program). Whether that is true depends on what the Program does. 900 | 901 | 1. You may copy and distribute verbatim copies of the Program's source code as 902 | you receive it, in any medium, provided that you conspicuously and 903 | appropriately publish on each copy an appropriate copyright notice and 904 | disclaimer of warranty; keep intact all the notices that refer to this License 905 | and to the absence of any warranty; and give any other recipients of the 906 | Program a copy of this License along with the Program. 907 | 908 | You may charge a fee for the physical act of transferring a copy, and you may 909 | at your option offer warranty protection in exchange for a fee. 910 | 911 | 2. You may modify your copy or copies of the Program or any portion of it, thus 912 | forming a work based on the Program, and copy and distribute such modifications 913 | or work under the terms of Section 1 above, provided that you also meet all of 914 | these conditions: 915 | 916 | a) You must cause the modified files to carry prominent notices stating 917 | that you changed the files and the date of any change. 918 | 919 | b) You must cause any work that you distribute or publish, that in whole or 920 | in part contains or is derived from the Program or any part thereof, to be 921 | licensed as a whole at no charge to all third parties under the terms of 922 | this License. 923 | 924 | c) If the modified program normally reads commands interactively when run, 925 | you must cause it, when started running for such interactive use in the 926 | most ordinary way, to print or display an announcement including an 927 | appropriate copyright notice and a notice that there is no warranty (or 928 | else, saying that you provide a warranty) and that users may redistribute 929 | the program under these conditions, and telling the user how to view a copy 930 | of this License. (Exception: if the Program itself is interactive but does 931 | not normally print such an announcement, your work based on the Program is 932 | not required to print an announcement.) 933 | 934 | These requirements apply to the modified work as a whole. If identifiable 935 | sections of that work are not derived from the Program, and can be reasonably 936 | considered independent and separate works in themselves, then this License, and 937 | its terms, do not apply to those sections when you distribute them as separate 938 | works. But when you distribute the same sections as part of a whole which is a 939 | work based on the Program, the distribution of the whole must be on the terms 940 | of this License, whose permissions for other licensees extend to the entire 941 | whole, and thus to each and every part regardless of who wrote it. 942 | 943 | Thus, it is not the intent of this section to claim rights or contest your 944 | rights to work written entirely by you; rather, the intent is to exercise the 945 | right to control the distribution of derivative or collective works based on 946 | the Program. 947 | 948 | In addition, mere aggregation of another work not based on the Program with the 949 | Program (or with a work based on the Program) on a volume of a storage or 950 | distribution medium does not bring the other work under the scope of this 951 | License. 952 | 953 | 3. You may copy and distribute the Program (or a work based on it, under 954 | Section 2) in object code or executable form under the terms of Sections 1 and 955 | 2 above provided that you also do one of the following: 956 | 957 | a) Accompany it with the complete corresponding machine-readable source 958 | code, which must be distributed under the terms of Sections 1 and 2 above 959 | on a medium customarily used for software interchange; or, 960 | 961 | b) Accompany it with a written offer, valid for at least three years, to 962 | give any third party, for a charge no more than your cost of physically 963 | performing source distribution, a complete machine-readable copy of the 964 | corresponding source code, to be distributed under the terms of Sections 1 965 | and 2 above on a medium customarily used for software interchange; or, 966 | 967 | c) Accompany it with the information you received as to the offer to 968 | distribute corresponding source code. (This alternative is allowed only 969 | for noncommercial distribution and only if you received the program in 970 | object code or executable form with such an offer, in accord with 971 | Subsection b above.) 972 | 973 | The source code for a work means the preferred form of the work for making 974 | modifications to it. For an executable work, complete source code means all 975 | the source code for all modules it contains, plus any associated interface 976 | definition files, plus the scripts used to control compilation and installation 977 | of the executable. However, as a special exception, the source code 978 | distributed need not include anything that is normally distributed (in either 979 | source or binary form) with the major components (compiler, kernel, and so on) 980 | of the operating system on which the executable runs, unless that component 981 | itself accompanies the executable. 982 | 983 | If distribution of executable or object code is made by offering access to copy 984 | from a designated place, then offering equivalent access to copy the source 985 | code from the same place counts as distribution of the source code, even though 986 | third parties are not compelled to copy the source along with the object code. 987 | 988 | 4. You may not copy, modify, sublicense, or distribute the Program except as 989 | expressly provided under this License. Any attempt otherwise to copy, modify, 990 | sublicense or distribute the Program is void, and will automatically terminate 991 | your rights under this License. However, parties who have received copies, or 992 | rights, from you under this License will not have their licenses terminated so 993 | long as such parties remain in full compliance. 994 | 995 | 5. You are not required to accept this License, since you have not signed it. 996 | However, nothing else grants you permission to modify or distribute the Program 997 | or its derivative works. These actions are prohibited by law if you do not 998 | accept this License. Therefore, by modifying or distributing the Program (or 999 | any work based on the Program), you indicate your acceptance of this License to 1000 | do so, and all its terms and conditions for copying, distributing or modifying 1001 | the Program or works based on it. 1002 | 1003 | 6. Each time you redistribute the Program (or any work based on the Program), 1004 | the recipient automatically receives a license from the original licensor to 1005 | copy, distribute or modify the Program subject to these terms and conditions. 1006 | You may not impose any further restrictions on the recipients' exercise of the 1007 | rights granted herein. You are not responsible for enforcing compliance by 1008 | third parties to this License. 1009 | 1010 | 7. If, as a consequence of a court judgment or allegation of patent 1011 | infringement or for any other reason (not limited to patent issues), conditions 1012 | are imposed on you (whether by court order, agreement or otherwise) that 1013 | contradict the conditions of this License, they do not excuse you from the 1014 | conditions of this License. If you cannot distribute so as to satisfy 1015 | simultaneously your obligations under this License and any other pertinent 1016 | obligations, then as a consequence you may not distribute the Program at all. 1017 | For example, if a patent license would not permit royalty-free redistribution 1018 | of the Program by all those who receive copies directly or indirectly through 1019 | you, then the only way you could satisfy both it and this License would be to 1020 | refrain entirely from distribution of the Program. 1021 | 1022 | If any portion of this section is held invalid or unenforceable under any 1023 | particular circumstance, the balance of the section is intended to apply and 1024 | the section as a whole is intended to apply in other circumstances. 1025 | 1026 | It is not the purpose of this section to induce you to infringe any patents or 1027 | other property right claims or to contest validity of any such claims; this 1028 | section has the sole purpose of protecting the integrity of the free software 1029 | distribution system, which is implemented by public license practices. Many 1030 | people have made generous contributions to the wide range of software 1031 | distributed through that system in reliance on consistent application of that 1032 | system; it is up to the author/donor to decide if he or she is willing to 1033 | distribute software through any other system and a licensee cannot impose that 1034 | choice. 1035 | 1036 | This section is intended to make thoroughly clear what is believed to be a 1037 | consequence of the rest of this License. 1038 | 1039 | 8. If the distribution and/or use of the Program is restricted in certain 1040 | countries either by patents or by copyrighted interfaces, the original 1041 | copyright holder who places the Program under this License may add an explicit 1042 | geographical distribution limitation excluding those countries, so that 1043 | distribution is permitted only in or among countries not thus excluded. In 1044 | such case, this License incorporates the limitation as if written in the body 1045 | of this License. 1046 | 1047 | 9. The Free Software Foundation may publish revised and/or new versions of the 1048 | General Public License from time to time. Such new versions will be similar in 1049 | spirit to the present version, but may differ in detail to address new problems 1050 | or concerns. 1051 | 1052 | Each version is given a distinguishing version number. If the Program 1053 | specifies a version number of this License which applies to it and "any later 1054 | version", you have the option of following the terms and conditions either of 1055 | that version or of any later version published by the Free Software Foundation. 1056 | If the Program does not specify a version number of this License, you may 1057 | choose any version ever published by the Free Software Foundation. 1058 | 1059 | 10. If you wish to incorporate parts of the Program into other free programs 1060 | whose distribution conditions are different, write to the author to ask for 1061 | permission. For software which is copyrighted by the Free Software Foundation, 1062 | write to the Free Software Foundation; we sometimes make exceptions for this. 1063 | Our decision will be guided by the two goals of preserving the free status of 1064 | all derivatives of our free software and of promoting the sharing and reuse of 1065 | software generally. 1066 | 1067 | NO WARRANTY 1068 | 1069 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 1070 | THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE 1071 | STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 1072 | PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 1073 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1074 | FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 1075 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, 1076 | YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 1077 | 1078 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL 1079 | ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE 1080 | PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 1081 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR 1082 | INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA 1083 | BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 1084 | FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER 1085 | OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 1086 | 1087 | END OF TERMS AND CONDITIONS 1088 | 1089 | How to Apply These Terms to Your New Programs 1090 | 1091 | If you develop a new program, and you want it to be of the greatest possible 1092 | use to the public, the best way to achieve this is to make it free software 1093 | which everyone can redistribute and change under these terms. 1094 | 1095 | To do so, attach the following notices to the program. It is safest to attach 1096 | them to the start of each source file to most effectively convey the exclusion 1097 | of warranty; and each file should have at least the "copyright" line and a 1098 | pointer to where the full notice is found. 1099 | 1100 | One line to give the program's name and a brief idea of what it does. 1101 | 1102 | Copyright (C) 1103 | 1104 | This program is free software; you can redistribute it and/or modify it 1105 | under the terms of the GNU General Public License as published by the Free 1106 | Software Foundation; either version 2 of the License, or (at your option) 1107 | any later version. 1108 | 1109 | This program is distributed in the hope that it will be useful, but WITHOUT 1110 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1111 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1112 | more details. 1113 | 1114 | You should have received a copy of the GNU General Public License along 1115 | with this program; if not, write to the Free Software Foundation, Inc., 59 1116 | Temple Place, Suite 330, Boston, MA 02111-1307 USA 1117 | 1118 | Also add information on how to contact you by electronic and paper mail. 1119 | 1120 | If the program is interactive, make it output a short notice like this when it 1121 | starts in an interactive mode: 1122 | 1123 | Gnomovision version 69, Copyright (C) year name of author Gnomovision comes 1124 | with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free 1125 | software, and you are welcome to redistribute it under certain conditions; 1126 | type 'show c' for details. 1127 | 1128 | The hypothetical commands 'show w' and 'show c' should show the appropriate 1129 | parts of the General Public License. Of course, the commands you use may be 1130 | called something other than 'show w' and 'show c'; they could even be 1131 | mouse-clicks or menu items--whatever suits your program. 1132 | 1133 | You should also get your employer (if you work as a programmer) or your school, 1134 | if any, to sign a "copyright disclaimer" for the program, if necessary. Here 1135 | is a sample; alter the names: 1136 | 1137 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 1138 | 'Gnomovision' (which makes passes at compilers) written by James Hacker. 1139 | 1140 | signature of Ty Coon, 1 April 1989 1141 | 1142 | Ty Coon, President of Vice 1143 | 1144 | This General Public License does not permit incorporating your program into 1145 | proprietary programs. If your program is a subroutine library, you may 1146 | consider it more useful to permit linking proprietary applications with the 1147 | library. If this is what you want to do, use the GNU Library General Public 1148 | License instead of this License. 1149 | 1150 | 1151 | "CLASSPATH" EXCEPTION TO THE GPL 1152 | 1153 | Certain source files distributed by Oracle America and/or its affiliates are 1154 | subject to the following clarification and special exception to the GPL, but 1155 | only where Oracle has expressly included in the particular source file's header 1156 | the words "Oracle designates this particular file as subject to the "Classpath" 1157 | exception as provided by Oracle in the LICENSE file that accompanied this code." 1158 | 1159 | Linking this library statically or dynamically with other modules is making 1160 | a combined work based on this library. Thus, the terms and conditions of 1161 | the GNU General Public License cover the whole combination. 1162 | 1163 | As a special exception, the copyright holders of this library give you 1164 | permission to link this library with independent modules to produce an 1165 | executable, regardless of the license terms of these independent modules, 1166 | and to copy and distribute the resulting executable under terms of your 1167 | choice, provided that you also meet, for each linked independent module, 1168 | the terms and conditions of the license of that module. An independent 1169 | module is a module which is not derived from or based on this library. If 1170 | you modify this library, you may extend this exception to your version of 1171 | the library, but you are not obligated to do so. If you do not wish to do 1172 | so, delete this exception statement from your version. 1173 | 1174 | License for: 1175 | ============ 1176 | ** corretto-8-docker; https://github.com/corretto/corretto-8-docker 1177 | 1178 | MIT No Attribution 1179 | 1180 | Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 1181 | 1182 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 1183 | software and associated documentation files (the "Software"), to deal in the Software 1184 | without restriction, including without limitation the rights to use, copy, modify, 1185 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 1186 | permit persons to whom the Software is furnished to do so. 1187 | 1188 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 1189 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 1190 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 1191 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 1192 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 1193 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------