Commit Graph

33 Commits

Author SHA1 Message Date
Mahmood Ali
cacf2a254d fixup! handle when hcl parser panics 2020-08-25 11:28:55 -04:00
Mahmood Ali
1479f353c0 handle when hcl parser panics
Apparently `\` followed by a digit number can cause hcl parser to panic!
Will fix in hcl library, but using a hammer to squash any similar issue
here.
2020-08-24 20:35:58 -04:00
Anthony Scalisi
e1287846ae fix spelling errors (#6985) 2020-04-20 09:28:19 -04:00
Chris Baker
1c7c599372 more testing for ScalingPolicy, mainly around parsing and canonicalization for Min/Max 2020-03-24 19:43:50 +00:00
Chris Baker
f704a49962 added new ACL capabilities related to autoscaling:
- read-job-scaling
- scale-job
- list-scaling-policies
- read-scaling-policy

updated the read and right policy dispositions, added the new autoscaler disposition
2020-03-24 14:38:58 +00:00
Chris Baker
1c9bac9087 wip: added job.scale rpc endpoint, needs explicit test (tested via http now) 2020-03-24 13:57:09 +00:00
Lang Martin
2dc95485d2 csi: ACLs for plugin endpoints (#7380)
* acl/policy: add PolicyList for global ACLs

* acl/acl: plugin policy

* acl/acl: maxPrivilege is required to allow "list"

* nomad/csi_endpoint: enforce plugin access with PolicyPlugin

* nomad/csi_endpoint: check job ACL swapped params

* nomad/csi_endpoint_test: test alloc filtering

* acl/policy: add namespace csi-register-plugin

* nomad/job_endpoint: check csi-register-plugin ACL on registration

* nomad/job_endpoint_test: add plugin job cases
2020-03-23 13:59:25 -04:00
Lang Martin
4573cbeef9 csi: implement volume ACLs (#7339)
* acl/policy: add the volume ACL policies

* nomad/csi_endpoint: enforce ACLs for volume access

* nomad/search_endpoint_oss: volume acls

* acl/acl: add plugin read as a global policy

* acl/policy: add PluginPolicy global cap type

* nomad/csi_endpoint: check the global plugin ACL policy

* nomad/mock/acl: PluginPolicy

* nomad/csi_endpoint: fix list rebase

* nomad/core_sched_test: new test since #7358

* nomad/csi_endpoint_test: use correct permissions for list

* nomad/csi_endpoint: allowCSIMount keeps ACL checks together

* nomad/job_endpoint: check mount permission for jobs

* nomad/job_endpoint_test: need plugin read, too
2020-03-23 13:59:25 -04:00
Lang Martin
63b7f96537 acl: new NamespaceCapabilityCSIAccess, CSICreateVolume 2020-03-23 13:58:29 -04:00
Mahmood Ali
7a38784244 acl: check ACL against object namespace
Fix a bug where a millicious user can access or manipulate an alloc in a
namespace they don't have access to.  The allocation endpoints perform
ACL checks against the request namespace, not the allocation namespace,
and performs the allocation lookup independently from namespaces.

Here, we check that the requested can access the alloc namespace
regardless of the declared request namespace.

Ideally, we'd enforce that the declared request namespace matches
the actual allocation namespace.  Unfortunately, we haven't documented
alloc endpoints as namespaced functions; we suspect starting to enforce
this will be very disruptive and inappropriate for a nomad point
release.  As such, we maintain current behavior that doesn't require
passing the proper namespace in request.  A future major release may
start enforcing checking declared namespace.
2019-10-08 12:59:22 -04:00
Danielle Lancashire
d844f37be2 acls: Break mount acl into mount-rw and mount-ro 2019-08-21 21:17:30 +02:00
Danielle Lancashire
065688da40 acl: Add HostVolume ACLs
This adds an initial implementation of ACLs for HostVolumes.

Because HostVolumes are a cluster-wide resource, they cannot be tied to
a namespace, thus here we allow similar wildcard definitions based on
their names, tied to a set of capabilities.

Initially, the only available capabilities are deny, or mount. These
may be extended in the future to allow read-fs, mount-readonly and
similar capabilities.
2019-08-12 15:39:09 +02:00
Mahmood Ali
4f7bd68f5c Add ACL capabilities for nomad exec
This adds `alloc-exec` capability to allow operator to execute command into a
running task.  Furthermore, it adds `alloc-node-exec` capability, required when
the alloc task is raw_exec or a driver with no FSIsolation.
2019-04-30 14:02:16 -04:00
Danielle Tomlinson
e613da5442 acl: Add alloc-lifecycle namespace capability
This capability will gate access to features that allow interacting with
a running allocation, for example, signalling, stopping, and rescheduling
specific allocations.
2019-04-01 11:35:09 +02:00
Danielle Tomlinson
4e59d473f7 fixup: Code Review 2018-12-12 12:43:16 +01:00
Danielle Tomlinson
db635bf811 fixup: Correctly sort based on distance, use iradix for ordering 2018-12-11 17:35:51 +01:00
Danielle Tomlinson
36d1045e7f acl: Add support for globbing namespaces
This commit adds basic support for globbing namespaces in acl
definitions.

For concrete definitions, we merge all of the defined policies at load time, and
perform a simple lookup later on. If an exact match of a concrete
definition is found, we do not attempt to resolve globs.

For glob definitions, we merge definitions of exact replicas of a glob.

When loading a policy for a glob defintion, we choose the glob that has
the closest match to the namespace we are resolving for. We define the
closest match as the one with the _smallest character difference_
between the glob and the namespace we are matching.
2018-12-11 16:33:19 +01:00
Chelsea Holland Komlo
b50a3f8e6d fixup from code review 2017-10-17 17:34:06 -04:00
Chelsea Holland Komlo
7453b2c8ff update error message for invalid policy 2017-10-17 12:21:38 -04:00
Chelsea Holland Komlo
429586d703 policy must specify at least one namespace 2017-10-17 12:12:54 -04:00
Alex Dadgar
f6fbb36054 sync 2017-10-13 14:36:02 -07:00
Chelsea Komlo
bb8ce73cc7 Merge pull request #3290 from hashicorp/f-acl-job-dispatch
Add ACL for dispatch job
2017-10-06 13:33:21 -04:00
Chelsea Holland Komlo
bc11fcc012 fix up policy test 2017-09-29 21:22:36 +00:00
Chelsea Holland Komlo
5a738d28af job dispatch should have dispatch policy 2017-09-28 14:28:28 +00:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar
ddc2efa4ac sync 2017-09-19 10:08:23 -05:00
Alex Dadgar
de870afdd5 sync acls 2017-09-13 11:38:29 -07:00
Armon Dadgar
9b6144d0d6 Moving shared ACL objects 2017-09-04 13:04:45 -07:00
Armon Dadgar
c81bafec16 acl: Adding IsManagement check 2017-09-04 13:04:45 -07:00
Armon Dadgar
10baacd1ce Addressing @dadgar review feedback 2017-09-04 13:03:15 -07:00
Armon Dadgar
42cee0e52a acl: adding validation to the namespace name 2017-09-04 13:03:14 -07:00
Armon Dadgar
4def929827 acl: Adding compiled ACL object 2017-09-04 13:03:14 -07:00
Armon Dadgar
39fa8c5563 acl: Adding policy parsing with tests 2017-09-04 13:03:14 -07:00