[freeboxos] Add IPSec VPN server (#19814)

* Add IPSec VPN server

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
This commit is contained in:
Gaël L'hopital
2025-12-17 01:10:47 +01:00
committed by GitHub
parent d2007fc807
commit 0b6c6bd6ca
6 changed files with 59 additions and 18 deletions
+18 -14
View File
@@ -195,7 +195,7 @@ The following channels are supported:
| revolution, delta | file-sharing | afp-file-status | Switch | RW | Indicates whether Mac OS File Sharing is enabled | | revolution, delta | file-sharing | afp-file-status | Switch | RW | Indicates whether Mac OS File Sharing is enabled |
| revolution, delta | sysinfo | uptime | Number:Time | R | Time since last reboot of the equipment | | revolution, delta | sysinfo | uptime | Number:Time | R | Time since last reboot of the equipment |
| revolution, delta | sysinfo | ip-address | String | R | Internal IPv4 Address of the Freebox Server | | revolution, delta | sysinfo | ip-address | String | R | Internal IPv4 Address of the Freebox Server |
| revolution, delta | sysinfo | box-event | Trigger | - | Triggers when an event related to the Freebox server has been detected. Possible event: "restarted", "firmware_updated" and "reboot_requested" | | revolution, delta | sysinfo | box-event | Trigger | - | Triggers when an event related to the Freebox Server has been detected (**). |
| revolution, delta | actions | wifi-status | Switch | RW | Indicates whether the WiFi network is enabled | | revolution, delta | actions | wifi-status | Switch | RW | Indicates whether the WiFi network is enabled |
| revolution, delta | actions | upnpav-status | Switch | RW | Indicates whether UPnP AV is enabled | | revolution, delta | actions | upnpav-status | Switch | RW | Indicates whether UPnP AV is enabled |
| revolution, delta | actions | airmedia-status | Switch | RW | Indicates whether Air Media is enabled | | revolution, delta | actions | airmedia-status | Switch | RW | Indicates whether Air Media is enabled |
@@ -212,23 +212,26 @@ The following channels are supported:
| revolution, delta | connection-status | rate-down | Number:DataTransferRate | R | Current download rate | | revolution, delta | connection-status | rate-down | Number:DataTransferRate | R | Current download rate |
| revolution, delta | connection-status | bytes-up | Number:DataAmount | R | Total data uploaded since last restart | | revolution, delta | connection-status | bytes-up | Number:DataAmount | R | Total data uploaded since last restart |
| revolution, delta | connection-status | bytes-down | Number:DataAmount | R | Total data downloaded since last restart | | revolution, delta | connection-status | bytes-down | Number:DataAmount | R | Total data downloaded since last restart |
| revolution, delta | wireguard | state | String | R | Current state of the VPN Server | | revolution, delta | wireguard | state | String | R | Current state of the WireGuard VPN Server |
| revolution, delta | wireguard | connections | Number | R | Number of clients connected to the server | | revolution, delta | wireguard | connections | Number | R | Number of clients connected to the server |
| revolution, delta | wireguard | auth-connections | Number | R | Number of authenticated clients connected to the server | | revolution, delta | wireguard | auth-connections | Number | R | Number of authenticated clients connected to the server |
| revolution, delta | pptp | state | String | R | Current state of the VPN Server | | revolution, delta | pptp | state | String | R | Current state of the PPTP VPN Server |
| revolution, delta | pptp | connections | Number | R | Number of clients connected to the server | | revolution, delta | pptp | connections | Number | R | Number of clients connected to the server |
| revolution, delta | pptp | auth-connections | Number | R | Number of authenticated clients connected to the server | | revolution, delta | pptp | auth-connections | Number | R | Number of authenticated clients connected to the server |
| revolution, delta | openvpn-routed | state | String | R | Current state of the VPN Server | | revolution, delta | openvpn-routed | state | String | R | Current state of the OpenVPN Routed Server |
| revolution, delta | openvpn-routed | connections | Number | R | Number of clients connected to the server | | revolution, delta | openvpn-routed | connections | Number | R | Number of clients connected to the server |
| revolution, delta | openvpn-routed | auth-connections | Number | R | Number of authenticated clients connected to the server | | revolution, delta | openvpn-routed | auth-connections | Number | R | Number of authenticated clients connected to the server |
| revolution, delta | openvpn-bridge | state | String | R | Current state of the VPN Server | | revolution, delta | openvpn-bridge | state | String | R | Current state of the OpenVPN Bridged Server |
| revolution, delta | openvpn-bridge | connections | Number | R | Number of clients connected to the server | | revolution, delta | openvpn-bridge | connections | Number | R | Number of clients connected to the server |
| revolution, delta | openvpn-bridge | auth-connections | Number | R | Number of authenticated clients connected to the server | | revolution, delta | openvpn-bridge | auth-connections | Number | R | Number of authenticated clients connected to the server |
| revolution, delta | ipsec | state | String | R | Current state of the IPsec VPN Server |
| revolution, delta | ipsec | connections | Number | R | Number of clients connected to the server |
| revolution, delta | ipsec | auth-connections | Number | R | Number of authenticated clients connected to the server |
| active-player, player | player-actions | key-code | String | W | Simulates pushing a remote control button | | active-player, player | player-actions | key-code | String | W | Simulates pushing a remote control button |
| active-player | player-status | player-status | String | R | Status of the Freebox TV player | | active-player | player-status | player-status | String | R | Status of the Freebox TV player |
| active-player | player-status | package | String | R | Name of the package currently active on the player | | active-player | player-status | package | String | R | Name of the package currently active on the player |
| active-player | sysinfo | uptime | Number:Time | R | Time since last reboot of the equipment | | active-player | sysinfo | uptime | Number:Time | R | Time since last reboot of the equipment |
| active-player | sysinfo | box-event | Trigger | - | Triggers when an event related to the Freebox Player has been detected. Possible event: "restarted", "firmware_updated" and "reboot_requested" | | active-player | sysinfo | box-event | Trigger | - | Triggers when an event related to the Freebox Player has been detected (**). |
| vm | vmstatus | status | Switch | RW | Status of the virtual machine | | vm | vmstatus | status | Switch | RW | Status of the virtual machine |
| (*) | connectivity | reachable | Switch | R | Indicates if the network device is reachable or not | | (*) | connectivity | reachable | Switch | R | Indicates if the network device is reachable or not |
| (*) | connectivity | last-seen | DateTime | R | Date and time of last activity for the network device | | (*) | connectivity | last-seen | DateTime | R | Date and time of last activity for the network device |
@@ -258,6 +261,7 @@ The following channels are supported:
| basic-shutter | | basic-shutter | Rollershutter | W | Up, stop and down commands for a RTS shutter | | basic-shutter | | basic-shutter | Rollershutter | W | Up, stop and down commands for a RTS shutter |
(*): any thing type amongst _active-player_, _player_, _host_, _wifihost_, _repeater_ and _vm_. (*): any thing type amongst _active-player_, _player_, _host_, _wifihost_, _repeater_ and _vm_.
(**): Possible event: "restarted", "firmware_updated" and "reboot_requested"
## Actions for rules ## Actions for rules
@@ -160,6 +160,7 @@ public class FreeboxOsBindingConstants {
public static final String OPENVPN_ROUTED = "openvpn-routed"; public static final String OPENVPN_ROUTED = "openvpn-routed";
public static final String OPENVPN_BRIDGE = "openvpn-bridge"; public static final String OPENVPN_BRIDGE = "openvpn-bridge";
public static final String WIREGUARD = "wireguard"; public static final String WIREGUARD = "wireguard";
public static final String IPSEC = "ipsec";
// Repeater channels // Repeater channels
public static final String LED = "led"; public static final String LED = "led";
@@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory;
*/ */
@NonNullByDefault @NonNullByDefault
public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf { public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf {
private static final Set<String> VPN_SERVERS = Set.of(PPTP, OPENVPN_ROUTED, OPENVPN_BRIDGE, WIREGUARD); private static final Set<String> VPN_SERVERS = Set.of(PPTP, OPENVPN_ROUTED, OPENVPN_BRIDGE, WIREGUARD, IPSEC);
private final Logger logger = LoggerFactory.getLogger(ServerHandler.class); private final Logger logger = LoggerFactory.getLogger(ServerHandler.class);
private final ChannelUID eventChannelUID; private final ChannelUID eventChannelUID;
@@ -192,7 +192,7 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
updateChannelDecimal(groupName, VPN_CONNECTIONS, vpnServer.connectionCount()); updateChannelDecimal(groupName, VPN_CONNECTIONS, vpnServer.connectionCount());
updateChannelDecimal(groupName, VPN_AUTHENTICATED, vpnServer.authConnectionCount()); updateChannelDecimal(groupName, VPN_AUTHENTICATED, vpnServer.authConnectionCount());
} else { } else {
logger.warn("Unexpected and VPN server type: {}", groupName); logger.warn("Unexpected and unhandled VPN server type: '{}'", groupName);
} }
}); });
@@ -33,6 +33,7 @@ thing-type.freeboxos.dect.channel.gain-rx.label = Gain RX
thing-type.freeboxos.dect.channel.gain-tx.label = Gain TX thing-type.freeboxos.dect.channel.gain-tx.label = Gain TX
thing-type.freeboxos.delta.label = Freebox Delta thing-type.freeboxos.delta.label = Freebox Delta
thing-type.freeboxos.delta.description = Provides various informations regarding the status of the Freebox Delta Server thing-type.freeboxos.delta.description = Provides various informations regarding the status of the Freebox Delta Server
thing-type.freeboxos.delta.group.ipsec.label = IPsec VPN
thing-type.freeboxos.delta.group.openvpn-bridge.label = OpenVPN Bridged VPN thing-type.freeboxos.delta.group.openvpn-bridge.label = OpenVPN Bridged VPN
thing-type.freeboxos.delta.group.openvpn-routed.label = OpenVPN Routed VPN thing-type.freeboxos.delta.group.openvpn-routed.label = OpenVPN Routed VPN
thing-type.freeboxos.delta.group.pptp.label = PPTP VPN thing-type.freeboxos.delta.group.pptp.label = PPTP VPN
@@ -64,6 +65,7 @@ thing-type.freeboxos.repeater.label = Wifi Repeater
thing-type.freeboxos.repeater.description = Provides informations and control over a Wifi Repeater thing-type.freeboxos.repeater.description = Provides informations and control over a Wifi Repeater
thing-type.freeboxos.revolution.label = Freebox Revolution thing-type.freeboxos.revolution.label = Freebox Revolution
thing-type.freeboxos.revolution.description = Provides various informations regarding the status of the Freebox Revolution Server thing-type.freeboxos.revolution.description = Provides various informations regarding the status of the Freebox Revolution Server
thing-type.freeboxos.revolution.group.ipsec.label = IPsec VPN
thing-type.freeboxos.revolution.group.openvpn-bridge.label = OpenVPN Bridged VPN thing-type.freeboxos.revolution.group.openvpn-bridge.label = OpenVPN Bridged VPN
thing-type.freeboxos.revolution.group.openvpn-routed.label = OpenVPN Routed VPN thing-type.freeboxos.revolution.group.openvpn-routed.label = OpenVPN Routed VPN
thing-type.freeboxos.revolution.group.pptp.label = PPTP VPN thing-type.freeboxos.revolution.group.pptp.label = PPTP VPN
@@ -35,10 +35,13 @@
<channel-group typeId="vpn-server" id="pptp"> <channel-group typeId="vpn-server" id="pptp">
<label>PPTP VPN</label> <label>PPTP VPN</label>
</channel-group> </channel-group>
<channel-group typeId="vpn-server" id="ipsec">
<label>IPsec VPN</label>
</channel-group>
</channel-groups> </channel-groups>
<properties> <properties>
<property name="thingTypeVersion">2</property> <property name="thingTypeVersion">3</property>
</properties> </properties>
<representation-property>macAddress</representation-property> <representation-property>macAddress</representation-property>
@@ -76,10 +79,13 @@
<channel-group typeId="vpn-server" id="pptp"> <channel-group typeId="vpn-server" id="pptp">
<label>PPTP VPN</label> <label>PPTP VPN</label>
</channel-group> </channel-group>
<channel-group typeId="vpn-server" id="ipsec">
<label>IPsec VPN</label>
</channel-group>
</channel-groups> </channel-groups>
<properties> <properties>
<property name="thingTypeVersion">2</property> <property name="thingTypeVersion">3</property>
</properties> </properties>
<representation-property>macAddress</representation-property> <representation-property>macAddress</representation-property>
@@ -83,6 +83,20 @@
</add-channel> </add-channel>
</instruction-set> </instruction-set>
<instruction-set targetVersion="3">
<add-channel id="state" groupIds="ipsec">
<type>freeboxos:vpn-state</type>
</add-channel>
<add-channel id="connections" groupIds="ipsec">
<type>freeboxos:connection-count</type>
</add-channel>
<add-channel id="auth-connections" groupIds="ipsec">
<type>freeboxos:connection-count</type>
<label>Authenticated Connection Count</label>
<description>Number of authenticated clients connected to the server</description>
</add-channel>
</instruction-set>
</thing-type> </thing-type>
<thing-type uid="freeboxos:revolution"> <thing-type uid="freeboxos:revolution">
@@ -142,5 +156,19 @@
</add-channel> </add-channel>
</instruction-set> </instruction-set>
<instruction-set targetVersion="3">
<add-channel id="state" groupIds="ipsec">
<type>freeboxos:vpn-state</type>
</add-channel>
<add-channel id="connections" groupIds="ipsec">
<type>freeboxos:connection-count</type>
</add-channel>
<add-channel id="auth-connections" groupIds="ipsec">
<type>freeboxos:connection-count</type>
<label>Authenticated Connection Count</label>
<description>Number of authenticated clients connected to the server</description>
</add-channel>
</instruction-set>
</thing-type> </thing-type>
</update:update-descriptions> </update:update-descriptions>