Skip to content

Commit

Permalink
Winbox matcher: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vnxme committed Oct 12, 2024
1 parent 5764d70 commit f8b474f
Show file tree
Hide file tree
Showing 5 changed files with 646 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Current matchers:
- **layer4.matchers.socks5** - matches connections that look like [SOCKSv5](https://www.rfc-editor.org/rfc/rfc1928.html).
- **layer4.matchers.ssh** - matches connections that look like SSH connections.
- **layer4.matchers.tls** - matches connections that start with TLS handshakes. In addition, any [`tls.handshake_match` modules](https://caddyserver.com/docs/modules/) can be used for matching on TLS-specific properties of the ClientHello, such as ServerName (SNI).
- **layer4.matchers.winbox** - matches connections that look like those initiated by [Winbox](https://help.mikrotik.com/docs/display/ROS/WinBox), a graphical tool for MikroTik hardware and software routers management.
- **layer4.matchers.wireguard** - matches connections the look like [WireGuard](https://www.wireguard.com/protocol/) connections.
- **layer4.matchers.xmpp** - matches connections that look like [XMPP](https://xmpp.org/about/technology-overview/).

Expand Down
1 change: 1 addition & 0 deletions imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
_ "github.com/mholt/caddy-l4/modules/l4tee"
_ "github.com/mholt/caddy-l4/modules/l4throttle"
_ "github.com/mholt/caddy-l4/modules/l4tls"
_ "github.com/mholt/caddy-l4/modules/l4winbox"
_ "github.com/mholt/caddy-l4/modules/l4wireguard"
_ "github.com/mholt/caddy-l4/modules/l4xmpp"
)
85 changes: 85 additions & 0 deletions integration/caddyfile_adapt/gd_matcher_winbox.caddytest
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
layer4 {
:443 {
@w1 winbox {
modes standard romon
username toms
}
route @w1 {
proxy 192.168.0.1:8291
}
@w2 winbox {
modes standard
username_regexp ^andris|edgars|juris$
}
route @w2 {
proxy 192.168.0.2:8291
}
}
}
}
----------
{
"apps": {
"layer4": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"winbox": {
"modes": [
"standard",
"romon"
],
"username": "toms"
}
}
],
"handle": [
{
"handler": "proxy",
"upstreams": [
{
"dial": [
"192.168.0.1:8291"
]
}
]
}
]
},
{
"match": [
{
"winbox": {
"modes": [
"standard"
],
"username_regexp": "^andris|edgars|juris$"
}
}
],
"handle": [
{
"handler": "proxy",
"upstreams": [
{
"dial": [
"192.168.0.2:8291"
]
}
]
}
]
}
]
}
}
}
}
}
Loading

0 comments on commit f8b474f

Please sign in to comment.