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

    OpenVPN with pre-shared keys - problem when copy-pasting the key

    Scheduled Pinned Locked Moved OpenVPN
    2 Posts 2 Posters 5.3k 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.
    • A
      atlasis
      last edited by

      Hello,

      I'm using the latest build of pfsense 2.0 RC1. I'm trying to establish a peer-to-peer VPN tunnel using OpenVPN with pre-shared keys.

      After trying to start the service, it fails and I get the message "Key file ('/var/etc/openvpn/server1.secret') can be a maximum of 2048 bytes"

      The problem is that when I copy - paste the key from the stdout (where I produced it) or from any editor (i.e. vi)  to the corresponding form in/vpn_openvpn_server.php?act=edit&id=0, some extra non-printing characters are added that destroy the key. I don't think that I had this issued in previous releases.

      When I copy the file of the key (i.e. preshared.key) to '/var/etc/openvpn/server1.secret, the service starts successfully.

      However, at every reboot, I have the same issue.

      Regards

      Antonios

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Why are you making the keys by hand? Check the box to have the system make one for you, and then copy/paste from the GUI to the other side.

        Even so, I've never had any problems copying and pasting keys made any which way into the GUI there. Are you sure you are copying whole shared key and only the shared key?

        It should be like this:```

        : openvpn --genkey --secret /dev/stdout

        2048 bit OpenVPN static key

        -----BEGIN OpenVPN Static key V1-----
        6b5853bcafd3d4a87d8255c0fc14dbd1
        35a8095c15e17e09c239c75f68095d85
        0c2ec7794051de8c73daaffd00bbce12
        d88720a8d137c02cd6d0370889ab9932
        0f6bbf40efbe822cdcd2a601298023ec
        ae2f39049142227a876e22bb2cf00830
        7e9ea735748960fbb9a2b23c61894d69
        49332cd7f680fea17f2c356f1211d457
        b2e141027c2333bdf1a7c76ae405dd8b
        e9a8e5569d922388a12d97484f5b9dfd
        00a37ae3cdfe173c294a6b845521225a
        dbb366077046b0ed5bec860f5db67707
        d43d5a504de7db846bc524f045614771
        0db1f091aa42b50ca5f42b7b971c8617
        b85a21cb8ddbb399718c2c2dccba2b49
        f71bd2f7f51535ce9e959055eeb90e6b
        -----END OpenVPN Static key V1-----

        
        When I paste that in, what I get in the server<x>.secret file is exactly what I pasted in.</x>

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

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