Skip to content

Commit b541ebf

Browse files
committed
Fixed README
1 parent 1ee695e commit b541ebf

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
# deploy-freenas
1+
# deploy-freenas.sh
22

3-
deploy-freenas.py is a Python script to deploy TLS certificates to a FreeNAS server using the FreeNAS API. This should ensure that the certificate data is properly stored in the configuration database, and that all appropriate services use this certificate. It's intended to be called from a Let's Encrypt client like [acme.sh](https://github.com/Neilpang/acme.sh) after the certificate is issued, so that the entire process of issuance (or renewal) and deployment can be automated.
3+
deploy-freenas.sh is a shell script to deploy TLS certificates to a FreeNAS server using the FreeNAS API. This should ensure that the certificate data is properly stored in the configuration database, and that all appropriate services use this certificate. It's intended to be called from a Let's Encrypt client like [acme.sh](https://github.com/Neilpang/acme.sh) after the certificate is issued, so that the entire process of issuance (or renewal) and deployment can be automated.
4+
5+
This project was remade from project deploy-freenas.py by danb35 due to the impossibility of using Python in the closed structure of the OPNsense system.
46

57
# Installation
6-
This script can run on any machine running Python 3 that has network access to your FreeNAS server, but in most cases it's best to run it directly on the FreeNAS box. Change to a convenient directory and run `git clone https://github.com/danb35/deploy-freenas`.
8+
This script can run on any machine running Bourne shell (all *nix systems, macOS; for Windows you need to install additional package, like [CygWin](https://www.cygwin.com/)) that has network access to your FreeNAS server, but in most cases it's best to run it directly on the FreeNAS box. Change to a convenient directory and run `git clone https://github.com/Limych/deploy-freenas`
79

810
# Usage
911

12+
There are now two ways to usage of this script:
13+
14+
## Usage as independent script
15+
1016
The relevant configuration takes place in the `deploy_config` file. You can create this file either by copying `depoy_config.example` from this repository, or directly using your preferred text editor. Its format is as follows:
1117

1218
```
@@ -23,10 +29,21 @@ port = 443
2329

2430
Everything but the password is optional, and the defaults are documented in `depoy_config.example`.
2531

26-
Once you've prepared `deploy_config`, you can run `deploy_freenas.py`. The intended use is that it would be called by your ACME client after issuing a certificate. With acme.sh, for example, you'd add `--deploy-hook "/path/to/deploy_freenas.py"` to your command.
32+
Once you've prepared `deploy_config`, you can run `deploy_freenas.sh`. The intended use is that it would be called by your ACME client after issuing a certificate. With acme.sh, for example, you'd add `--deploy-hook "/path/to/deploy_freenas.sh"` to your command.
2733

28-
There is an optional paramter, `-c` or `--config`, that lets you specify the path to your configuration file. By default the script will try to use `deploy_config` in the script working directoy:
34+
There is an optional parameter, `-c` or `--config`, that lets you specify the path to your configuration file. By default the script will try to use `deploy_config` in the script working directoy:
2935

3036
```
31-
/path/to/deploy_freenas.py --config /somewhere/else/deploy_config
37+
/path/to/deploy_freenas.sh --config /somewhere/else/deploy_config
38+
```
39+
40+
## Usage as part of acme.sh
41+
42+
Install deployer to existing acme.sh installation by `install2acme.sh` script.
43+
44+
Then you can deploy certificates like with other [deploy hooks](https://github.com/Neilpang/acme.sh/wiki/deployhooks):
45+
```bash
46+
export FREENAS_PASSWORD="xxxxxxx" # Required
47+
export FREENAS_HOST="http://localhost:80" # Optional
48+
acme.sh --deploy -d example.com --deploy-hook freenas
3249
```

deploy_freenas.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ _parse_ini() {
7272

7373

7474
# Parse configuration file
75-
CONFIG=$(_locate deploy_config ${WDIR}/../.. ${WDIR})
75+
CONFIG="${WDIR}/deploy_config"
7676

77-
if [ -z "$CONFIG" ]; then _err "ERROR: Can't locate deploy_config!"; exit 1; fi
77+
if [ -r "$CONFIG" ]; then _err "ERROR: Can't load deploy_config!"; exit 1; fi
7878

7979
eval $(_parse_ini ${CONFIG})
8080

File renamed without changes.

util/opnsense/actions_deploy_freenas.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[cron-freenas-deploy]
2-
command:/root/deploy-freenas/deploy-freenas.py
2+
command:/root/deploy-freenas/deploy-freenas.sh
33
parameters:
44
type:script
55
message:Deploy TLS cert to FreeNAS

0 commit comments

Comments
 (0)