Last active
November 29, 2023 20:49
-
-
Save jhanley-com/e4c7d477b0105eebd36741fd4fa79ace to your computer and use it in GitHub Desktop.
Civo CLI (Windows): Create Firewall and Rules to Allow Traffic From Home
This file contains 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 script is for Windows | |
:: Firewall rule name | |
set NAME=allow_from_home | |
:: update the IP address with yours | |
set CIDR=1.2.3.4/32 | |
:: Create a new firewall | |
call civo firewall create %NAME% --create-rules=false --network=default | |
@if errorlevel 1 goto err_out | |
:: Create a rule allowing TCP | |
call civo firewall rule create %NAME% ^ | |
--protocol=TCP ^ | |
--startport=1 ^ | |
--endport=65535 ^ | |
--direction=ingress ^ | |
--label="Allow all TCP traffic from home" ^ | |
--action="allow" ^ | |
--cidr=%CIDR^ | |
@if errorlevel 1 goto err_out | |
:: Create a rule allowing UDP | |
civo firewall rule create %NAME% ^ | |
--protocol=UDP ^ | |
--startport=1 ^ | |
--endport=65535 ^ | |
--direction=ingress ^ | |
--label="Allow all UDP traffic from home" ^ | |
--action="allow" ^ | |
--cidr=%CIDR^ | |
@if errorlevel 1 goto err_out | |
:: Create a rule allowing ICMP | |
civo firewall rule create %NAME% ^ | |
--protocol=ICMP ^ | |
--startport=1 ^ | |
--direction=ingress ^ | |
--label="Allow all ICMP traffic from home" ^ | |
--action="allow" ^ | |
--cidr=%CIDR^ | |
@if errorlevel 1 goto err_out | |
:err_out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment