All Projects → danb35 → deploy-freenas

danb35 / deploy-freenas

Licence: GPL-3.0 license
Python script to automate deploying TLS certificates to FreeNAS servers

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to deploy-freenas

FreeNas-DiskList
FreeNas "Disklist" script for report informations about installed hard drives, volumes and partitions
Stars: ✭ 34 (-79.27%)
Mutual labels:  freenas, freenas-scripts
jailman
Automated iocage Jail manager for FreeNAS
Stars: ✭ 26 (-84.15%)
Mutual labels:  freenas, freenas-scripts
utility-scripts-for-freenas-and-vmware-esxi
All-In-One utility scripts for FreeNAS and VMware ESXi
Stars: ✭ 59 (-64.02%)
Mutual labels:  freenas, freenas-scripts
Middleware
TrueNAS CORE/Enterprise/SCALE Middleware Git Repository
Stars: ✭ 1,851 (+1028.66%)
Mutual labels:  freenas
freenas-proxmox
ZFS over iSCSI to FreeNAS API's from Proxmox VE
Stars: ✭ 129 (-21.34%)
Mutual labels:  freenas
hass-truenas
TrueNAS integration for Home Assistant
Stars: ✭ 33 (-79.88%)
Mutual labels:  freenas
freenas-iscsi-provisioner
FreeNAS iscsi provisioner
Stars: ✭ 30 (-81.71%)
Mutual labels:  freenas
truenas-iocage-rslsync
Script to install Resilio Sync in an iocage jail.
Stars: ✭ 17 (-89.63%)
Mutual labels:  freenas-scripts

deploy-freenas

deploy-freenas.py is a Python script to deploy TLS certificates to a FreeNAS/TrueNAS (Core) server using the FreeNAS/TrueNAS API. This should ensure that the certificate data is properly stored in the configuration database, and that all appropriate services use this certificate. Its original intent was to be called from a Let's Encrypt client like acme.sh after the certificate is issued, so that the entire process of issuance (or renewal) and deployment can be automated. However, it can be used with certificates from any source, whether a different ACME-based certificate authority or otherwise.

Installation

This script can run on any machine running Python 3 that has network access to your FreeNAS/TrueNAS server, but in most cases it's best to run it directly on the FreeNAS/TrueNAS box. Change to a convenient directory and run git clone https://github.com/danb35/deploy-freenas.

If you're not running this script on your Free/TrueNAS server itself, you'll need to make sure that the Python requests module is available (it's there by default in Free/TrueNAS). How you'll do that will depend on the OS you're using wherever you're running the script.

Usage

The relevant configuration takes place in the deploy_config file. You can create this file either by copying deploy_config.example from this repository, or directly using your preferred text editor. Its format is as follows:

[deploy]
password = YourReallySecureRootPassword
cert_fqdn = foo.bar.baz
connect_host = baz.bar.foo
verify = false
privkey_path = /some/other/path
fullchain_path = /some/other/other/path
protocol = https://
port = 443
ui_certificate_enabled = false
s3_enabled = false
ftp_enabled = false
webdav_enabled = false
apps_enabled = false
apps_only_matching_san = false
cert_base_name = letsencrypt

Everything but password (or api_key) is optional, and the defaults are documented in deploy_config.example.

On TrueNAS (Core) 12.0 and up you should use API key authentication instead of password authentication. Generate a new API token in the UI first, then add it as api_key to the config, which replaces the password field:

api_key = 1-DXcZ19sZoZFdGATIidJ8vMP6dxk3nHWz3XX876oxS7FospAGMQjkOft0h4itJDSP

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 --reloadcmd "/path/to/deploy_freenas.py" to your command.

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:

/path/to/deploy_freenas.py --config /somewhere/else/deploy_config
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].