192 |
- |
1 |
Easy-RSA 3 Hacking Guide
|
|
|
2 |
===
|
|
|
3 |
|
|
|
4 |
This document is aimed at programmers looking to improve on the existing
|
|
|
5 |
codebase.
|
|
|
6 |
|
|
|
7 |
Compatibility
|
|
|
8 |
---
|
|
|
9 |
|
|
|
10 |
The `easyrsa` code is written in POSIX shell (and any cases where it is not is
|
|
|
11 |
considered a bug to be fixed.) The only exceptions are the `local` keyword and
|
|
|
12 |
the construct `export FOO=baz`, both well-supported.
|
|
|
13 |
|
|
|
14 |
As such, modifications to the code should also be POSIX; platform-specific code
|
|
|
15 |
should be placed under the `distro/` dir and listed by target platform.
|
|
|
16 |
|
|
|
17 |
Coding conventions
|
|
|
18 |
---
|
|
|
19 |
|
|
|
20 |
While there aren't strict syntax standards associated with the project, please
|
|
|
21 |
follow the existing format and flow when possible; however, specific exceptions
|
|
|
22 |
can be made if there is a significant reason or benefit.
|
|
|
23 |
|
|
|
24 |
Do try to:
|
|
|
25 |
|
|
|
26 |
* Keep variables locally-scoped when possible
|
|
|
27 |
* Comment sections of code for readability
|
|
|
28 |
* Use the conventions for prefixes on global variables
|
|
|
29 |
* Set editors for tab stops of 8 spaces
|
|
|
30 |
* Use tabs for code indents; use aligned spaces for console text
|
|
|
31 |
|
|
|
32 |
Keeping code, docs, and examples in sync
|
|
|
33 |
---
|
|
|
34 |
|
|
|
35 |
Changes that adjust, add, or remove features should have relevant docs, help
|
|
|
36 |
output, and examples updated at the same time.
|
|
|
37 |
|
|
|
38 |
Release versioning
|
|
|
39 |
---
|
|
|
40 |
|
|
|
41 |
A point-release bump (eg: 3.0 to 3.1) is required when the frontend interface
|
|
|
42 |
changes in a non-backwards compatible way. Always assume someone has an
|
|
|
43 |
automated process that relies on the current functionality for official
|
|
|
44 |
(non-beta, non-rc) releases. A possible exception exists for bugfixes that do
|
|
|
45 |
break backwards-compatibility; caution is to be used in such cases.
|
|
|
46 |
|
|
|
47 |
The addition of a new command may or may not require a point-release depending
|
|
|
48 |
on the significance of the feature; the same holds true for additional optional
|
|
|
49 |
arguments to commands.
|
|
|
50 |
|
|
|
51 |
Project layout
|
|
|
52 |
---
|
|
|
53 |
|
|
|
54 |
The project's files are structured as follows:
|
|
|
55 |
|
|
|
56 |
* `easyrsa3/` is the primary project code. On Linux/Unix-alikes, all the core
|
|
|
57 |
code and supporting files are stored here.
|
|
|
58 |
* `Licensing/` is for license docs.
|
|
|
59 |
* `build/` is for build information and scripts.
|
|
|
60 |
* `contrib/` is for externally-contributed files, such as useful external
|
|
|
61 |
scripts or interfaces for other systems/languages.
|
|
|
62 |
* `distro/` is for distro-specific supporting files, such as the Windows
|
|
|
63 |
frontend wrappers. Code components that are not platform-neutral should go
|
|
|
64 |
here.
|
|
|
65 |
* `doc/` is for documentation. Much of this is in Markdown format which can be
|
|
|
66 |
easily converted to HTML for easy viewing under Windows.
|
|
|
67 |
* `release-keys/` list current and former KeyIDs used to sign release packages
|
|
|
68 |
(not necessarily git tags) available for download.
|
|
|
69 |
* The top-level dir includes files for basic project info and reference
|
|
|
70 |
appropriate locations for more detail.
|
|
|
71 |
|
|
|
72 |
As a brief note, it is actually possible to take just the easyrsa3/ dir and end
|
|
|
73 |
up with a functional project; the remaining structure includes docs, build prep,
|
|
|
74 |
distro-specific wrappers, and contributed files.
|
|
|
75 |
|
|
|
76 |
Git conventions
|
|
|
77 |
---
|
|
|
78 |
|
|
|
79 |
As of Easy-RSA 3, the following git conventions should be used. These are mostly
|
|
|
80 |
useful for people with repo access in order to keep a standard meaning to commit
|
|
|
81 |
messages and merge actions.
|
|
|
82 |
|
|
|
83 |
### Signed-off-by: and related commit message lines
|
|
|
84 |
|
|
|
85 |
Committers with push access should ensure a `Signed-off-by:` line exists at
|
|
|
86 |
the end of the commit message with their name on it. This indicates that the
|
|
|
87 |
committer has reviewed the changes to the commit in question and approve of
|
|
|
88 |
the feature and code in question. It also helps verify the code came from an
|
|
|
89 |
acceptable source that won't cause issues with the license.
|
|
|
90 |
|
|
|
91 |
This can be automatically added by git using `git commit -s`.
|
|
|
92 |
|
|
|
93 |
Additional references can be included as well. If multiple people reviewed the
|
|
|
94 |
change, the committer may add their names in additional `Signed-off-by:`
|
|
|
95 |
lines; do get permission from that person before using their name, however ;)
|
|
|
96 |
|
|
|
97 |
The following references may be useful as well:
|
|
|
98 |
|
|
|
99 |
* `Signed-off-by:` -- discussed above, indicates review of the commit
|
|
|
100 |
* `Author:` -- references an author of a particular feature, in full or
|
|
|
101 |
significant part
|
|
|
102 |
* `Changes-by:` -- indicates the listed party contributed changes or
|
|
|
103 |
modifications to a feature
|
|
|
104 |
* `Acked-by:` -- indicates review of the feature, code, and/or functional
|
|
|
105 |
correctness
|
|
|
106 |
|
|
|
107 |
### Merging from external sources (forks, patches, etc)
|
|
|
108 |
|
|
|
109 |
Contributions can come in many forms: GitHub "pull requests" from cloned
|
|
|
110 |
repos, references to external repos, patches to the ML, or others. Those won't
|
|
|
111 |
necessary have `Signed-off-by:` lines or may contain less info in the commit
|
|
|
112 |
message than is desirable to explain the changes.
|
|
|
113 |
|
|
|
114 |
The committing author to this project should make a merge-commit in this case
|
|
|
115 |
with the appropriate details provided there. If additional code changes are
|
|
|
116 |
necessary, this can be done on a local branch prior to merging back into the
|
|
|
117 |
mainline branch.
|
|
|
118 |
|
|
|
119 |
This merge-commit should list involved contributors with `Author:` or similar
|
|
|
120 |
lines as required. The individual commits involved in a merge also retain the
|
|
|
121 |
original committer; regardless, the merge-commit message should give a clear
|
|
|
122 |
indication of what the entire set of commits does as a whole.
|
|
|
123 |
|
|
|
124 |
### Tagging
|
|
|
125 |
|
|
|
126 |
Tags should follow the convention:
|
|
|
127 |
|
|
|
128 |
vM.m.p
|
|
|
129 |
|
|
|
130 |
where `M` is the major version, `m` is the minor "point-release" version, and
|
|
|
131 |
`p` is the patch-level. Suffixes of `-rc#`, `-beta#`, etc can be added for
|
|
|
132 |
pre-release versions as required.
|
|
|
133 |
|
|
|
134 |
Currently tags are taken from the mainline development branch in question. The
|
|
|
135 |
ChangeLog should thus be updated prior to tagging. Tags should also be
|
|
|
136 |
annotated with an appropriate commit message and signed-off. This can be done
|
|
|
137 |
as shown below (don't use `-s` unless you intend to use GPG with git.)
|
|
|
138 |
|
|
|
139 |
git tag -a v1.2.3
|
|
|
140 |
|
|
|
141 |
Corresponding release downloads can be uploaded to release distribution points
|
|
|
142 |
as required.
|