Setup and status_checks error: [Errno 2] No such file or directory: '/home/user-data/dns/dnssec/K_domain_.+008+34724.private'

After setting up mailinabox successfully, I attempted to move the server to an nfs mount so I would have more disk space for emails than what I allocated for the vm. As suggested by https://discourse.mailinabox.email/t/mailboxes-storage-location-and-quota/3704 I copied the data at /home/user-data to the nfs drive, made a symbolic link, then restarted the nginx service just to make sure things were still working. Now I get an http 500 “Something went wrong, sorry” error when I go to System → Status Checks.
When I run the status_checks.py script manually, I get the following output

System
======
✓  All system services are running.
✓  SSH disallows password-based login.
✓  System software is up to date.
?  You are running version Mail-in-a-Box v63. Mail-in-a-Box version check disabled by privacy setting.
✓  System administrator address exists as a mail alias. [administrator@mail.mydomain.com ↦ user1@mail.mydomain.com,user2@mail.mydomain.com]
✓  The disk has 5928.04 GB space remaining.
✓  System memory is 75% free.

Network
=======
✓  Firewall is active.
✖  Outbound mail (SMTP port 25) seems to be blocked by your network. You will not be able to send any mail. Many residential networks block port 25 to prevent hijacked machines from being able to send spam. A quick connection test to 
   Google's mail server on port 25 failed.
✖  The IP address of this machine xx.xx.xx.xx is listed in the Spamhaus Block List (code 127.0.0.11), which may prevent recipients from receiving your email. See [link here].
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/home/myuser/mailinabox/management/./status_checks.py", line 398, in run_domain_checks_on_domain
    check_dns_zone_suggestions(domain, env, output, dns_zonefiles, domains_with_a_records)
  File "/home/myuser/mailinabox/management/./status_checks.py", line 579, in check_dns_zone_suggestions
    check_dnssec(domain, env, output, dns_zonefiles)
  File "/home/myuser/mailinabox/management/./status_checks.py", line 604, in check_dnssec
    with open(os.path.join(env['STORAGE_ROOT'], 'dns/dnssec/' + dnssec_keys['KSK'] + '.key'), 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user-data/dns/dnssec/K_domain_.+013+13578.key'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/myuser/mailinabox/management/./status_checks.py", line 1114, in <module>
    run_checks(False, env, ConsoleOutput(), pool)
  File "/home/myuser/mailinabox/management/./status_checks.py", line 67, in run_checks
    run_domain_checks(rounded_values, env, output, pool, domains_to_check=domains_to_check)
  File "/home/myuser/mailinabox/management/./status_checks.py", line 360, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
FileNotFoundError: [Errno 2] No such file or directory: '/home/user-data/dns/dnssec/K_domain_.+013+13578.key'

The warning and two status failures are expected, but the Python error is not. After seeing this, I assumed running mailinabox setup would generate this “K_domain” file but it doesn’t, instead I get a similar error at the end of the output:

Primary Hostname: mail.mydomain.com
Public IP Address: xx.xx.xx.xx
Private IP Address: 10.xx.xx.xx
Mail-in-a-Box Version:  v63

Updating system packages...
Installing system packages...
Initializing system random number generator...
Firewall is active and enabled on system startup
Synchronizing state of fail2ban.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable fail2ban
Installing nsd (DNS server)...
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
wal
Installing Nextcloud (contacts/calendar)...
Nextcloud is already latest version
Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...
Installing Munin (system monitoring)...
[Errno 2] No such file or directory: '/home/user-data/dns/dnssec/K_domain_.+008+34724.private'
-----------------------------------------------

Your Mail-in-a-Box is running.

Please log in to the control panel for further instructions at:

[link here]

If you have a DNS problem put the box's IP address in the URL
([link here]) but then check the TLS fingerprint:

At this point I am able to login to /admin and /mail, however Status Check still fails.
How can I regenerate this file so status check can work again? I’m not sure how I lost it in the first place or if it was ever created since I never configured dnssec.

My first thoughts:

  • Does the file actually exist or not?
  • If it exists, there might be an issue with access rights. How did you copy the files? Did you include the file permissions and ownerships?

If the file is not there, I think these files are generated by some DNS script. Running sudo tools/dns_update --force should re-generate them.

The file doesn’t exist which is why I’m keen to recreate it.

myuser@mail:~/mailinabox$ ls /home/user-data/dns/dnssec/
ECDSAP256SHA256.conf  RSASHA256.conf

Running dns_update gives

myuser@mail:~/mailinabox$ sudo tools/dns_update --force
[sudo] password for myuser: 
[Errno 2] No such file or directory: '/home/user-data/dns/dnssec/K_domain_.+008+34724.private'

And after this, the output of ls on /home/user-data/dns/dnssec/` is the same.

I looked into the code a bit, you are right, these files are generated during installation. To regenerate them:

  • Move the *.conf files in the dnssec folder to a safe place (so you have a backup)
  • Then rerun the mailinabox setup.

That does not explain why these files were not copied from the old place (at least, I assume that these files were present before the move, can you confirm?) Do you remember how you copied the data to the nfs drive?

Yeah I just did cp -R on the directory, there were a few permission denied so I ran again with sudo. Not sure why it missed them but removing the config files and re-running setup worked, thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.