server.cert file gets corrupted every time I start openvpn service?

  • I migrated to a new box a while back. I have a single static OpenVPN client which connects in to the office.

    It hasn't worked since the upgrade to the new box. As the bridge between networks wasn't being used, I ignored the issue.

    Today I finally had a little time to try and see what is going wrong and discovered that the "server cert" called "server1.cert" is corrupted.

    So I went back to the XML backup, found the appropriate base-64 entry, decoded it, and created a new server1.cert file with the correct value.

    I then restarted the openvpn service.

    And the file got rewritten and corrupted with binary stuff part way through it.

    Clueless as to what I need to look at to deal with this issue.

    Currently running 2.4.4, not keen on updating main system to 2.4.5 remotely at this time. (distance).

  • As a work around for whatever the core issue is, I remembered the immutable flag setting so recreated the file, then ran chflags schg server1.cert then started the openvpn service. so far the openvpn service is running, but the question is why is the file getting corrupted?

  • Hi,

    View /etc/inc/

    Locate the several function calls and definition at the bottom of the function called : openvpn_add_keyfile

    This function takes the directory, the extension, the PEM based64 encoded data and writes out the file.
    File rights are set to 0600 and that's it.
    It's line 760 in the file.

    If something goes wrong at that place, I guess the $data that gets base64 decodes isn't 'ok' ?
    Is your cert ok ?
    Many cert type files are created using that function. When only "server1.cert" goes wrong, I gues it's input (= $data) is 'wrong'.

    An old 2.4.4-p3 bug that got resolved (?) ^^
    edit : non. openvpn server was working just for for my when I was using 2.4.4-p3.