Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

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

    Scheduled Pinned Locked Moved OpenVPN
    openvpnserver.certcorrupt
    3 Posts 2 Posters 394 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      michael-newsrx-com
      last edited by

      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).

      M 1 Reply Last reply Reply Quote 0
      • M
        michael-newsrx-com @michael-newsrx-com
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • GertjanG
          Gertjan
          last edited by Gertjan

          Hi,

          View /etc/inc/openvpn.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 openvpn.inc 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.

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.