-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truenas deploy websocket #6108
base: dev
Are you sure you want to change the base?
Truenas deploy websocket #6108
Conversation
deploy/truenas_ws.sh
Outdated
@@ -175,7 +175,7 @@ truenas_ws_deploy() { | |||
then | |||
_err "Error calling system.ready:" | |||
_err "$_ws_response" | |||
exit $_ws_re | |||
exit $_ws_ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please help remove all the exit
. use return
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
deploy/truenas_ws.sh
Outdated
@@ -0,0 +1,293 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not bash. it's sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and tested
`*************************************
**** INSTALLING NEW CERTIFICATES ****
[Mon Nov 25 21:22:37 CET 2024] Checking environment variables...
[Mon Nov 25 21:22:37 CET 2024] Environment variables: OK
[Mon Nov 25 21:22:37 CET 2024] Checking TrueNAS health...
[Mon Nov 25 21:22:37 CET 2024] TrueNAS health: OK
[Mon Nov 25 21:22:37 CET 2024] Gather system info...
[Mon Nov 25 21:22:37 CET 2024] TrueNAS system: SCALE
[Mon Nov 25 21:22:37 CET 2024] TrueNAS version: 24.10.0.2
[Mon Nov 25 21:22:37 CET 2024] Gather current WebUI certificate...
[Mon Nov 25 21:22:37 CET 2024] Current WebUI certificate ID: 183
[Mon Nov 25 21:22:37 CET 2024] Current WebUI certificate name: acme_20241125_201715
[Mon Nov 25 21:22:37 CET 2024] Upload new certificate...
[Mon Nov 25 21:22:37 CET 2024] New WebUI certificate name: acme_20241125_202237
[Mon Nov 25 21:22:52 CET 2024] New certificate ID: 184
[Mon Nov 25 21:22:52 CET 2024] Replace FTP certificate...
[Mon Nov 25 21:22:53 CET 2024] Replace app certificates...
[Mon Nov 25 21:22:54 CET 2024] Checking app vaultwarden...
[Mon Nov 25 21:22:54 CET 2024] App has certificate option, setup new certificate...
[Mon Nov 25 21:22:54 CET 2024] App will be redeployed after updating the certificate.
[Mon Nov 25 21:23:07 CET 2024] App certificate replaced.
[Mon Nov 25 21:23:07 CET 2024] Checking app portainer...
[Mon Nov 25 21:23:07 CET 2024] App has certificate option, setup new certificate...
[Mon Nov 25 21:23:07 CET 2024] App will be redeployed after updating the certificate.
[Mon Nov 25 21:23:11 CET 2024] App certificate replaced.
[Mon Nov 25 21:23:11 CET 2024] Replace WebUI certificate...
[Mon Nov 25 21:23:14 CET 2024] WebUI certificate replaced.
[Mon Nov 25 21:23:14 CET 2024] Restarting WebUI...
[Mon Nov 25 21:23:14 CET 2024] Waiting for UI restart...
[Mon Nov 25 21:23:20 CET 2024] Deleting old certificate...
[Mon Nov 25 21:23:23 CET 2024] Have a nice day...bye!
[Mon Nov 25 21:23:23 CET 2024] Success
`
I have been using acme.sh on my Synology (actually neilpangs image), just moved to Scale genuine question, why would i use this over and above what is already in the UI? |
TrueNAS supports the following ACME providers via the UI: cloudflare, route53, ovh and self-scripted via shell. In my case and many others who do not use any of the providers mentioned above, we have to resort to alternative scripts. My truenas_ws.sh script handles the deployment of a generated certificate into the TrueNAS system. Not only is the certificate for the WebUI exchanged, but also for FTP and the Scale ix Apps. So we go a few steps further here. As a rule, a wildcard certificate from Letscrypt or ZeroSSL is used. This is then easier to assign to each service in TrueNAS. Furthermore, my script for using Websocket is written specifically with the TrueNAS tool midclt. The RestAPI is discontinued from version 25.04. Other features are certainly not implemented by the built-in ACME function in TrueNAS. Something like: exchanging certificates in the Portainer apps, for example. I'm not entirely sure, but the built-in ACME script only exchanges the certificate in the WebUI. I wrote my own script that creates a ZeroSSL wildcard certificate and then stores it in TrueNAS using the truenas_ws.sh deploy hook. I use the provider Hetzner, which is not listed above among the providers mentioned. Furthermore, I not only want to exchange the WebUI certificate, but also other services. I also imagine additional features that can be configured via file. But first everything basic has to work. I hope I understood your question correctly and was able to answer it for you. Greetings |
neat thanks for the clarification, doing other apps on the system (like say portainer) is neat, i have been handling that in my reverse proxy i use internally to put everything https on 443 internally. I will take a look. |
The approach is to use the internal mechanisms. But there are also ixApps that only support http, so a reverse proxy is of course an advantage. I personally only use the external TrueNAS services via Wireguard always on VPN and do not release any TrueNAS ports to the outside world via the firewall. |
In case anyone needs a sample script. Here Hetzner as provider and a sample to deploy the cert on the UDM Pro. I simply add an A and AAAA record to Hetzner DNS with the local IP addresses of the UDM Pro.
|
This TrueNAS deployment script is completely redesigned for the use of WebSocket. The script uses the API Client tool midclt. The script is designed to use one certificate for all services. A wildcard certificate is recommended if you want to access the services/apps under certain subdomains.
Replaces the certificates in the following services:
Features in planning:
https://github.com/truenas/api_client
https://www.truenas.com/docs/scale/api/
_**The TrueNAS REST API is deprecated in TrueNAS 25.04 and replaced by the TrueNAS API Client. Full removal of the REST API is planned for a future release.
This new API Client is not the deprecated TrueNAS CLI (midcli). The API Client is integrated in TrueNAS 25.04 onwards. It provides the midclt command-line tool, and the means to easily communicate with middleware using Python to make calls through the websocket API.**_