Openvpn – Setup openvpn client on centos 6.4

centos6.4openvpn

Attempting to join a new CentOS 6.4 client to an existing OpenVPN network. Running service openvpn start gives the error:

Options error: In [CMD-LINE]:1: Error opening configuration file: client.conf
Use --help for more information

If I use

bash -vx service openvpn start

the service starts successfully.

If I run the cmd-line from the init.d script the service starts successfully.

It just doesn't want to start like it needs to if this process is going to work at reboot.

I am using SELinux in enforcing mode but I'm not seeing any messages in /var/log/secure or /var/log/messages indicating that SELinux is getting involved.

Suggestions?

Best Answer

The problem seems to be the security context of some files.

The steps you need to take are:

  1. check if trying to start the service generates AVC denials

    # ausearch -m avc -ts today
    

    it could be the case that there were no output. You could try to disable dontaudit rules temporarily

    # semodule -DB
    
  2. check the permissions and security labels of the affected files and/or directories

    # ls -lrtZ /path/to/file
    # ls -lrtdZ /path/to/dir
    
  3. query the current policy to see what is the expected security label

    # matchpathcon /path/to/file
    # matchpathcon /path/to/dir
    
  4. if the current security label and the expected security label don't match, restore it. Note that you can restore directories recursively

    # restorecon -v /path/lo/file
    # restorecon -v -R /path/to/dir
    
  5. try again to start the service and repeat the steps if necessary