1 Star 0 Fork 0

NATS / nats-rest-config-proxy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

License Build GitHub release (latest by date) Coveralls branch

NATS REST Configuration Proxy

The NATS Server ACL configuration proxy provides a secure REST interface for modifying access control lists (ACLs), identities (users), and passwords. This proxy is designed to facilitate the development of command line tools and/or user interfaces to remotely update a NATS server configuration.

Only identities and permissions are supported at this time.

Getting started

go get -u github.com/nats-io/nats-rest-config-proxy

Usage

Usage: nats-rest-config-proxy [options...]

Server Options:
    -a, --addr <host>             Bind to host address (default: 0.0.0.0)
    -p, --port <port>             Use port for clients (default: 4567)
    -d, --dir <directory>         Directory for storing data
    -c, --config <file>           Configuration file
    -f, --publish-script <file>   Path to an optional script to execute on publish

Logging Options:
    -l, --log <file>              File to redirect log output
    -D, --debug                   Enable debugging output
    -V, --trace                   Enable trace logging
    -DV                           Debug and trace

TLS Options:
    --cert <file>                 Server certificate file
    --key <file>                  Private key for server certificate
    --cacert <file>               Client certificate CA for verification

Common Options:
    -h, --help                    Show this message
    -v, --version                 Show version

Configuration file

The NATS REST ACL Proxy supports a configuration file. Authorization based on the subject attributes of a client certificate is also supported.

listen = '0.0.0.0:4567'

data_dir = 'test/data'

logging {
  debug = true
  trace = true
}

tls {
  ca = 'test/certs/ca.pem'
  cert = 'test/certs/server.pem'
  key = 'test/certs/server-key.pem'
}

auth {
  users = [
    { user = "CN=cncf.example.com,OU=CNCF" }
  ]
}

How it works

The NATS REST Configuration proxy operates using a data directory a configuration file, and a publish script.

The process is straightforward:

  1. Launch the NATS REST Configuration proxy and specify the Authorization configuration file you'd like to modify.
  2. Use the REST API to modify users and permissions.
  3. Take a snapshot. This saves the current work in the data directory.
  4. Invoke the publish command to copy a snapshot into the configuration file and invoke the optional publish script.

Why a script

A script is used for versatility. For some, this could be used as a step in a github devops flow and the script creates a PR with the new configuration for human eyes to review. For others, the updated file is copied to remote nodes and then NATS servers are reloaded with remote commands, e.g. ssh -t gnatsd -sl reload. One could even work on an included NATS server file directly, with changes to be picked up nightly. There are many options.

Developing

# Build locally using Go modules
$ GO111MODULE=on go run main.go
[41405] 2019/02/11 16:18:52.713366 [INF] Starting nats-rest-config-proxy v0.0.1
[41405] 2019/02/11 16:18:52.713804 [INF] Listening on 0.0.0.0:4567

# To run the tests
$ go test ./... -v

Note: To test locally, you'll need to add a hostname into your /etc/hosts file: 127.0.0.1 nats-cluster.default.svc.cluster.local

REST API

The NATS configuration proxy will return the following error codes:

  • 200 OK - success
  • 400 Bad Request - Invalid API request
  • 404 Not Found - resource was not found
  • 405 Method Not Allowed - unsupported operation
  • 409 Conflict - the operation cannot be completed as a dependency will create an invalid configuration.
Resource GET POST PUT DELETE
/v1/auth/idents Get list of identities 405 405 Delete all permissions
/v1/auth/idents/(name) Get specific identity w/ permissions 405 Create/Update Identity Delete named identity
/v1/auth/perms Get list of named permissions sets 405 405 Delete all permissions
/v1/auth/perms/(name) Get specific permission set 405 Update Permission Delete named permission
/v1/auth/accounts Get list of accounts 405 405 400
/v1/auth/accounts/(name) Get specific account 405 Create/Update Account Delete named account
/v2/auth/jetstream 405 405 Create/Update JetStream config Delete JetStream config

Identity Add/Update Payload

{"username": "alice", "password": "foo"}

NKEY:

{"nkey" : "UC6NLCN7AS34YOJVCYD4PJ3QB7QGLYG5B5IMBT25VW5K4TNUJODM7BOX"}

Certificate subject attributes with permissions:

{"username" : "CN=Application1,OU=SCSS", "permissions" : "normal_user"}

Permission add/update payload

  "normal_user" : {
    # Can send to foo, bar or baz only.
    "publish" : {
      "allow" : ["foo", "bar", "baz"]
    }
    # Can subscribe to everything but $SYSTEM prefixed subjects.
    "subscribe" : {
      "deny" : ["$SYSTEM.>"]
    }
  }

Commands

Command GET POST PUT DELETE
/healthz 200 405 405 405
/v1/auth/snapshot?name=foo 405 snapshot current config 405 deletes named snapshot
/v1/auth/publish?name=foo 405 Saves / invokes script 405 405
/v2/auth/snapshot?name=foo 405 snapshot current config 405 deletes named snapshot
/v2/auth/publish?name=foo 405 Saves / invokes script 405 405
/v2/auth/validate 405 Validates the config 405 405

In addition to /v1/auth/snapshot, there is also /v2/auth/snapshot which is documented below in the v2.0 Accounts section.

Examples

Create/update a permission

Plain permissions.

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/sample-user -d '{
 "publish": {
   "allow": ["foo.*", "bar.>"]
  },
  "subscribe": {
    "deny": ["quux"]
  }
}'

Queue group permissions are supported as well. Here bar.> is the subject and fizzgroup is the queue group.

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/sample-user -d '{
 "publish": {
   "allow": ["foo.*", "bar.> fizzgroup"]
  }
}'

Get a permission

curl http://127.0.0.1:4567/v1/auth/perms/sample-user

Create/update a user

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/sample-user -d '{
  "username": "sample-user",
  "password": "secret",
  "account": "sample-account",
  "permissions": "sample-user"
}'

Get a user

curl http://127.0.0.1:4567/v1/auth/idents/sample-user

Create/update an account

curl -X PUT http://127.0.0.1:4567/v1/auth/accounts/sample-account -d '{}'

Create/update the global jetstream configuration

curl -X PUT http://127.0.0.1:4567/v2/auth/jetstream -d '{
  "store_dir": "/data/nats-server",
  "max_memory": 1073741824,
  "max_file": 10737418240,
  "max_streams": -1,
  "max_consumers": -1
}'

Create/update an account with jetstream support

Create an account with JetStream support enabled with 10GB file storage and 1GB memory, as well as infinite streams and consumers.

curl -X PUT http://127.0.0.1:4567/v1/auth/accounts/sample-account -d '{
  "jetstream": {
    "max_memory": 1073741824,
    "max_file": 10737418240,
    "max_streams": -1,
    "max_consumers": -1
  }
}'

Note that in order to use JetStream you need enable it outside of the auth configuration, for example after publishing.

jetstream {
  max_file = 20GB
  max_mem = 2GB
}

include 'auth.conf'

Get an account

curl http://127.0.0.1:4567/v1/auth/accounts/sample-account

Delete an account

curl -X DELETE http://127.0.0.1:4567/v1/auth/accounts/sample-account

Build snapshot

curl -X POST http://127.0.0.1:4567/v1/auth/snapshot?name=snap1

Publish snapshot

curl -X POST http://127.0.0.1:4567/v2/auth/publish?name=snap1

Usage Walkthrough

In this example, we will create a couple of users with different permissions:

Ident DN in TLS cert Permissions
acme-user CN=acme.example.com,OU=ACME admin
cncf-user CN=cncf.example.com,OU=CNCF guest

First we will start the server, and use the -d flag to setup the directory that will contain the users that were created via the proxy:

$ mkdir config
$ nats-rest-config-proxy -DV -d config
[5875] 2019/06/18 14:43:44.826782 [INF] Starting nats-rest-config-proxy v0.1.0
[5875] 2019/06/18 14:43:44.829134 [INF] Listening on 0.0.0.0:4567

Next, let's create the permissions for both guest and admin users:

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/guest -d '{
 "publish": {
   "allow": ["foo.*", "bar.>"]
  },
  "subscribe": {
    "deny": ["quux"]
  }
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/admin -d '{
 "publish": {
   "allow": [">"]
  },
  "subscribe": {
    "allow": [">"]
  }
}'

Now that we have created the permissions, let's bind some users to these permissions:

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/cncf-user -d '{
  "username": "CN=cncf.example.com,OU=CNCF",
  "permissions": "guest"
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/acme-user -d '{
  "username": "CN=acme.example.com,OU=ACME",
  "permissions": "admin"
}'

We now can create a named snapshot for this setup. Let's create one named v1:

curl -X POST http://127.0.0.1:4567/v2/auth/snapshot?name=v1

Then publish the configuration:

curl -X POST http://127.0.0.1:4567/v1/auth/publish?name=v1

At this point, we will have the following directory structure in the config directory:

 tree config
config
├── current
│   └── auth.json
├── resources
│   ├── permissions
│   │   ├── admin.json
│   │   └── guest.json
│   └── users
│       ├── acme-user.json
│       └── cncf-user.json
└── snapshots
    └── v1.json

And the published auth configuration will look like:

$ cat config/current/auth.json
{
  "users": [
    {
      "username": "CN=acme.example.com,OU=ACME",
      "permissions": {
        "publish": {
          "allow": [
            ">"
          ]
        },
        "subscribe": {
          "allow": [
            ">"
          ]
        }
      }
    },
    {
      "username": "CN=cncf.example.com,OU=CNCF",
      "permissions": {
        "publish": {
          "allow": [
            "foo.*",
            "bar.>"
          ]
        },
        "subscribe": {
          "deny": [
            "quux"
          ]
        }
      }
    }
  ]
}

This configuration can now be included by a nats-server. Note that in order to enable checking permissions based on a TLS certificate, it is needed to set verify_and_map= to true in the tls config:

tls {
  cert_file = "./certs/server.pem"
  key_file = "./certs/server-key.pem"
  ca_file = "./certs/ca.pem"
  verify_and_map = true
}

authorization {
  include "config/current/auth.json"
}

Starting the NATS Server with the configuration:

nats-server -c nats.conf  -DV
[6342] 2019/06/18 18:04:38.899054 [INF] Starting nats-server version 2.0.0
[6342] 2019/06/18 18:04:38.899177 [DBG] Go build version go1.12
[6342] 2019/06/18 18:04:38.899557 [INF] Listening for client connections on 0.0.0.0:4222
[6342] 2019/06/18 18:04:38.899570 [INF] TLS required for client connections
[6342] 2019/06/18 18:04:38.899578 [INF] Server id is NCFA6C5OC45PKJOISSDCWBEDQ4YMKOH57WHCWLL6EZ2Y723WAAIUHPJI
[6342] 2019/06/18 18:04:38.899584 [INF] Server is ready

Now if the following app tries to connect and publish to a subject without permissions it won't be able to:

package main

import (
	"log"

	"github.com/nats-io/nats.go"
)

func main() {
	nc, err := nats.Connect("nats://nats-cluster.default.svc.cluster.local:4222",
		nats.ErrorHandler(func(_ *nats.Conn, _ *nats.Subscription, err error) {
			log.Println("Error:", err)
		}),
		nats.ClientCert("./certs/cncf-client.pem", "./certs/cnfc-client-key.pem"),
		nats.RootCAs("./certs/ca.pem"),
	)
	if err != nil {
		log.Fatal(err)
	}
	nc.Publish("ng", []byte("first"))
	nc.Publish("foo.bar", []byte("second"))
	nc.Flush()
	nc.Drain()
}

Example logs from the server:

[6404] 2019/06/18 18:10:11.921048 [DBG] 127.0.0.1:55492 - cid:1 - Client connection created
[6404] 2019/06/18 18:10:11.921561 [DBG] 127.0.0.1:55492 - cid:1 - Starting TLS client connection handshake
[6404] 2019/06/18 18:10:11.929261 [DBG] 127.0.0.1:55492 - cid:1 - TLS handshake complete
[6404] 2019/06/18 18:10:11.929367 [DBG] 127.0.0.1:55492 - cid:1 - TLS version 1.2, cipher suite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[6404] 2019/06/18 18:10:11.929615 [TRC] 127.0.0.1:55492 - cid:1 - <<- [CONNECT {"verbose":false,"pedantic":false,"tls_required":true,"name":"","lang":"go","version":"1.7.0","protocol":1,"echo":true}]
[6404] 2019/06/18 18:10:11.929782 [DBG] 127.0.0.1:55492 - cid:1 - User in cert [""], not found
[6404] 2019/06/18 18:10:11.929801 [DBG] 127.0.0.1:55492 - cid:1 - Using certificate subject for auth ["CN=cncf.example.com,OU=CNCF"]
[6404] 2019/06/18 18:10:11.929833 [TRC] 127.0.0.1:55492 - cid:1 - <<- [PING]
[6404] 2019/06/18 18:10:11.929843 [TRC] 127.0.0.1:55492 - cid:1 - ->> [PONG]
[6404] 2019/06/18 18:10:11.930454 [TRC] 127.0.0.1:55492 - cid:1 - <<- [PUB ng 5]
[6404] 2019/06/18 18:10:11.930470 [TRC] 127.0.0.1:55492 - cid:1 - <<- MSG_PAYLOAD: ["first"]
[6404] 2019/06/18 18:10:11.930498 [TRC] 127.0.0.1:55492 - cid:1 - ->> [-ERR Permissions Violation for Publish to "ng"]
[6404] 2019/06/18 18:10:11.930567 [ERR] 127.0.0.1:55492 - cid:1 - Publish Violation - User "CN=cncf.example.com,OU=CNCF", Subject "ng"
[6404] 2019/06/18 18:10:11.930583 [TRC] 127.0.0.1:55492 - cid:1 - <<- [PUB foo.bar 6]
[6404] 2019/06/18 18:10:11.930608 [TRC] 127.0.0.1:55492 - cid:1 - <<- MSG_PAYLOAD: ["second"]
[6404] 2019/06/18 18:10:11.930629 [TRC] 127.0.0.1:55492 - cid:1 - <<- [PING]
[6404] 2019/06/18 18:10:11.930661 [TRC] 127.0.0.1:55492 - cid:1 - ->> [PONG]
[6404] 2019/06/18 18:10:11.931113 [DBG] 127.0.0.1:55492 - cid:1 - Client connection closed

Using NATS v2.0 Accounts

In this example, we will create a couple of users on different accounts.

Ident Account Permissions
foo-1-user Foo guest
foo-2-user Foo admin
bar-1-user Bar guest
bar-2-user Bar admin

Start the server using its own data directory:

$ mkdir config
$ nats-rest-config-proxy -DV -d config
[5875] 2019/06/18 14:43:44.826782 [INF] Starting nats-rest-config-proxy v0.1.0
[5875] 2019/06/18 14:43:44.829134 [INF] Listening on 0.0.0.0:4567

Next, let's create the permissions for both guest and admin users:

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/guest -d '{
 "publish": {
   "allow": ["foo.*", "bar.>"]
  },
  "subscribe": {
    "deny": ["quux"]
  }
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/perms/admin -d '{
 "publish": {
   "allow": [">"]
  },
  "subscribe": {
    "allow": [">"]
  }
}'

Let's create some accounts. In this example, the account Foo will export a stream and a service that account Bar will be able to import using a different prefix and subject:

curl -X PUT http://127.0.0.1:4567/v1/auth/accounts/Foo -d '{
  "exports": [
    { "stream": "Foo.public.>" },
    { "service": "Foo.api" }
  ]
}
'

curl -X PUT http://127.0.0.1:4567/v1/auth/accounts/Bar -d '{
  "imports": [
    { "stream":  {"account": "Foo", "subject": "Foo.public.>" }, "prefix": "from" },
    { "service": {"account": "Foo", "subject": "Foo.api" }, "to": "from.Foo.api" }
  ]
}
'

Now that we have created the permissions, let's bind some users to these permissions:

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/foo-1-user -d '{
  "username": "foo-1-user",
  "password": "foo-1-secret",
  "permissions": "guest",
  "account": "Foo"
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/foo-2-user -d '{
  "username": "foo-2-user",
  "password": "foo-2-secret",
  "permissions": "admin",
  "account": "Foo"
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/bar-1-user -d '{
  "username": "bar-1-user",
  "password": "bar-1-secret",
  "permissions": "guest",
  "account": "Bar"
}'

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/bar-2-user -d '{
  "username": "bar-2-user",
  "password": "bar-2-secret",
  "permissions": "admin",
  "account": "Bar"
}'

Account based Subject Mapping

You can also apply subject mappings to an account.

curl -X PUT http://127.0.0.1:4567/v1/auth/accounts/MappedAccount -d '{
  "mappings": {
    "foo": [
      {
        "destination": "foo.mapped",
        "weight": "100%"
      }
    ],
    "bar": [
      {
        "destination": "bar.mapped.1",
        "weight": "50%"
      },
      {
        "destination": "bar.mapped.2",
        "weight": "50%"
      }
    ]
  }
}'

Add a user:

curl -X PUT http://127.0.0.1:4567/v1/auth/idents/mapped-account-user -d '{
  "username": "mapped-account-user",
  "password": "mapped-account-user-secret",
  "permissions": "admin",
  "account": "MappedAccount"
}'

Messages published to foo will be mapped to foo.mapped and messages published to bar will be distributed to bar.mapped.1 and bar.mapped.2 roughly equally.

Account subject mappings are maintained alongside import and exports, so be sure to include existing imports and exports as you add, change, or remove subject mappings.

Creating Snapshots

We now can create a named snapshot for this setup. Let's create one named v1:

curl -X POST http://127.0.0.1:4567/v2/auth/snapshot?name=v1

Then publish the configuration:

curl -X POST http://127.0.0.1:4567/v2/auth/publish?name=v1

At this point, we will have the following directory structure in the config directory:

$ tree config
config
├── current
│   └── accounts
│       ├── auth.conf
│       ├── Bar.json
│       └── Foo.json
├── resources
│   ├── accounts
│   │   ├── Bar.json
│   │   └── Foo.json
│   ├── permissions
│   │   ├── admin.json
│   │   └── guest.json
│   └── users
│       ├── bar-1-user.json
│       ├── bar-2-user.json
│       ├── foo-1-user.json
│       └── foo-2-user.json
└── snapshots
    └── v1
        ├── auth.conf
        ├── Bar.json
        └── Foo.json

8 directories, 14 files

And the published auth configuration will look like:

$ cat config/current/accounts/auth.conf
accounts {
  Bar { include 'Bar.json' }
  Foo { include 'Foo.json' }
}

This configuration can now be included by a nats-server in order to define a couple of variables that can be used as follow:

include "config/current/accounts/auth.conf"

Validation tool

Release v0.4.0 also now includes a nats-rest-config-validator tool which can be used to verify whether the resources are in a valid state and otherwise report the error.

nats-rest-config-validator -h
Usage: nats-rest-config-validator [options...]

Options:
    -d, --dir <directory>         Directory for storing data (default is the current directory.)
    -h, --help                    Show this message
    -v, --version                 Show version

For example given the following directory structure:

$ cd data/
$ tree .
.
└── resources
    ├── accounts
    │   ├── bar.json
    │   └── foo.json
    ├── permissions
    │   ├── admin.json
    │   └── guest.json
    └── users
        ├── user1.json
        ├── user2.json
        └── user3.json

Where one of the defined permissions has an invalid subject:

==> resources/users/user2.json <==
{
  "username": "user2",
  "password": "user2",
  "permissions": "user2",
  "account": "bar"
}

==> resources/permissions/user3.json <==
{
  "publish": {
    "allow": [
      "foo.*",
    ]
  },
  "subscribe": {
    "deny": [
      ""
    ]
  }
}

Running the tool would build the config and show on which account the error exists:

$ nats-rest-config-validator -d data

Error: On /bar.json : {
  "users": [
    {
      "username": "user2",
      "password": "user2",
      "permissions": {
        "publish": {
          "allow": [
            "foo.*"
          ]
        },
        "subscribe": {
          "deny": [
            "",
            ^^^  subject "" is not a valid subject

Snapshot/Publishing tool

Release v0.5.0 includes a couple of tools to create and publish snapshots without having to start the server, the nats-rest-config-snapshot and nats-rest-config-publish tools.

For example, first we can create a snapshot:

$ nats-rest-config-snapshot -d data --snapshot my-snapshot
Taking "my-snapshot" snapshot...
OK

And then publish it as well:

$ nats-rest-config-publish -d data --snapshot my-snapshot
Publishing "my-snapshot" snapshot
OK

By default in case no snapshot name was given, the tool will publish the latest configuration:

$ nats-rest-config-publish -d data
Taking "latest" snapshot...
Publishing "latest" snapshot
OK

Our sponsor for this project

Many thanks to MasterCard for sponsoring this project. We appreciate MasterCard's support of NATS, CNCF, and the OSS community.

License

Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "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. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "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. "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). "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. "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." "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. 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. 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. 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: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) 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 (d) 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. 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. 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. 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. 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. 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. 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. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

NATS REST Configuration Proxy 展开 收起
Go 等 2 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/nats-io/nats-rest-config-proxy.git
git@gitee.com:nats-io/nats-rest-config-proxy.git
nats-io
nats-rest-config-proxy
nats-rest-config-proxy
main

搜索帮助