Many of the diagnostic tools also include an XML link or check box, for example Diagnostics/Ping.
When using the web page, the page expects that you will post back a special code that was included as a hidden field. This is to prevent the use of cross site scripting where a form on a separate web page will attempt to post to your FireBrick with arguments that do something on your FireBrick, hoping you happen to be logged in to the FireBrick still on your browser.
However, where an Authentication header is used, such as the --user
option on curl
this requirement is dropped, and so you can make scripts work with a single curl
command with authentication and arguments.
Most tools (e.g. ping) require some arguments. The simplest way to identify these is to see what is in the form on the web site.
In some cases the field names are actually taken from the command line, which means that in some cases the field name is just a number.
For example, ping needs 1
as a field with the IP address to ping, and count
as the ping count. Typically all arguments are in fact optional, so do not need to be included.
The arguments need to be supplied as if sent from a form. In most cases these can be passed as a query string style, or as posted form data.
For example:-
curl http://my.firebrick.uk/diag/ping/p --user adrian:237426 --data 1=8.8.8.8 --data xml
The result being:-
<?xml version="1.0" encoding="UTF-8"?> <status xmlns="http://firebrick.ltd.uk/xml/statusv1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://firebrick.ltd.uk/xml/statusv1 http://firebrick.ltd.uk/xml/statusv1.xsd" firmware-version="TEST Abbotscliffe (V2.00.100 2023-10-09T14:59:45)" generated="2023-03-10T13:50:10Z"> <note>Pinging 8.8.8.8 from 90.155.42.98</note><ping> <ping number='1' time='3.848' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='2' time='3.985' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='3' time='3.724' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='4' time='3.848' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='5' time='3.911' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='6' time='4.298' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='7' time='3.839' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='8' time='3.748' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='9' time='3.796' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <ping number='10' time='3.722' ip='8.8.8.8' note='Reply' name='google-public-dns-a.google.com'/> <summary sent='10' received='10' loss='0.00' minimum='3.722' average='3.871' maximum='4.298'/> </ping> </status>
--data xml
in the example so as to include this as a field that is sent in the query string.