Skip to content

Commit 12ad980

Browse files
authored
Merge pull request #2650 from olehermanse/module_dev
Getting started: Updated versions of cf-remote and cfbs and changed which modules to show
2 parents 8c8f164 + 57349a9 commit 12ad980

File tree

3 files changed

+33
-41
lines changed

3 files changed

+33
-41
lines changed

guide/getting-started-with-cfengine-build/installation.markdown

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ Importantly, you need the command line tools working after you've installed them
110110

111111
```
112112
$ cfbs --version
113-
cfbs 1.2.1
113+
cfbs 1.3.3
114114
$ cf-remote --version
115-
cf-remote version 0.3.9
115+
cf-remote version 0.3.13
116116
Available CFEngine versions:
117117
master, 3.19.0, 3.18.x, 3.18.1, 3.18.0, 3.15.x, 3.15.5, 3.15.4, 3.15.3, 3.15.2, 3.15.1, 3.15.0, 3.15.0b1
118118
```
@@ -167,11 +167,7 @@ The host is now in a `cf-remote` group called `hub`, so we don't have to type th
167167

168168
```
169169
$ cf-remote info -H hub
170-
```
171-
172-
Shows this output:
173170
174-
```
175171
176172
OS : ubuntu (debian)
177173
Architecture : x86_64
@@ -188,6 +184,8 @@ From your development machine, use `cf-remote` to install CFEngine on the Linux
188184
$ cf-remote install --hub hub --bootstrap hub
189185
```
190186

187+
CFEngine is now installed and running on your hub, including the Web UI, the reporting database, and the components responsible for making changes to your system, serving and fetching policy, etc.
188+
191189
## Open the CFEngine Web UI
192190

193191
Open the CFEngine Web UI in a web browser by clicking this link, or typing the appropriate IP in the address bar:

guide/getting-started-with-cfengine-build/modules-from-cfengine-build.markdown

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,44 @@ For the purposes of this tutorial, let's add the git module so we can work with
4444
$ cfbs add git
4545
```
4646

47-
Additionally, let's add a compliance report:
47+
Additionally, let's add a module to make CFEngine run policy and report collection every minute instead of the default 5 minute interval:
4848

4949
```
50-
$ cfbs add compliance-report-os-is-vendor-supported
50+
$ cfbs add every-minute
5151
```
5252

53-
This will add a report to Mission Portal, highlighting any hosts which are not running supported operating systems.
54-
55-
Finally, let's add another module which gives us some interesting reporting (inventory) data:
53+
Finally, let's add a report for whether the OS is supported by the OS vendor:
5654

5755
```
58-
$ cfbs add inventory-sudoers
56+
$ cfbs add compliance-report-os-is-vendor-supported
5957
```
6058

61-
This module checks which users have access to use sudo, and makes this reporting data available in Mission Portal.
62-
6359
## Step 2: Build
6460

6561
Once we are done adding modules, it is time to build them, combining it all into the policy set which will be deployed to our hub:
6662

6763
```
6864
$ cfbs build
69-
```
7065
71-
The output from this command shows a lot of what happened:
72-
73-
```
7466
Modules:
7567
001 masterfiles @ f3a8f65e77428a6ab9d62c34057a7ace6ae54ce9 (Downloaded)
7668
002 library-for-promise-types-in-python @ c3b7329b240cf7ad062a0a64ee8b607af2cb912a (Downloaded)
7769
003 promise-type-git @ c3b7329b240cf7ad062a0a64ee8b607af2cb912a (Downloaded)
78-
004 compliance-report-imports @ 9d4a1cb1f919454a49baf22469ebc0b1606ae904 (Downloaded)
79-
005 autorun @ c3b7329b240cf7ad062a0a64ee8b607af2cb912a (Downloaded)
80-
006 compliance-report-os-is-vendor-supported @ d9e0aad225535b2b16ba2126e8302f8ffc5e7d38 (Downloaded)
81-
007 inventory-sudoers @ ba9768f0e09914e41dae95fbf81caed90c1e6ed4 (Downloaded)
70+
004 every-minute @ 05bf5e5b1c014018a7b93a524e035c1a21bcffa4 (Downloaded)
71+
005 compliance-report-imports @ 9d4a1cb1f919454a49baf22469ebc0b1606ae904 (Downloaded)
72+
006 autorun @ c3b7329b240cf7ad062a0a64ee8b607af2cb912a (Downloaded)
73+
007 compliance-report-os-is-vendor-supported @ d9e0aad225535b2b16ba2126e8302f8ffc5e7d38 (Downloaded)
8274
8375
Steps:
8476
001 masterfiles : run './prepare.sh -y'
8577
001 masterfiles : copy './' 'masterfiles/'
8678
002 library-for-promise-types-in-python : copy 'cfengine.py' 'masterfiles/modules/promises/'
8779
003 promise-type-git : copy 'git.py' 'masterfiles/modules/promises/'
8880
003 promise-type-git : append 'enable.cf' 'masterfiles/services/init.cf'
89-
004 compliance-report-imports : copy './compliance-report-imports.cf' 'masterfiles/services/autorun/'
90-
005 autorun : json 'def.json' 'masterfiles/def.json'
91-
006 compliance-report-os-is-vendor-supported : copy './os-is-vendor-supported.json' 'masterfiles/.no-distrib/compliance-report-definitions/os-is-vendor-supported.json'
92-
007 inventory-sudoers : copy './policy/main.cf' 'masterfiles/services/inventory-sudoers/main.cf'
93-
007 inventory-sudoers : json './cfbs/def.json' 'masterfiles/def.json'
81+
004 every-minute : json 'def.json' 'masterfiles/def.json'
82+
005 compliance-report-imports : copy './compliance-report-imports.cf' 'masterfiles/services/autorun/'
83+
006 autorun : json 'def.json' 'masterfiles/def.json'
84+
007 compliance-report-os-is-vendor-supported : copy './os-is-vendor-supported.json' 'masterfiles/.no-distrib/compliance-report-definitions/os-is-vendor-supported.json'
9485
9586
Generating tarball...
9687
@@ -133,30 +124,25 @@ https://192.168.56.2/
133124

134125
(Log in with username `admin` and password `admin`, or whatever you changed it to when you first logged into your hub).
135126

136-
You can open an inventory report by clicking _Reports_ in the left navigation bar, and then _Inventory_.
137-
Inside the report you can add a new column with the data from our `inventory-sudoers` module, it shows up as _Users with sudo_:
138-
139-
![](inventory-sudoers.gif)
140-
141-
(Reports in CFEngine Mission Portal can be saved as PDF or CSV or scheduled to be sent to your email periodically).
142-
143127
By clicking on _Reports_ and _Compliance_ we can see the report we added, _OS is vendor supported_:
144128

145129
![](os-is-vendor-supported.gif)
146130

131+
(Reports in CFEngine Mission Portal can be saved as PDF or CSV or scheduled to be sent to your email periodically).
132+
147133
## What's next
148134

149135
Now that you've successfully added modules and seen the results in Mission Portal, you're ready to look for more modules, or explore Mission Portal further.
150136
Here are some examples of modules you might be interested in:
151137

152138
* [Scan and report on potentially vulnerable log4j installations](https://build.cfengine.com/modules/cve-2021-44228-log4j/)
153-
* [Make policy fetching, evaluation, and reporting happen every minute](https://build.cfengine.com/modules/every-minute/)
139+
* [Inventory (reporting) data of who can use sudo on each host](https://build.cfengine.com/modules/inventory-sudoers/)
154140
* [Promise type to perform HTTP requests](https://build.cfengine.com/modules/promise-type-http/)
155141

156142
To add more modules, just repeat the commands from steps 1-3, for example:
157143

158144
```
159-
$ cfbs add every-minute
145+
$ cfbs add inventory-sudoers
160146
$ cfbs build
161147
$ cf-remote deploy
162148
```

guide/getting-started-with-cfengine-build/writing-policy.markdown

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,23 @@ [email protected]: 'cat /tmp/hello' -> 'Hello, world!'
8181

8282
## Running the agent
8383

84-
The agent, an executable called `cf-agent`, is the component which reads your policy files and makes changes to your systems.
85-
When we ran the deploy command, the agent was ran automatically, but you can also run it manually.
86-
For example, you can test that your policy works:
84+
In CFEngine, the program which runs all your policy / modules and makes changes to the system is called `cf-agent`, or _the agent_.
85+
Just like above, we can use `cf-remote sudo` to run the agent on the hub:
8786

8887
```
89-
$ cf-remote sudo -H hub "rm /tmp/hello && /var/cfengine/bin/cf-agent -KI"
88+
$ cf-remote sudo -H hub "cf-agent --no-lock --info"
9089
```
9190

92-
`rm /tmp/hello` deletes the file, causing the agent to recreate it.
91+
When experimenting with modules, policy, and making changes, knowing how to perform an agent run to speed things up or get feedback from what your policy is doing can be useful.
92+
This is similar to triggering an agent run with the buttons in Mission Portal, or logging in with `ssh` and running `cf-agent --no-lock --info` from the command prompt.
93+
94+
**Tip:** `cf-agent --no-lock --info` can also be written using short options; `cf-agent -KI`.
95+
96+
To test that our policy works, let's delete the `/tmp/hello` file and watch CFEngine create it:
97+
98+
```
99+
$ cf-remote sudo -H hub "rm /tmp/hello && cf-agent -KI"
100+
```
93101

94102
## Git promises
95103

0 commit comments

Comments
 (0)