* Add pfSense backend domain types and configuration
This adds the necessary domain types and configuration structures
for the pfSense backend support. Includes PfsenseInterfaceExtras and
PfsensePeerExtras structs, and the BackendPfsense configuration
with API URL, key, and timeout settings.
* Add low-level pfSense REST API client
Implements the HTTP client for interacting with the pfSense REST API.
Handles authentication via X-API-Key header, request/response parsing,
and error handling. Uses the pfSense REST API v2 endpoints as documented
at https://pfrest.org/.
* Implement pfSense WireGuard controller
This implements the InterfaceController interface for pfSense firewalls.
Handles WireGuard tunnel and peer management through the pfSense REST API.
Includes proper filtering of peers by interface (since API filtering doesn't
work) and parsing of the allowedips array structure with address/mask fields.
* Register pfSense controllers and update configuration
Registers the pfSense backend controllers in the controller manager
and adds example configuration to config.yml.sample. Also updates
README to mention pfSense backend support.
* Fix peer filtering and allowedips parsing for pfSense backend
The pfSense REST API doesn't support filtering peers by interface
via query parameters, so all peers are returned regardless of the
filter. This caused peers from all interfaces to be randomly assigned
to a single interface in wg-portal.
Additionally, the API returns allowedips as an array of objects with
"address" and "mask" fields instead of a comma-separated string,
which caused parsing failures.
Changes:
- Remove API filter from GetPeers() since it doesn't work
- Add client-side filtering by checking the "tun" field in peer responses
- Update convertWireGuardPeer() to parse allowedips array structure
- Add parseAddressArray() helper for parsing address objects
- Attempt to fetch interface addresses from /tunnel/{id}/address endpoint
(endpoint may not be available in all pfSense versions)
- Add debug logging for peer filtering and address loading operations
Note: Interface addresses may still be empty if the address endpoint
is not available. Public Endpoint and Default DNS Servers are typically
configured manually in wg-portal as the pfSense API doesn't provide
this information.
* Extract endpoint, DNS, and peer names from pfSense peer data
The pfSense API provides endpoint, port, and description (descr) fields
in peer responses that can be used to populate interface defaults and
peer display names.
Changes:
- Extract endpoint and port from peers and combine them properly
- Fix peer name/description extraction to check "descr" field first
(pfSense API uses "descr" instead of "description" or "comment")
- Add extractPfsenseDefaultsFromPeers() helper to extract common
endpoint and DNS from peers during interface import
- Set PeerDefEndpoint and PeerDefDnsStr from peer data for pfSense
backends during interface import
- Use most common endpoint/DNS values when multiple peers are present
* Fix interface display name to use descr field from pfSense API
The pfSense API uses "descr" field for tunnel descriptions, not
"description" or "comment". Updated convertWireGuardInterface()
to check "descr" first so that tunnel descriptions (e.g., "HQ VPN")
are displayed in the UI instead of just the tunnel name (e.g., "tun_wg0").
* Remove calls to non-working tunnel and peer detail endpoints
The pfSense REST API endpoints /api/v2/vpn/wireguard/tunnel/{id}
and /api/v2/vpn/wireguard/tunnel/{id}/address don't work and were
causing log spam. Removed these calls and use only the data from
the tunnel/peer list responses.
Also removed the peer detail endpoint call that was added for
statistics collection, as it likely doesn't work either.
* Fix unused variable compilation error
Removed unused deviceId variable that was causing build failure.
* Optimize tunnel address fetching to use /tunnel?id endpoint
Instead of using the separate /tunnel/address endpoint, now query
the specific tunnel endpoint /tunnel?id={id} which includes the
addresses array in the response. This avoids unnecessary API calls
and simplifies the code.
- GetInterface() now queries /tunnel?id={id} after getting tunnel ID
- loadInterfaceData() queries /tunnel?id={id} as fallback if addresses missing
- extractAddresses() properly parses addresses array from tunnel response
- Removed /tunnel/address endpoint calls
Signed-off-by: rwjack <jack@foss.family>
* Fix URL encoding issue in tunnel endpoint queries
Use Filters in PfsenseRequestOptions instead of passing query strings
directly in the path. This prevents the ? character from being encoded
as %3F, which was causing 404 errors.
- GetInterface() now uses Filters map for id parameter
- loadInterfaceData() now uses Filters map for id parameter
Signed-off-by: rwjack <jack@foss.family>
* update backend docs for pfsense
---------
Signed-off-by: rwjack <jack@foss.family>
Public REST API implementation to handle peers, interfaces and users. It also includes some simple provisioning endpoints.
The Swagger API documentation is available under /api/v1/doc.html
* Added TLS support for web
- Added optional configurations `cert_file` and `key_file` to run web server with https
Signed-off-by: Dmytro Bondar <git@bonddim.com>
* Helm chart update
- Refactored Ingress to use one host only (`config.web.external_url` is required)
- Added Certificate resource template (secret is mounted to container into `/app/certs/`)
- Added support for service with mixed protocols (exposes UI and Wireguard ports on same IP)
- Added helm-docs target to makefile
- Changed pod labels to use selectorLabels
- Removed default probes (app runs without healthy web)
- Removed sections from README
Signed-off-by: Dmytro Bondar <git@bonddim.com>
* Fix chart workflow path filter
* Fix chart lint issue
* Skip clean-up tested chart
* Try k3d cluster
---------
Signed-off-by: Dmytro Bondar <git@bonddim.com>
Initial alpha codebase for version 2 of WireGuard Portal.
This version is considered unstable and incomplete (for example, no public REST API)!
Use with care!
Fixes/Implements the following issues:
- OAuth support #154, #1
- New Web UI with internationalisation support #98, #107, #89, #62
- Postgres Support #49
- Improved Email handling #47, #119
- DNS Search Domain support #46
- Bugfixes #94, #48
---------
Co-authored-by: Fabian Wechselberger <wechselbergerf@hotmail.com>
* Give the way to connect against LDAP server with certificate and key
* fix(ldap) Update cert variable name
In order to be more explicit
Co-authored-by: Alexis Aurin <alexis@so6.pw>
* api - add OperationID
helps when using pyswagger and is visible via
http://localhost:8123/swagger/index.html?displayOperationId=true
gin-swagger can not set displayOperationId yet
* api - match paramters to their property equivalents
pascalcase & sometimes replacing the name (e.g. device -> DeviceName)
* api - use ShouldBindJSON instead of BindJSON
BindJSON sets the content-type text/plain
* api - we renamed, we regenerated
* device - allow - in DeviceName wg-example0.conf etc
* api - more pascalcase & argument renames
* api - marshal DeletedAt as string
gorm.DeletedAt is of type sql.NullTime
NullTime declares Time & Valid as properties
DeletedAt marshals as time.Time
swaggertype allows only basic types
-> string
* Peer - export UID/DeviceType in json
UID/DeviceType is required, skipping in json, skips it in marshalling,
next unmarshalling fails
* assets - name forms for use with mechanize
* api - match error message
* add python3/pyswagger based unittesting
- initializes a clean install by configuration via web service
- tests the rest api
* tests - test address exhaustion
* tests - test network expansion
Co-authored-by: Markus Koetter <koetter@cispa.de>
2021-09-29 18:41:13 +02:00
The one with the braid (she/her) | Dфҿ mit dem Zopf (sie/ihr)