VPN Client [UNSTABLE]¶
The VPN Client API allows you to control the Freebox VPN Client
VPN Client Errors¶
When attempting to access this API, you may encounter the following errors:
| error_code | Description |
|---|---|
| inval | invalid parameters |
| nomem | internal error |
| ioerror | internal error |
| nodev | invalid device |
| noent | invalid id |
| netdown | network is not available |
| exist | entry already exists |
| busy | resource is busy |
VPN Client Configuration¶
VPN Client Configuration Object¶
-
VPNClientConfig¶ VPNClientConfig has the following attributes:
-
idstring Read-only¶ VPN config id
-
descriptionstring¶ VPN description
-
typeenum¶ VPN server type
type Description pptp PPTP VPN server openvpn OpenVPN server
-
activebool¶ is this configuration active. Only one configuration is active at a time.
-
conf_pptpVPNClientConfigPPTP¶ only available when type is PPTP
-
-
VPNClientConfig VPNClientConfigPPTP has the following attributes:
-
remote_hoststring¶ remote host IP or name
-
usernamestring¶ VPN username
-
passwordstring Write-only¶ VPN password
-
mppeenum¶ mppe Description disable disable mppe require require mppe require_128 require 128 bits mppe
-
allowed_authdict¶ allowed authentication methods dictionnary with following keys:
- eap
- pap
- chap
- mschap
- mschapv2
values are booleans.
-
Get VPN Client configuration list¶
-
GET/api/v4/vpn_client/config/¶ Get the list of
VPNClientConfigExample request:
GET /api/v4/vpn_client/config/ HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": [ { "type": "pptp", "description": "test vpn2", "active": true, "id": "vpn0", "conf_pptp": { "mppe": "require", "username": "freeuser", "remote_host": "vpnhost.example.org", "allowed_auth": { "eap": false, "mschap": false, "mschapv2": true, "chap": false, "pap": false } } }, { "type": "pptp", "description": "test vpn1", "active": false, "id": "vpn1", "conf_pptp": { "mppe": "require", "username": "testuser", "remote_host": "example.org", "allowed_auth": { "eap": false, "mschap": false, "mschapv2": true, "chap": false, "pap": false } } } ] }
Get a VPN client config¶
-
GET/api/v4/vpn_client/config/{id}¶ Get the
VPNClientConfigExample request:
GET /api/v4/vpn_client/config/vpn0 HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "type": "pptp", "description": "test vpn2", "active": true, "id": "vpn0", "conf_pptp": { "mppe": "require", "username": "freeuser", "remote_host": "vpnhost.example.org", "allowed_auth": { "eap": false, "mschap": false, "mschapv2": true, "chap": false, "pap": false } } } }
Add a VPN client configuration¶
-
POST/api/v4/vpn_client/config/¶ Creates a new
VPNClientConfig.Example request:
POST /api/v4/vpn_client/config/ HTTP/1.1 Host: mafreebox.freebox.fr { "type": "pptp", "description": "test pptp", "active": false, "conf_pptp": { "mppe": "require", "username": "fbxtest", "password": "", "remote_host": "test.example.org", "allowed_auth": { "mschapv2": true } } }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "type": "pptp", "description": "test pptp", "active": false, "id": "vpn2", "conf_pptp": { "password": "", "mppe": "require", "username": "fbxtest", "remote_host": "test.example.org", "allowed_auth": { "eap": false, "mschap": false, "mschapv2": true, "chap": false, "pap": false } } } }
Delete a VPN client Configuration¶
-
DELETE/api/v4/vpn_client/config/{id}¶ Deletes the
VPNClientConfigExample request:
DELETE /api/v4/vpn_client/config/vpn2 HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true }
Update the VPN client configuration¶
-
PUT/api/v4/vpn_client/config/{id}¶ Update the
VPNServerConfigExample request:
PUT /api/v4/vpn_client/config/vpn0 HTTP/1.1 Host: mafreebox.freebox.fr
{ "active": false }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "type": "pptp", "description": "test vpn2", "active": false, "id": "vpn0", "conf_pptp": { "mppe": "require", "username": "freeuser", "remote_host": "vpnhost.example.org", "allowed_auth": { "eap": false, "mschap": false, "mschapv2": true, "chap": false, "pap": false } } } }
VPN Client Status¶
VPN Client Status Object¶
-
VPNClientStatus¶ VPNClientStatus has the following attributes:
-
enabledbool Read-only¶ is VPN client enabled
-
active_vpnstring Read-only¶ active VPN id
-
active_vpn_descriptionstring Read-only¶ active VPN description
-
typeenum Read-only¶ active VPN type
type Description pptp PPTP VPN server openvpn OpenVPN server
-
stateenum Read-only¶ state Description waiting_wan waiting for wan connection going_up connecting up connected going_down disconnecting down disconnected
-
last_upint Read-only¶ timestamp of last successfull connection
-
last_tryint Read-only¶ timestamp of last connection attempt
-
next_tryint Read-only¶ seconds left until next connection attempt
-
last_errorenum Read-only¶ last_error Description none no error internal internal error authentication_failed wrong credentials auth_failed wrong credentials resolv_failed invalid host name connect_timeout connection timeout connect_failed connection failed setup_control_failed PPTP session negociation failure setup_call_failed PPTP session failure protocol protocol error remote_terminated connection closed by remote peer remote_disconnect connection closed by remote peer
-
statsVpnClientStats Read-only¶ connection statistics
-
IPv4VpnClientIpInfo Read-only¶ connection IPv4 information
-
-
VpnClientStats¶ -
rate_upint Read-only¶ current upload rate (in byte/s)
-
rate_downint Read-only¶ current download rate (in byte/s)
-
bytes_upint Read-only¶ total bytes uploaded
-
bytes_downint Read-only¶ total bytes downloaded
-
-
VpnClientIpInfo¶ -
config_validbool Read-only¶ is the configuration valid
-
ip_maskdict Read-only¶ assigned IP and netmask
-
domainstring Read-only¶ provided domain
-
gatewayIPv4 Read-only¶ provided gateway
-
dns[] array of ipv4 Read-only¶ list of dns servers
-
providerenum Read-only¶ ip_mask source
provider Description none none static static IP configuration ppp ppp dhcp DHCP server
-
routeslist Read-only¶ list of provided routes
-
dhcpdict Read-only¶ DHCP status information
-
Get the VPN client status¶
-
GET/api/v4/vpn_client/status¶ Get the
VPNClientStatusExample request:
GET /api/v4/vpn_client/status HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "enabled": true, "type": "pptp", "last_error": "none", "active_vpn_description": "test vpn", "last_try": 1392904509, "state": "up", "stats": { "rate_up": 0, "bytes_down": 94, "bytes_up": 94, "rate_down": 0 }, "active_vpn": "vpn1", "next_try": 0, "last_up": 1392904510, "ipv4": { "routes": { }, "config_valid": true, "ip_mask": { "ip": "192.168.27.65", "mask": "255.255.255.255" }, "provider": "ppp", "dhcp": { "state": "down", "renew_remaining": 0, "dhcp_options": { }, "lease_remaining": 0, "lease_time": 0, "rebind_remaining": 0, "server_id": 0 }, "dns": [ "212.27.38.253" ], "domain": "", "gateway": "212.27.38.253" } } }