2019-12-04 19:31:24 +01:00
|
|
|
# RouterOS Function
|
|
|
|
# Copyright (c) Grzegorz Budny
|
2020-02-08 20:03:02 +01:00
|
|
|
# Version 1.0
|
|
|
|
# Last update: 2/8/2020
|
2019-12-04 19:31:24 +01:00
|
|
|
# Port Knock from RouterOS
|
|
|
|
|
|
|
|
:global PortKnock do={
|
|
|
|
|
|
|
|
|
|
|
|
:foreach sourceAddress, destinationPort in $base do={
|
|
|
|
|
|
|
|
:log info "...:::Port Knocking Sequance Started:::...";
|
|
|
|
:log warning ("Knocking to ".$destinationAddress." on port ".$destinationPort." from ".$sourceAddress);
|
|
|
|
|
|
|
|
/system ssh src-address=$sourceAddress port=$destinationPort address=$destinationAddress;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
:log info ("...:::Port Knocking Finished check access to ".$destinationAddress);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
:global knockBase {"sourceIP1"="port23"; \
|
|
|
|
"sourceIP2"="port22" \
|
|
|
|
};
|
|
|
|
|
|
|
|
$PortKnock base=$knockBase destinationAddress=destinationIP;
|