-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[ddwrt] Initial contribution of DD-WRT/OpenWrt/Tomato SSH based binding #20505
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
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
985b54b
[ddwrt] New OH4/5 dd-wrt binding
ballle98 25a9344
add ssh support
ballle98 08294ef
add ssh key support
ballle98 e54fc5e
create all the ddwrt items and classes
ballle98 a661f5a
cleanup after 5.1.x rebase
ballle98 972b160
refactor into api and handler directories added device handler
ballle98 17c2fbd
cleanup log in device handler and added constants for config items
ballle98 89beded
significant refactor added discovery for devices
ballle98 e5144c0
DDWRTDevice that is seperate from DDWRTDeviceThingHandler
ballle98 5401541
ddwrt: introduce SshAuthSession and capture SSH welcome banner
ballle98 2550cb7
ddwrt: Reduce connection timeout from 60 sec to 1
ballle98 bc9a18b
ddwrt: Add session recovery, device lookup by hostname/IP, and failed…
ballle98 e4dc554
ddwrt: Add radio, wireless client, and firewall rule thing types with…
ballle98 a7a9896
ddwrt: Refactor device initialization with MOTD-based detection, per-…
ballle98 9af9316
ddwrt: Add syslog event parsing, SSH config resolution, and bridge on…
ballle98 9247259
ddwrt: Thread-safe wireless client cache, DHCP/hosts caching, MAC ran…
ballle98 2c4ff65
ddwrt: Event-driven cache updates, OUI hostname generation, discovery…
ballle98 d48723d
ddwrt: Complete README documentation
ballle98 7cf59ee
[ddwrt] Fix naming conventions and addon metadata
ballle98 7dc91e7
ddwrt: Add unit tests for DD-WRT binding
ballle98 0e604d4
[ddwrt] Rebase to main, update dependencies and copyright headers
ballle98 420a733
[ddwrt] Review checklist fixes: static analysis, resilience, and config
ballle98 0d6fc80
[ddwrt] Fix whitespace formatting in bundles/pom.xml
ballle98 8e1b7ec
[ddwrt] omit the password from discovery properties
ballle98 d7c689c
[ddwrt] Sample configuration parameters comment misleading
ballle98 2e72162
[ddwrt] update DDWRTNetworkCache.clearAll()
ballle98 91fd567
[ddwrt] cleanup binding name
ballle98 4827221
[ddwrt] remove unneeded variable
ballle98 559343f
[ddwrt] reduce imports
ballle98 ed4ac61
[ddwrt] reduce imports
ballle98 3408500
[ddwrt] logger.info to logger.debug
ballle98 f1fc1d1
[ddwrt] logger.info to logger.debug
ballle98 79f4732
[ddwrt] replace trim().isEmpty() with isBlank()
ballle98 b28138e
[ddwrt] Address PR #18282 review feedback
ballle98 982fa20
[ddwrt] Two-tier SSH backoff and user config improvements
ballle98 ce1a24c
[ddwrt] Add semantic tags and keywords, rename assoclist channel, cle…
ballle98 7fcf55d
[ddwrt] Fix logging and remove MAC wireless client property
ballle98 86af2cf
[ddwrt] Convert firmware from property to channel
ballle98 fb426ee
Apply suggestion from @Copilot
ballle98 958a657
[ddwrt] Add ARP cache improvements and wireless client inbox deduplic…
ballle98 052fafc
[ddwrt] Change wireless client to client
ballle98 41bc680
[ddwrt] Fix Copilot review comments and radio name formatting
ballle98 0535cd3
[ddwrt] Added strict host key checking configuration option
ballle98 508bba8
[ddwrt] Device online channel is not being updated when reboot is tri…
ballle98 dce87ec
[ddwrt] AP association is not clearing when device is not on network
ballle98 7c7585a
[ddwrt] Probe CPU temp source once and cache for unambiguous parsing
ballle98 5bee75d
[ddwrt] Fix Copilot review comments
ballle98 74fdb4f
[ddwrt] Fixed review comments and compiler warnings
ballle98 1e22478
[ddwrt] Improve client counting: ARP-based totals, wireless/wired spl…
ballle98 046ced2
[ddwrt] fix reverse DNS lookups
ballle98 8fd0024
[ddwrt] fix for EdDSA / Ed25519 SSH failure
ballle98 37ed247
[ddwrt] DHCP event: possible DNS-rebind attack detected should not be…
ballle98 bc27d08
[ddwrt] move WAN IP and gateway only channels from device to network
ballle98 50ba6bf
[ddwrt] Apply suggestions from code review
ballle98 463a348
[ddwrt] Apply suggestions from code review
ballle98 3a85fb9
[ddwrt] Fix code review comments
ballle98 963bfcb
[ddwrt] Apply suggestions from code review
ballle98 f542c80
[ddwrt] Address PR review comments
ballle98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| This content is produced and maintained by the openHAB project. | ||
|
|
||
| * Project home: https://www.openhab.org | ||
|
|
||
| == Declared Project Licenses | ||
|
|
||
| This program and the accompanying materials are made available under the terms | ||
| of the Eclipse Public License 2.0 which is available at | ||
| https://www.eclipse.org/legal/epl-2.0/. | ||
|
|
||
| == Source Code | ||
|
|
||
| https://github.com/openhab/openhab-addons |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>org.openhab.addons.bundles</groupId> | ||
| <artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
| <version>5.2.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>org.openhab.binding.ddwrt</artifactId> | ||
|
|
||
| <name>openHAB Add-ons :: Bundles :: ddwrt Binding</name> | ||
|
|
||
| <properties> | ||
| <bnd.importpackage>org.apache.tomcat.jni;resolution:="optional",org.bouncycastle.*;resolution:="optional",sun.security.x509;resolution:="optional"</bnd.importpackage> | ||
| <sshd.version>2.17.1</sshd.version> | ||
| <eddsa.version>0.3.0</eddsa.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.apache.sshd</groupId> | ||
| <artifactId>sshd-osgi</artifactId> | ||
| <version>${sshd.version}</version> | ||
| </dependency> | ||
| <!-- For ed25519 support --> | ||
| <dependency> | ||
| <groupId>net.i2p.crypto</groupId> | ||
| <artifactId>eddsa</artifactId> | ||
| <version>${eddsa.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> |
11 changes: 11 additions & 0 deletions
11
bundles/org.openhab.binding.ddwrt/src/main/feature/feature.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <features name="org.openhab.binding.ddwrt-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
| <repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
|
||
| <feature name="openhab-binding-ddwrt" description="DD-WRT Binding" version="${project.version}"> | ||
| <feature>openhab-runtime-base</feature> | ||
| <bundle dependency="true">mvn:org.apache.sshd/sshd-osgi/2.17.1</bundle> | ||
| <bundle dependency="true">mvn:net.i2p.crypto/eddsa/0.3.0</bundle> | ||
| <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.ddwrt/${project.version}</bundle> | ||
| </feature> | ||
| </features> |
124 changes: 124 additions & 0 deletions
124
...binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/DDWRTBindingConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| * Copyright (c) 2010-2026 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.ddwrt.internal; | ||
|
|
||
| import java.util.HashSet; | ||
| import java.util.Objects; | ||
| import java.util.Set; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.openhab.core.thing.ThingTypeUID; | ||
|
|
||
| /** | ||
| * The {@link DDWRTBindingConstants} class defines common constants, which are | ||
| * used across the whole binding. | ||
| * | ||
| * @author Lee Ballard - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class DDWRTBindingConstants { | ||
|
|
||
| private DDWRTBindingConstants() { | ||
| } | ||
|
|
||
| private static final String BINDING_ID = "ddwrt"; | ||
|
|
||
| // List of all Thing Type UIDs | ||
| public static final ThingTypeUID BRIDGE_TYPE_NETWORK = new ThingTypeUID(BINDING_ID, "network"); | ||
| public static final ThingTypeUID THING_TYPE_DEVICE = new ThingTypeUID(BINDING_ID, "device"); | ||
| public static final ThingTypeUID THING_TYPE_RADIO = new ThingTypeUID(BINDING_ID, "radio"); | ||
| public static final ThingTypeUID THING_TYPE_CLIENT = new ThingTypeUID(BINDING_ID, "client"); | ||
| public static final ThingTypeUID THING_TYPE_FIREWALL_RULE = new ThingTypeUID(BINDING_ID, "firewall-rule"); | ||
|
|
||
| public static final Set<ThingTypeUID> DISCOVERABLE_THING_TYPES_UIDS = Objects | ||
| .requireNonNull(Set.of(THING_TYPE_DEVICE, THING_TYPE_RADIO, THING_TYPE_CLIENT, THING_TYPE_FIREWALL_RULE)); | ||
|
|
||
| public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(DISCOVERABLE_THING_TYPES_UIDS); | ||
| static { | ||
| SUPPORTED_THING_TYPES_UIDS.add(BRIDGE_TYPE_NETWORK); | ||
| } | ||
|
|
||
| // List of network (bridge) channel ids | ||
| public static final String CHANNEL_TOTAL_CLIENTS = "total-clients"; | ||
| public static final String CHANNEL_WIRELESS_CLIENTS = "wireless-clients"; | ||
| public static final String CHANNEL_WIRED_CLIENTS = "wired-clients"; | ||
| public static final String CHANNEL_DHCP_LEASES = "dhcp-leases"; | ||
| public static final String CHANNEL_DHCP_REMAINING = "dhcp-remaining"; | ||
| public static final String CHANNEL_WAN_IP = "wan-ip"; | ||
| public static final String CHANNEL_WAN_IN = "wan-in"; | ||
| public static final String CHANNEL_WAN_OUT = "wan-out"; | ||
|
|
||
| // List of common channel ids | ||
| public static final String CHANNEL_ONLINE = "online"; | ||
| public static final String CHANNEL_UPTIME = "uptime"; | ||
|
|
||
| // List of device channel ids | ||
| public static final String CHANNEL_DEVICE_WIRELESS_CLIENTS = "device-wireless-clients"; | ||
| public static final String CHANNEL_CPU_LOAD = "cpu-load"; | ||
| public static final String CHANNEL_CPU_TEMP = "cpu-temp"; | ||
| public static final String CHANNEL_IF_IN = "if-in"; | ||
| public static final String CHANNEL_IF_OUT = "if-out"; | ||
| public static final String CHANNEL_REBOOT = "reboot"; | ||
|
|
||
| // List of radio channel ids | ||
| public static final String CHANNEL_ENABLED = "enabled"; | ||
| public static final String CHANNEL_CHANNEL = "channel"; | ||
| public static final String CHANNEL_SSID = "ssid"; | ||
| public static final String CHANNEL_MODE = "mode"; | ||
| public static final String CHANNEL_CLIENT_COUNT = "client-count"; | ||
| public static final String CHANNEL_ASSOCLIST = "assoc-list"; | ||
|
|
||
| // List of client channel ids | ||
| public static final String CHANNEL_MAC_ADDRESS = "mac-address"; | ||
| public static final String CHANNEL_HOSTNAME = "hostname"; | ||
| public static final String CHANNEL_IP_ADDRESS = "ip-address"; | ||
| public static final String CHANNEL_AP = "ap"; | ||
| public static final String CHANNEL_AP_MAC = "ap-mac"; | ||
| public static final String CHANNEL_SIGNAL = "signal"; | ||
| public static final String CHANNEL_SNR = "snr"; | ||
| public static final String CHANNEL_RX_RATE = "rx-rate"; | ||
| public static final String CHANNEL_TX_RATE = "tx-rate"; | ||
| public static final String CHANNEL_LAST_SEEN = "last-seen"; | ||
| public static final String CHANNEL_CONNECTION_TYPE = "connection-type"; | ||
|
|
||
| // List of firewall rule channel ids | ||
| public static final String CHANNEL_DESCRIPTION = "description"; | ||
|
|
||
| // Syslog follower health | ||
| public static final String CHANNEL_SYSLOG_CONNECTED = "syslog-connected"; | ||
|
|
||
| // List of syslog event channel ids (modeled after logreader binding) | ||
| public static final String CHANNEL_LAST_WARNING_EVENT = "last-warning-event"; | ||
| public static final String CHANNEL_LAST_ERROR_EVENT = "last-error-event"; | ||
| public static final String CHANNEL_WARNING_EVENTS = "warning-events"; | ||
| public static final String CHANNEL_ERROR_EVENTS = "error-events"; | ||
| public static final String CHANNEL_LAST_DHCP_EVENT = "last-dhcp-event"; | ||
| public static final String CHANNEL_LAST_WIRELESS_EVENT = "last-wireless-event"; | ||
| public static final String CHANNEL_WARNING_EVENT = "warning-event"; | ||
| public static final String CHANNEL_ERROR_EVENT = "error-event"; | ||
| public static final String CHANNEL_DHCP_EVENT = "dhcp-event"; | ||
| public static final String CHANNEL_WIRELESS_EVENT = "wireless-event"; | ||
|
|
||
| // List of all configuration parameters | ||
| public static final String HOSTNAME = "hostname"; | ||
| public static final String HOSTNAMES = "hostnames"; | ||
| public static final String PORT = "port"; | ||
| public static final String USER = "user"; | ||
| public static final String PASSWORD = "password"; | ||
| public static final String REFRESH_INTERVAL = "refreshInterval"; | ||
| public static final String INTERFACE_ID = "interfaceId"; | ||
| public static final String PARENT_DEVICE_MAC = "parentDeviceMac"; | ||
| public static final String MAC = "mac"; | ||
| public static final String RULE_ID = "ruleId"; | ||
| public static final String CHIPSET = "chipset"; | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
...ding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/DDWRTClientConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright (c) 2010-2026 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.ddwrt.internal; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
|
||
| /** | ||
| * Configuration for a DD-WRT client thing. | ||
| * | ||
| * @author Lee Ballard - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class DDWRTClientConfiguration { | ||
|
|
||
| public String hostname = ""; | ||
| public String mac = ""; | ||
| } |
42 changes: 42 additions & 0 deletions
42
...ding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/DDWRTDeviceConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright (c) 2010-2026 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.ddwrt.internal; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
|
||
| /** | ||
| * The {@link DDWRTDeviceConfiguration} class contains fields mapping thing configuration parameters for | ||
| * {@link DDWRTDeviceThingHandler}. | ||
| * | ||
| * @author Lee Ballard - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class DDWRTDeviceConfiguration { | ||
|
|
||
| public String hostname = ""; | ||
| public String user = "root"; | ||
| public boolean useSystemUser = false; | ||
| public String password = ""; | ||
| public int port = 0; | ||
| public int refreshInterval = 3; | ||
| public String syslogPriority = "warning"; | ||
|
|
||
| /** | ||
| * Returns the effective username for SSH connections. | ||
| * When {@link #useSystemUser} is true, returns empty string so the SSH client | ||
| * resolves from ~/.ssh/config or the system username. | ||
| */ | ||
| public String getEffectiveUser() { | ||
| return useSystemUser ? "" : user; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.