|
| 1 | +# PHP-CLI SHELL for FIREWALL |
| 2 | + |
| 3 | +This repository is the addon for PHP-CLI SHELL about FIREWALL (acl) service. |
| 4 | +With this addon you can create ACLs (monosite, failover and fullmesh) and generate template for your firewall appliance. |
| 5 | +For the moment, only JunOS templates are availables. There are 2 templates for JunOS: one formated with {} and one with set commands. |
| 6 | + |
| 7 | +ACL monosite: basic ACL, source(s), destination(s), no automation. For this ACL category you can not enable fullmesh option! |
| 8 | +ACL failover: failover ACL(s) will be automaticaly generated for all failover sites in inbound or outbound. |
| 9 | +ACL failover with fullmesh option: source and destination of ACL will be isolated to process automation. |
| 10 | + |
| 11 | +You have to use base PHP-CLI SHELL project that is here: https://github.com/cloudwatt/php-cli-shell_base |
| 12 | + |
| 13 | + |
| 14 | +# INSTALLATION |
| 15 | + |
| 16 | +#### APT PHP |
| 17 | +__*https://launchpad.net/~ondrej/+archive/ubuntu/php*__ |
| 18 | +* add-apt-repository ppa:ondrej/php |
| 19 | +* apt-get update |
| 20 | +* apt install php7.1-cli php7.1-mbstring php7.1-readline |
| 21 | + |
| 22 | +#### REPOSITORIES |
| 23 | +* git clone https://github.com/cloudwatt/php-cli-shell_base |
| 24 | +* git checkout tags/v1.1 |
| 25 | +* git clone https://github.com/cloudwatt/php-cli-shell_firewall |
| 26 | +* git checkout tags/v1.0 |
| 27 | +* Merge these two repositories |
| 28 | + |
| 29 | +#### PHPIPAM (Optionnal) |
| 30 | +If you have PHPIPAM and you want object name autocompletion, you have to perform these steps: |
| 31 | +* git clone https://github.com/cloudwatt/php-cli-shell_phpipam |
| 32 | +* git checkout tags/v1.1 |
| 33 | +* Merge this repository with two previous repositories (base and firewall) |
| 34 | +* Install PHP-CLI SHELL for PHPIPAM with README helper |
| 35 | + https://github.com/cloudwatt/php-cli-shell_phpipam/blob/master/README.md |
| 36 | + |
| 37 | +#### CONFIGURATION FILE |
| 38 | +* mv configurations/firewall.json.example configurations/firewall.json |
| 39 | +* vim configurations/firewall.json |
| 40 | + * Adapt configuration to your network topology |
| 41 | + * Of course you can add more than two sites |
| 42 | + * Do not change topology attribute names: internet, onPremise, interSite, private |
| 43 | + * /!\ Zone name between site (MPLS-ADM, MPLS-USR) must be the same on all sites |
| 44 | + *This is will change in next release to add more flexibility* |
| 45 | +* Optionnal |
| 46 | + * You can create user configuration files for base and firewall services to overwrite some configurations |
| 47 | + These files will be ignored for commits, so your user config files can not be overwrited by a futur release |
| 48 | + * vim configurations/firewall.user.json |
| 49 | + Change configuration like path or file |
| 50 | + * All *.user.json files are ignored by .gitignore |
| 51 | + |
| 52 | + |
| 53 | +#### PHP LAUNCHER FILE |
| 54 | +* mv firewall.php.example firewall.php |
| 55 | +* vim firewall.php |
| 56 | + * Change [IPAM_SERVER_KEY] with the key of your PHPIPAM server in configuration file |
| 57 | + You can add many PHPIPAM server, it is compatible multiple PHPIPAM |
| 58 | + If you have not PHPIPAM service, remove argument or keep it empty |
| 59 | + |
| 60 | +#### CREDENTIALS FILE (Only if you install PHPIPAM service) |
| 61 | +/!\ For security reason, use a read only account! |
| 62 | +__*Change informations which are between []*__ |
| 63 | +* vim credentialsFile |
| 64 | + * read -sr USER_PASSWORD_INPUT |
| 65 | + * export IPAM_[IPAM_SERVER_KEY]_LOGIN=[YourLoginHere] |
| 66 | + * export IPAM_[IPAM_SERVER_KEY]_PASSWORD=$USER_PASSWORD_INPUT |
| 67 | + __Change [IPAM_SERVER_KEY] with the key of your PHPIPAM server in configuration file__ |
| 68 | + |
| 69 | + |
| 70 | +# EXECUTION |
| 71 | + |
| 72 | +#### SHELL |
| 73 | +Launch PHP-CLI Shell for FIREWALL service |
| 74 | +* source credentialsFile |
| 75 | +* php firewall.php |
| 76 | + |
| 77 | +#### CLI |
| 78 | +Call commands directly from your OS shell. |
| 79 | +__*Informations between [] are optionnal*__ |
| 80 | +* source credentialsFile |
| 81 | +* php firewall.php --site name|all --create_host "name;IPv4[;IPv6]" --create_subnet "name;IPv4/mask[;IPv6/mask]" --create_network "name;IPv4-IPv4[;IPv6-IPv6]" |
| 82 | + --create_rule monosite|failover [--fullmesh] --action permit|deny |
| 83 | + --source_host name --source_subnet name --source_network name |
| 84 | + --destination_host name --destination_subnet name --destination_network name |
| 85 | + --protocol protocol;number[-number] --description maDescription |
| 86 | + --save [name;[force]] --export_configuration "junos[;force]" |
0 commit comments