Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Preshared key - Always says invalid #581

Closed
sudheeshb opened this issue Oct 4, 2024 · 2 comments · Fixed by #574
Closed

Issue with Preshared key - Always says invalid #581

sudheeshb opened this issue Oct 4, 2024 · 2 comments · Fixed by #574

Comments

@sudheeshb
Copy link

Describe the bug

Getting the following error when I tried to post/patch for the URL https://mypfsense.org/api/v2/vpn/wireguard/peer'

response_id":"WIREGUARD_PEER_PRESHAREDKEY_INVALID","message":"Field presharedkey must be a valid WireGuard pre-shared key

To Reproduce

Make a POST request to /api/v2/vpn/wireguard/peer with presharedkey set to null or an empty string. You will get a WIREGUARD_PEER_PRESHAREDKEY_INVALID error.

See the code snippet below.

peer_params =
{'id': '20', 'enabled': True, 'tun': 'tun_wg20', 'endpoint': 'valid_ip_address', 'port': '51820', 'descr': '', 'persistentkeepalive': None, 'publickey': 'validkey=', 'allowedips': [{'parent_id': '20', 'id': 0, 'address': '0.0.0.0', 'mask': 0, 'descr': ''}], 'presharedkey': ' ', 'name': 'tun_wg20'}

url = 'https://mypfsense.org/api/v2/vpn/wireguard/peer'
out = requests.post(url, json = peer_params, verify=True, headers=headers)

This will produce an error like below.

response_id":"WIREGUARD_PEER_PRESHAREDKEY_INVALID","message":"Field presharedkey must be a valid WireGuard pre-shared key

Expected behavior

Empty strings should be allowed by the Model

pfSense Version & Package Version:

pfSense Version: 2.7.2 CE
Package Version v2.1.3

Affected Endpoints:

URL: /api/v2/vpn/wireguard/peer
@jaredhendrickson13
Copy link
Owner

Thanks for reporting. I'll have a fix for this in v2.2.0. Should be out later tonight.

@sudheeshb
Copy link
Author

Thanks for the quick feed back. Also appreciate your effort for building such us a useful tool which helps in automation!. Waiting for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants