add build file example

This commit is contained in:
xdrm-brackets 2018-11-06 17:17:39 +01:00
parent 6ccc1b006b
commit 8283b2ff04
1 changed files with 57 additions and 4 deletions

View File

@ -17,7 +17,10 @@ author: xdrm-brackets
----
### I. Build Format
Your whole setup remains in 1 only build file. Each line contains one instruction, the list of instructions is listed below.
@ -50,7 +53,7 @@ This instruction allow you to update configuration files without the need of an
```
cnf <expr> <content>
```
Update a configuration file where \<expr\> is a dot-separated human-readable [path expression](#ii-path-expressions) and \<content\> is a string or a file. If a string is given, it will override/add the field ; if a file is given the configuration file will be replaced by it.
Update a configuration file where \<expr\> is a dot-separated human-readable [path expression](#ii-path-expressions) and \<content\> is a string or a file. If a string is given, it will <u>override/add the field</u> ; if a file is given the configuration file will be <u>replaced</u> by it.
```
@ -59,6 +62,8 @@ cnf <expr>
Remove a configuration field matching the \<expr\> path.
#### 4) service management
These instructions allow you to interact with the service system (_cf. systemd_).
@ -70,14 +75,62 @@ Perform the action on services. If more than one, use spaces to separate service
#### 5) custom scripts
These instructions allow you to use custom scripts for complex operations.
```
run <script>
```
Execute the \<script\> file.
----
### II. Path Expressions
The syntax is pretty fast-forward, it uses 3 levels to find your configuration line : `subject@alt.field`.
| Field | Description | Example |
| --------- | ------------------------------------ | -------------------------- |
| `subject` | The name of the program to configure | `sshd`, `httpd`, `nginx` |
| --------- | :----------------------------------- | -------------------------- |
| `subject` | The name of the program to configure. Available program names are listed in this [table](tablefile). | `sshd`, `httpd`, `nginx` |
| `alt` | Alternative file if there is more than one for a package. If **omitted** it will default to the _main_ configuration file. | `httpd@main`, `http@ports` |
| `field` | Field is a dot-separated chain of strings that match with a configuration field. If **ommited**, the \<value\> will just be added at the end of the configuration file. In the same way if the field does not point to a raw field but a parent or group containing fields, the \<value\> will be added at the end. | `sshd.AllowGroups`, `nginx.http.gzip` |
| `field` | Field is a dot-separated chain of strings that match with a configuration field. If **omitted**, the \<value\> will just be added at the end of the configuration file. In the same way if the field does not point to a raw field but a parent or group containing fields, the \<value\> will be added at the end. | `sshd.AllowGroups`, `nginx.http.gzip` |
----
## Example
_myserver.build_
```
sys name ubuntu #
sys version 18.4 # required to choose which package-manager to use
sys arch amd64 #
upd
ins nginx ssh sslh
cnf nginx.http.gzip on
ser enable nginx
ser start nginx
cnf sshd.PermitRootLogin no
cnf sshd.PermitEmptyPasswords no
cnf sshd.StrictModes yes
cnf sshd.Port 22
ser enable sshd
ser enable ssh
cnf sslh.RUN yes
cnf sslh.DEAMON_OPTS "--user sslh --listen 0.0.0.0:443 --ssh 127.0.0.1:22 --ssl 127.0.0.1:44300 --pidfile /var/run/sslh/sslh.pid"
ser enable sslh
ser start sslh
```