OpenVPN autostart not working

Description

Version: TrueNAS-12.0-BETA

The "Start Automatically" parameter of the OpenVPN client and server services has not effect. I have to manually start these two services after each reboot.

This is very problematic for remote access and defeats the purpose of having a VPN service.

Problem/Justification

None

Impact

None

SmartDraw Connector

Katalon Manual Tests (BETA)

Activity

Show:

Bug Clerk 
August 4, 2020 at 12:55 PM

Bug Clerk 
August 4, 2020 at 12:23 PM

Pharoah Baze 
August 3, 2020 at 3:56 PM
(edited)

I think I identified the problem.

Both openvpn_client and openvpn_server init scripts are symlinks to "/usr/local/etc/rc.d/openvpn"

If you look at the service script template, you can see that during boot and shutdown, $name is define as $_file. This results in the both service files checking for openvpn_enable, openvpn_configfile, ... which are not defined.

When manually starting the service, $name is defined as ${0##*/} which correctly check for openvpn_client_enable, ... and openvpn_server_enable, ...

So either the service script template needs to be changed to not use $_file, or the openvpn service files should be deduplicated instead of symlinking to the same openpvn file.

Pharoah Baze 
August 3, 2020 at 12:35 AM
(edited)

To be more precise, I only have two errors at boot time:
1) "Failed to establish libvirt connection" which is maybe linked to this bug?
2) "No zpools found! Please create one before using iocage" which is caused by iocage not being able to start jails because my iocage dataset is encrypted.

From what I see, openvpn_client and openvpn_server are two services running directly on the host so these errors should not be related to the OpenVPN services not starting at boot time.

Here is a copy of the above mentioned errors from middlewared.log:

 

Pharoah Baze 
August 1, 2020 at 1:31 PM

The services start perfectly fine when manually clicking the "Running" switch in Services.

There is nothing related to OpenVPN in the logs at boot time.

I don't know where / how you implemented services autostart, but it's somehow missing for the new OpenVPN services.

Complete

Details

Assignee

Reporter

Impact

Affects versions

Priority

More fields

Katalon Platform

Created August 1, 2020 at 12:30 AM
Updated July 1, 2022 at 4:56 PM
Resolved August 4, 2020 at 12:55 PM