Repository navigation
command line
The main purpose of smc-script is to send a configuration to the smc, but it also has some sub-commands to interact directly with the smc. The objective is to help writing script by retrieving existing object and a list of 'hnames'.
There are several methods to login. After a successful login, a session file is created under ~/.config/smc-script/session
connect to the smc at 192.168.100.7 on HTTP using default port 8082. The option '-k' is the api key of the SMC rest API
smc-script login -k XXXXX 192.168.100.7
Extra optional arguments:
-p PORT, --port PORT TCP port of the SMC rest API (default: 8082)
-v VERSION, --version VERSION
API version to use (e.g. 6.4). If not specified, the
highest version supported by the smc is selected.
-c CA_CERT, --cacert CA_CERT
path of the CA certificate to verify the connection
This method uses the same login file as smc-python library
smc-script login -a
The format of ~/smcrc is
[smc]
smc_address=192.168.100.7
smc_apikey=xxxx
api_version=6.4
smc_port=8082
smc_ssl=False
verify_ssl=False
ssl_cert_file=''
only smc_address and smc_apikey are mandatory
smc-script login -f my_creds.txt
The credential file has the same format as ~/.smcrc (see above)
smc-script logout
closes the session and deletes the ~/.config/smc-script/session file
The 'list' sub-command allows to retrieve the elements that are below a given element, much like the unix 'ls' command
This command takes a hierarchical name as argument.
Examples:
get the list of all firewalls
smc-script list '#single_fw'
get the list of all nat rules of a given policy
smc-script list '#fw_policy/my_policy/fw_ipv4_nat_rules'
The 'get' sub-command allows to retrieve the description of an element
Example
smc-script get single_fw/myfw