consul/agent
Mitchell Hashimoto f76022fa63 CA Provider Plugins (#4751)
This adds the `agent/connect/ca/plugin` library for consuming/serving Connect CA providers as [go-plugin](https://github.com/hashicorp/go-plugin) plugins. This **does not** wire this up in any way to Consul itself, so this will not enable using these plugins yet. 

## Why?

We want to enable CA providers to be pluggable without modifying Consul so that any CA or PKI system can potentially back the Connect certificates. This CA system may also be used in the future for easier bootstrapping and internal cluster security.

### go-plugin

The benefit of `go-plugin` is that for the plugin consumer, the fact that the interface implementation is communicating over multi-process RPC is invisible. Internals of Consul will continue to just use `ca.Provider` interface implementations as if they're local. For plugin _authors_, they simply have to implement the interface. The network/transport/process management issues are handled by go-plugin itself.

The CA provider plugins support both `net/rpc` and gRPC transports. This enables easy authoring in any language. go-plugin handles the actual protocol handshake and connection. This is just a feature of go-plugin. 

`go-plugin` is already in production use for years by Packer, Terraform, Nomad, Vault, and Sentinel. We've shown stability for both desktop and server-side software. It is very mature.

## Implementation Details

### `map[string]interface{}`

The `Configure` method passes a `map[string]interface{}`. This map contains only Go primitives and containers of primitives (no funcs, chans, etc.). For `net/rpc` we encode as-is using Gob. For gRPC we marshal to JSON and transmit as a `bytes` type. This is the same approach we take with Vault and other software.

Note that this is just the transport protocol, the end software views it fully decoded.

### `x509.Certificate` and `CertificateRequest`

We transmit the raw ASN.1  bytes and decode on the other side. Unit tests are verifying we get the same cert/csrs across the wire.

### Testing

`go-plugin` exposes test helpers that enable testing the full plugin RPC over real loopback network connections. We test all endpoints for success and error for both `net/rpc` and gRPC.

### Vendoring

This PR doesn't introduce vendoring for two reasons:

  1. @banks's `f-envoy` branch introduces a lot of these and I didn't want conflict.
  2. The library isn't actually used yet so it doesn't introduce compile-time errors (it does introduce test errors).

## Next Steps

With this in place, we need to figure out the proper way to actually hook these up to Consul, load them, etc. This discussion can happen elsewhere, since regardless of approach this plugin library implementation is the exact same.
2019-01-07 12:48:44 -05:00
..
ae Add -sidecar-for and new /agent/service/:service_id endpoint (#4691) 2018-10-10 16:55:34 +01:00
cache Quick fix for cache age flakiness in CI 2018-10-11 13:12:19 +01:00
cache-types merge feedback: fix typos; actually use deliverLatest added previously but not plumbed in 2018-10-10 16:55:34 +01:00
checks Add -sidecar-for and new /agent/service/:service_id endpoint (#4691) 2018-10-10 16:55:34 +01:00
config Documentation and changes for `verify_server_hostname` (#5069) 2018-12-06 13:51:49 -08:00
connect CA Provider Plugins (#4751) 2019-01-07 12:48:44 -05:00
consul [Travis][UnstableTests] Fixed unstable tests in travis (#5013) 2018-12-12 12:09:42 -08:00
debug fix comment typos (#4890) 2018-11-02 12:00:39 -05:00
exec
local [Fix] Services sometimes not being synced with acl_enforce_version_8 = false (#4771) 2019-01-04 10:01:50 -05:00
metadata New ACLs (#4791) 2018-10-19 12:04:07 -04:00
mock agent: replace docker check 2017-07-18 20:24:38 +02:00
pool
proxycfg merge feedback: fix typos; actually use deliverLatest added previously but not plumbed in 2018-10-10 16:55:34 +01:00
proxyprocess Add -sidecar-for and new /agent/service/:service_id endpoint (#4691) 2018-10-10 16:55:34 +01:00
router Spelling (#3958) 2018-03-19 16:56:00 +00:00
structs Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
systemd
token re-add Connect multi-dc config changes 2018-10-19 08:41:03 -07:00
xds New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl_endpoint.go Adds documentation for the new ACL APIs (#4851) 2018-10-31 15:11:51 -07:00
acl_endpoint_legacy.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl_endpoint_legacy_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl_endpoint_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
agent.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
agent_endpoint.go Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
agent_endpoint_test.go Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
agent_test.go [Security] Add finer control over script checks (#4715) 2018-10-11 13:22:11 +01:00
bindata_assetfs.go Release v1.4.0 2018-11-14 22:37:47 +00:00
blacklist.go
blacklist_test.go
catalog_endpoint.go Support multiple tags for health and catalog http api endpoints (#4717) 2018-10-11 12:50:05 +01:00
catalog_endpoint_test.go Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
check.go
config.go
connect_auth.go connect: remove additional trust-domain validation (#4934) 2018-11-12 20:20:12 +00:00
connect_ca_endpoint.go Fix CA pruning when CA config uses string durations. (#4669) 2018-09-13 15:43:00 +01:00
connect_ca_endpoint_test.go Fix more unstable tests in agent and command 2018-09-12 14:49:27 +01:00
coordinate_endpoint.go
coordinate_endpoint_test.go Fix more unstable tests in agent and command 2018-09-12 14:49:27 +01:00
dns.go dns: implements prefix lookups for DNS TTL (#4605) 2018-10-19 08:41:04 -07:00
dns_test.go Fixed another list of unstable unit tests in travis (#4915) 2018-11-20 11:27:26 +00:00
enterprise_delegate_oss.go
event_endpoint.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
event_endpoint_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
health_endpoint.go Support multiple tags for health and catalog http api endpoints (#4717) 2018-10-11 12:50:05 +01:00
health_endpoint_test.go Add Proxy Upstreams to Service Definition (#4639) 2018-10-10 16:55:34 +01:00
http.go Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
http_oss.go Implement /v1/agent/health/service/<service name> endpoint (#3551) 2019-01-07 09:39:23 -05:00
http_oss_test.go Fixed another list of unstable unit tests in travis (#4915) 2018-11-20 11:27:26 +00:00
http_test.go New command: consul debug (#4754) 2018-10-19 08:41:03 -07:00
intentions_endpoint.go agent: 400 error on invalid UUID format, api handles errors properly 2018-06-27 07:40:06 +02:00
intentions_endpoint_test.go agent: 400 error on invalid UUID format, api handles errors properly 2018-06-27 07:40:06 +02:00
keyring.go
keyring_test.go
kvs_endpoint.go
kvs_endpoint_test.go Improve reliability of tests with TestAgent (#4525) 2018-08-14 12:08:33 -04:00
notify.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
notify_test.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
operator_endpoint.go
operator_endpoint_test.go Fix unstable tests in agent, api, and command/watch 2018-09-10 16:58:53 +01:00
prepared_query_endpoint.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
prepared_query_endpoint_test.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
remote_exec.go
remote_exec_test.go Fix unstable tests in agent, api, and command/watch 2018-09-10 16:58:53 +01:00
retry_join.go agent: configure k8s go-discover 2018-09-05 13:38:13 -07:00
retry_join_test.go Vendoring update for go-discover. (#4412) 2018-07-25 16:21:04 -07:00
session_endpoint.go
session_endpoint_test.go Implementation of Weights Data structures (#4468) 2018-09-07 15:30:47 +01:00
sidecar_service.go merge feedback: fix typos; actually use deliverLatest added previously but not plumbed in 2018-10-10 16:55:34 +01:00
sidecar_service_test.go [Security] Add finer control over script checks (#4715) 2018-10-11 13:22:11 +01:00
signal_unix.go cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands (#4737) 2018-10-02 15:57:21 -05:00
signal_windows.go cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands (#4737) 2018-10-02 15:57:21 -05:00
snapshot_endpoint.go
snapshot_endpoint_test.go
status_endpoint.go
status_endpoint_test.go Fixed another list of unstable unit tests in travis (#4915) 2018-11-20 11:27:26 +00:00
testagent.go Fix #4515: Segfault when serf_wan port was -1 but reconnect_time_wan was set (#4531) 2018-08-17 14:44:25 -04:00
testagent_test.go
translate_addr.go
txn_endpoint.go
txn_endpoint_test.go Improve reliability of tests with TestAgent (#4525) 2018-08-14 12:08:33 -04:00
ui_endpoint.go agent: ExternalSources instead of Meta 2018-09-07 10:06:55 -07:00
ui_endpoint_test.go Added SOA configuration for DNS settings. (#4714) 2018-10-10 15:50:56 -04:00
user_event.go
user_event_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
util.go cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands (#4737) 2018-10-02 15:57:21 -05:00
util_test.go cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands (#4737) 2018-10-02 15:57:21 -05:00
watch_handler.go
watch_handler_test.go