Skip to content

Commit 2a462b6

Browse files
Merge pull request #110 from ansasaki/consolidate_policy_tool
Add proposal for policy generation tools consolidation
2 parents 9578111 + a88fdc7 commit 2a462b6

File tree

1 file changed

+346
-0
lines changed

1 file changed

+346
-0
lines changed

109-consolidate_policy_tools.md

+346
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,346 @@
1+
<!--
2+
**Note:** When your enhancement is complete, all of these comment blocks should be removed.
3+
4+
To get started with this template:
5+
6+
- [ ] **Create an issue in keylime/enhancements**
7+
When filing an enhancement tracking issue, please ensure to complete all
8+
fields in that template. One of the fields asks for a link to the enhancement. You
9+
can leave that blank until this enhancement is made a pull request, and then
10+
go back to the enhancement and add the link.
11+
- [ ] **Make a copy of this template.**
12+
name it `NNNN-short-descriptive-title`, where `NNNN` is the issue number (with no
13+
leading-zero padding) assigned to your enhancement above.
14+
- [ ] **Fill out this file as best you can.**
15+
At minimum, you should fill in the "Summary", and "Motivation" sections.
16+
These should be easy if you've preflighted the idea of the enhancement with the
17+
appropriate SIG(s).
18+
- [ ] **Merge early and iterate.**
19+
Avoid getting hung up on specific details and instead aim to get the goals of
20+
the enhancement clarified and merged quickly. The best way to do this is to just
21+
start with the high-level sections and fill out details incrementally in
22+
subsequent PRs.
23+
-->
24+
# enhancement-109: Consolidate policy generation tools
25+
26+
<!--
27+
This is the title of your enhancement. Keep it short, simple, and descriptive. A good
28+
title can help communicate what the enhancement is and should be considered as part of
29+
any review.
30+
-->
31+
32+
<!--
33+
A table of contents is helpful for quickly jumping to sections of a enhancement and for
34+
highlighting any additional information provided beyond the standard enhancement
35+
template.
36+
-->
37+
38+
<!-- toc -->
39+
- [Release Signoff Checklist](#release-signoff-checklist)
40+
- [Summary](#summary)
41+
- [Motivation](#motivation)
42+
- [Goals](#goals)
43+
- [Non-Goals](#non-goals)
44+
- [Proposal](#proposal)
45+
- [User Stories (optional)](#user-stories-optional)
46+
- [Story 1](#story-1)
47+
- [Story 2](#story-2)
48+
- [Notes/Constraints/Caveats (optional)](#notesconstraintscaveats-optional)
49+
- [Risks and Mitigations](#risks-and-mitigations)
50+
- [Design Details](#design-details)
51+
- [Test Plan](#test-plan)
52+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
53+
- [Drawbacks](#drawbacks)
54+
- [Alternatives](#alternatives)
55+
- [Infrastructure Needed (optional)](#infrastructure-needed-optional)
56+
<!-- /toc -->
57+
58+
## Release Signoff Checklist
59+
60+
<!--
61+
**ACTION REQUIRED:** In order to merge code into a release, there must be an
62+
issue in [keylime/enhancements] referencing this enhancement and targeting a release**.
63+
64+
For enhancements that make changes to code or processes/procedures in core
65+
Keylime i.e., [keylime/keylime], we require the following Release
66+
Signoff checklist to be completed.
67+
68+
Check these off as they are completed for the Release Team to track. These
69+
checklist items _must_ be updated for the enhancement to be released.
70+
-->
71+
72+
- [ ] Enhancement issue in release milestone, which links to pull request in [keylime/enhancements]
73+
- [ ] Core members have approved the issue with the label `implementable`
74+
- [ ] Design details are appropriately documented
75+
- [ ] Test plan is in place
76+
- [ ] User-facing documentation has been created in [keylime/keylime-docs]
77+
78+
<!--
79+
**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone.
80+
-->
81+
82+
## Summary
83+
84+
<!--
85+
This section is incredibly important for producing high quality user-focused
86+
documentation such as release notes or a development roadmap. It should be
87+
possible to collect this information before implementation begins in order to
88+
avoid requiring implementers to split their attention between writing release
89+
notes and implementing the feature itself. Reviewers
90+
should help to ensure that the tone and content of the `Summary` section is
91+
useful for a wide audience.
92+
93+
A good summary is probably at least a paragraph in length.
94+
-->
95+
96+
Keylime provides multiple policy generation and editting tools with separate
97+
functionalities located in different parts of the repository:
98+
99+
* `scripts/create_runtime_policy.sh`
100+
* A shell script that measures all the files in the filesystem to generate a
101+
runtime policy as an allowlist
102+
* `keylime/cmd/convert_runtime_policy.py`
103+
* Converts a runtime policy from the legacy format (i.e. allowlist and excludelists)
104+
to the unified JSON format
105+
* `keylime/cmd/create_policy.py`
106+
* The main tool to create an manipulate policies in the unified JSON format.
107+
* `keylime/cmd/sign_runtime_policy.py`
108+
* Signs a runtime policy, generating a signed policy in the Dead Simple
109+
Signing Envelope (DSSE) format
110+
111+
These scripts are not fit for usage in production environment:
112+
113+
* There is no consistency in their user interface
114+
* There is not enough documentation on their usage
115+
* Each script provides a different functionality, although all scripts are used
116+
for policy creation and editing
117+
* They are not located in a consistent location in the repository
118+
119+
The goal of this enhancement is to provide a single tool consolidating all the
120+
existing functionality from the scripts above adding consistent interface and
121+
documentation
122+
123+
## Motivation
124+
125+
<!--
126+
This section is for explicitly listing the motivation, goals and non-goals of
127+
this enhancement. Describe why the change is important and the benefits to users.
128+
-->
129+
130+
Creating the attestation policies is a requirement for the deployment of
131+
keylime, but the existing scripts are difficult to use. The main goal is to
132+
lower the difficulty of creating and editing policies.
133+
134+
### Goals
135+
136+
<!--
137+
List the specific goals of the enhancement. What is it trying to achieve? How will we
138+
know that this has succeeded?
139+
-->
140+
141+
* Consolidate all the policy generation and editing tools provided in the
142+
repository in a single tool
143+
* Provide a consistent user interface for all the functionalities
144+
* Provide documentation for the policy generation tool
145+
146+
### Non-Goals
147+
148+
<!--
149+
What is out of scope for this enhancement? Listing non-goals helps to focus discussion
150+
and make progress.
151+
-->
152+
153+
* Adding new functionalities to the consolidated policy generation tool is out
154+
of scope. The goal of this enhancement is only to consolidate the existing
155+
tools.
156+
157+
## Proposal
158+
159+
<!--
160+
This is where we get down to the specifics of what the proposal actually is.
161+
This should have enough detail that reviewers can understand exactly what
162+
you're proposing, but should not include things like API designs or
163+
implementation. The "Design Details" section below is for the real
164+
nitty-gritty.
165+
-->
166+
167+
The proposal is to create a single tool that will provide the functionality of
168+
the existing scripts. The necessary steps would be:
169+
170+
* Design a consistent interface for the consolidated tool
171+
* Move all the functionality from the existing scripts into the new created tool
172+
following the interface design
173+
174+
### User Stories (optional)
175+
176+
<!--
177+
Detail the things that people will be able to do if this enhancement is implemented.
178+
Include as much detail as possible so that people can understand the "how" of
179+
the system. The goal here is to make this feel real for users without getting
180+
bogged down.
181+
-->
182+
183+
#### Story 1
184+
185+
* The user consults the policy generation tool documentation
186+
* The user executes the policy generation tool to create a new policy file
187+
based on the measurements of the files in the file system
188+
* Using the same tool, the user can combine an allowlist and an excludelist to
189+
generate a new policy
190+
* Using the same tool, the user can sign the generated policy using a private
191+
key
192+
193+
### Notes/Constraints/Caveats (optional)
194+
195+
<!--
196+
What are the caveats to the proposal?
197+
What are some important details that didn't come across above.
198+
Go in to as much detail as necessary here.
199+
This might be a good place to talk about core concepts and how they relate.
200+
-->
201+
202+
If some functionality is considered insecure, useless, or the implementation is
203+
not possible, it can be excluded from the consolidated tool after obtaining
204+
approval from the community.
205+
206+
### Risks and Mitigations
207+
208+
<!--
209+
What are the risks of this proposal and how do we mitigate. Think broadly.
210+
For example, consider both security and how this will impact the larger
211+
enhancement ecosystem.
212+
213+
How will security be reviewed and by whom?
214+
-->
215+
216+
The existing tools should be kept for a grace period alongside the new tool.
217+
218+
## Design Details
219+
220+
<!--
221+
This section should contain enough information that the specifics of your
222+
change are understandable. This may include API specs (though not always
223+
required) or even code snippets. If there's any ambiguity about HOW your
224+
proposal will be implemented, this is the place to discuss them.
225+
-->
226+
227+
The interface of the new consolidated policy generation tool should be
228+
consistent, intuitive, and organized, meaning:
229+
230+
* Use subcommands to separate functionalities
231+
* Use commonly used options for their usual purpose:
232+
* For example, `--help` or `-h` for help, `-o` for output, etc.
233+
* Similar parameters of different subcommands should be passed using similar options
234+
* For example, 2 subcommands that receive a key as input could use the same
235+
`--key` option or `-k` as short
236+
* Provide sane default values for optional parameters
237+
238+
The documentation should cover all the subcommands and options:
239+
240+
* With helpful error messages, which may indicate next steps or clarify missing
241+
information
242+
* Ideally, with both concise and long versions
243+
* For example, a concise usage explanation with `--help` and a long usage
244+
explanation in manpages
245+
246+
A suggestion for the consolidation of the functionalities:
247+
248+
* Rewrite the functionality provided by `scripts/create_runtime_policy.sh` in python
249+
* Move all the functionalities from the various scripts to the consolidated
250+
tool.
251+
252+
The output of the consolidated tool must be compatible with the current
253+
components code and should not require any change to the components.
254+
255+
Additional usability improvements can be added to the tool, such as:
256+
257+
* Autocompleting of commands and/or options
258+
* Possibility to provide machine-friendly input
259+
* For example, accepting the options setting via a JSON input
260+
* Multiple levels of verbosity for the output
261+
262+
### Test Plan
263+
264+
<!--
265+
**Note:** *Not required until targeted at a release.*
266+
267+
Consider the following in developing a test plan for this enhancement:
268+
- Will there be e2e and integration tests, in addition to unit tests?
269+
- How will it be tested in isolation vs with other components?
270+
271+
No need to outline all of the test cases, just the general strategy. Anything
272+
that would count as tricky in the implementation and anything particularly
273+
challenging to test should be called out.
274+
275+
All code is expected to have adequate tests (eventually with coverage
276+
expectations).
277+
-->
278+
279+
The code should be covered by unit tests included as part of the repository code
280+
and additional end-to-end tests added to the CI test suite (in
281+
https://github.com/RedHat-SP-Security/keylime-tests)
282+
283+
### Upgrade / Downgrade Strategy
284+
285+
<!--
286+
If applicable, how will the component be upgraded and downgraded? Make sure
287+
this is in the test plan.
288+
289+
Consider the following in developing an upgrade/downgrade strategy for this enhancement
290+
-->
291+
292+
This enhancement should not affect components upgrading or downgrading as the
293+
intended use case is orthogonal to the components functionality.
294+
295+
### Dependencie requirements
296+
297+
<!--
298+
If your new change requires new dependencies, please outline and demonstrate that your selected dependency
299+
is well maintained and packaged in Keylime's supported Operating Systems (currently Debian Stable
300+
and as of time writing Fedora 32/33).
301+
302+
During code implementation you will also be expected to add the package to CI , the keylime ansible role and
303+
keylimes main installer (`keylime/installers.sh`).
304+
305+
If the package is not available in the supported Operated systems, the PR will not be merged into master.
306+
307+
Adding the package in `requirements.txt` is not sufficent for master which is where we tag releases from.
308+
309+
You may however be able to work within an experimental branch until a package is made available. If this is
310+
the case, please outline it in this enhancement.
311+
312+
-->
313+
314+
The addition of new dependencies should be minimized, and when needed, the
315+
addition should be properly justified and approved by the maintainers.
316+
317+
## Drawbacks
318+
319+
<!--
320+
Why should this enhancement _not_ be implemented?
321+
-->
322+
323+
No drawbacks were identified as during the grace period nothing would be removed
324+
from the repository
325+
326+
## Alternatives
327+
328+
<!--
329+
What other approaches did you consider and why did you rule them out? These do
330+
not need to be as detailed as the proposal, but should include enough
331+
information to express the idea and why it was not acceptable.
332+
-->
333+
334+
The alternative is to continue use the existing tools, with the option to try to
335+
improve their usability individually. The downside of this alternative is that
336+
the problem of having multiple tools with similar purpose will continue to
337+
affect the users.
338+
339+
## Infrastructure Needed (optional)
340+
341+
<!--
342+
Use this section if you need things infrastructure related specific to your enhancement. Examples include a
343+
new subproject, repos requested, github webhook, changes to CI (travis).
344+
-->
345+
346+
No additional infrastructure should be needed.

0 commit comments

Comments
 (0)