danb35/deploy-freenas

I have an error in line 82 Truenas scale

chuxxsss opened this issue · 8 comments

Hi Dan,
I am new at making encryption keys for truenas. I am doing something wrong. I have made sub directories, Have put a password in and copied you api key. Where am I going wrong please. Bit of a noob on letsencrypt.

All the best Chuxxsss

root@Egits[/deploy-freenas]# ./deploy_freenas.py
Traceback (most recent call last):
File "/root/deploy-freenas/./deploy_freenas.py", line 82, in
with open(PRIVATEKEY_PATH, 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/someone/sec/me'
root@Egits[
/deploy-freenas]# nano deploy_config
root@Egits[/deploy-freenas]# ./deploy_freenas.py
Traceback (most recent call last):
File "/root/deploy-freenas/./deploy_freenas.py", line 82, in
with open(PRIVATEKEY_PATH, 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '
/someone/sec/me'

The deploy_freenas script needs to know where the certificate and private key files are. It defaults to the default location that acme.sh uses: /root/.acme.sh/$FQDN/$FQDN.key for the private key, and /root/.acme.sh/$FQDN/fullchain.cer for the certificate, where $FQDN represents the configured fully-qualified domain name of your NAS. You can override these defaults by setting privkey_path and fullchain_path, respectively, in your config file. It appears that you've done this, but set at least the private key path incorrectly.

I'm not sure what other help I can give. You need to tell the script where the key and cert files are located. Only you know where that is; I certainly don't.

I'm in the process of migrating from CORE to SCALE and one of the differences is that hostname no longer returns the fully qualified domain name.

I fixed this by setting cert_fqdn in the deploy_config which seems to have fixed the above problem.

Still having problems Dan,
Any luck moving to scale?
truenas letencry

Hi @chuxxsss The error is the line saying File Not Found "~/someone/sec/me".
I don't know what you have set in deploy_config file but I assume that you have pointed it to some ssl cert files that don't exist or you don't have permissions for.

I have this running in TrueNAS SCALE with no issues other than having to set cert_fqdn in the deploy_config as mentioned above.

My entire setup was documented as...

# Install and setup deploy-freenas
cd /root
git clone https://github.com/danb35/deploy-freenas
cp deploy-freenas/deploy_config.example deploy-freenas/deploy_config
vim deploy-freenas/deploy_config  # set the set the API key and cert_fqdn, everything else can stay stock

# Install acme.sh and get a cert
curl https://get.acme.sh/ | sh
.acme.sh/acme.sh --set-default-ca --server letsencrypt
# The following is for DNS Made Easy [Other Options](https://github.com/acmesh-official/acme.sh/wiki/dnsapi)
export ME_Key="<key>"
export ME_Secret="<secret>"
.acme.sh/acme.sh --issue -d fqdn.example.com --dns dns_me --reloadcmd "/root/deploy-freenas/deploy_freenas.py"

Setup two Cron Tasks via the GUI (crons setup in the system will be overwritten during an upgrade)

  1. Renew Cert '17 02 * * *' '/root/.acme.sh/acme.sh --cron --home "/root/.acme.sh"'
  2. Pull Latest SSL deploy script '0 0 * * *' 'git -C /root/deploy-freenas/ pull'

Please don't post screen shots of text--just copy/paste the text and then set it off with ``` before and after.

Why are you runnung deploy_freenas.py r?

As to the prior command, it's looking for a file at ~/someone/sec/me, which it can't find. Make sure its path is correct, and it's best to specify an absolute path (e.g., /mnt/tank/foo/bar/cert.pem rather than ~/bar/cert.pem).