client.php
Most modules make use of a client app, but some may not. The modules with a client will have a client.php
file found in /usr/local/facileManager/<module_name>/
and it will utilize core functionality found in facileManager-core. The purpose of the client app is to be an agent for the module in order to update the system configuration.
Here we will break down the parameters available to all client apps.
You can always invoke the client help file at the CLI:
php client.php help
Core Parameters¶
-h | help¶
Invokes the client help file and exits.
Example
php client.php help
-v | version¶
Print the client app version and exits.
Example
php client.php version
-c | cron¶
If the client is setup to receive updates from the facileManager server via cron, this parameter will invoke the client to check for any pending configurations. This is also the parameter used to define the crontab job during installation.
Example
sudo php client.php cron
Note
This parameter only works if the client is configured to receive updates via cron.
-b | buildconf¶
The client app exists to build the configuration for the system. Use this parameter to build the server configuration and associated files.
Example
sudo php client.php buildconf
-d | debug¶
Sometimes your desired configuration may not get deployed to the client and enabling debug mode will provide more information which may help in troubleshooting.
Example
sudo php client.php buildconf debug
-n | dryrun¶
Instead of applying the configuration on the client, this parameter will show you want will be applied without saving any files.
Example
php client.php buildconf dryrun
-p | purge¶
There may be old configuration files (or files unmaintained by fM and its modules) that you want to delete.
Example
sudo php client.php buildconf purge
-s | no-ssl¶
This parameter will force the client to communicate with the fM server via http only.
Example
sudo php client.php buildconf no-ssl
no-sudoers¶
During the client installation, use this parameter to prevent the necessary sudoers entry from being made. This might be useful if you maintain the sudoers files by other means.
Example
sudo php client.php install no-sudoers
no-update¶
The client will send information to the server about itself (OS, OS version, client version, app version). This parameter will prevent the information from being sent and populating the database.
Example
sudo php client.php install no-update
apitest¶
Use this parameter to test the API communication.
Example
php client.php apitest
install¶
This parameter invokes the client installer which asks a series of questions to correctly configure the client.
Example
sudo php client.php install
-o | options¶
This can only be used in conjuction with install
. Instead of being prompted during installation, this parameter followed by the desired options will be passed to the installer.
Valid options:
Option Description FMHOST
fM host URL SERIALNO
Server serial number (or 0 to auto-generate) method
Update method to use (cron, ssh, http)
Example
sudo php client.php install -o FMHOST=https://example.com/fm/,method=cron
sudo php client.php install options FMHOST=fm.example.com,SERIALNO=0,method=ssh
upgrade¶
This parameter will upgrade the client app to the latest available version.
Example
sudo php client.php upgrade
reinstall¶
This parameter invokes the installer on a previously installed client.
Example
sudo php client.php reinstall
fmDHCP Parameters¶
fmDHCP has additional parameters that can be passed to client.php
that are specific to this module.
-l (dump|delete)¶
Leases can be managed by invoking -l
followed by an option to dump
or delete
them.
Example
sudo php client.php -l dump
sudo php client.php -l delete=10.1.1.100
-o <(human|web)>
¶
When dumping the leases, you can specify the output style -- either human
-readable or used for web
.
Example
sudo php client.php -l dump -o web
fmDNS Parameters¶
fmDNS has additional parameters that can be passed to client.php
that are specific to this module.
dump-cache¶
This parameter will dump the DNS cache via rndc dumpdb -cache
and display the contents of the dump-file
file (if it's configured in the named.conf.*
files).
Example
sudo php client.php dump-cache
clear-cache¶
This parameter clears the DNS cache via rndc flush
.
Example
sudo php client.php clear-cache
-D | -D -f /path/to/zones.conf¶
This parameter dumps zone data to STDOUT
and in required by dump-zone
. It will dump data for a single zone by passing -D <zone_name>
or it will dump data for multiple zones by passing -f /path/to/zones.conf
.
Example
sudo php client.php dump-zone -D test-domain.com
sudo php client.php dump-zone -f /etc/bind/zones/master/zones.conf
-z | zones¶
Instead of building all configuration files for bind (i.e. using buildconf
), only the zone data will be built and reloaded using this parameter.
Example
sudo php client.php zones
id=<ID>
¶
Building and reloading the zone data for a single zone can be achieved by passing the zone ID with zones
.
Example
sudo php client.php zones id=3
install url-only¶
In order to use URL resource records, you may want to install the client component on a server that is not a DNS server. This parameter will install the client app for URL RR use only.
Example
sudo php client.php install url-only
enable url¶
An fmDNS client that has already been installed can get enabled to serve URL resource records.
Example
sudo php client.php enable url
API Usage¶
The API can be invoked with the client app to manage records instead of using the web interface. While not as robust as the web interface, there are a number of supported parameters:
setHost Invokes the API functionality
action=XX Defines API action to take on a record (add, update, delete)
type=XX Defines the RR type (A, AAAA, CNAME, DNAME, MX, NS, PTR, TXT)
name=XX Defines the name of the RR
value=XX Defines the value of the RR
ttl=XX Defines the TTL of the RR
priority=XX Defines the priority of the RR (MX only)
append=XX Defines whether to append the domain or not (yes, no)
comment=XX Defines the record comment
status=XX Defines the record status (active, disabled)
newname=XX Defines the new record name (when action=update)
newvalue=XX Defines the new record value (when action=update)
reload=XX Defines whether to reload the zone or not (yes, no)
Note
setHost
is a required parameter which invokes the API functionality.
Example
php client.php setHost id=36 action=add name=www value=1.2.3.4 type=A ttl=500 createPTR=yes comment="some comment" status=active`
php client.php setHost id=36 action=update name="@" newvalue=10.0.0.2 type=A reload=yes
fmWifi Parameters¶
fmWifi has additional parameters that can be passed to client.php
that are specific to this module.
block=<MAC Address>
¶
This parameter will block the specified MAC address from connecting to the access point.
Example
sudo php client.php block=00:11:22:aa:bb:cc
-e | ebtables¶
This parameter will block the specified MAC address from connecting to the access point using ebtables.
Example
sudo php client.php block=00:11:22:aa:bb:cc -e
show-clients¶
This parameter will provide a list of connected clients.
Example
sudo php client.php show-clients
status¶
This parameter will show the current status of the access point.
Example
sudo php client.php status
status-all¶
This parameter will show the full status of the access point.
Example
sudo php client.php status-all
-o <(human|web)>
¶
This parameter will format the output either for human
-readable or for web
. This is to be used with show-clients
, status
, and status-all
.
Example
sudo php client.php status -o web