Added php-xml to README

Added initial lib/xml.php
Renamed srv/tftp/tftp_provisioner.php -> srv/tftp/tftp_provisioner

Signed-off-by: Diederik de Groot <ddegroot@talon.nl>
This commit is contained in:
Diederik de Groot
2020-03-16 08:27:00 +01:00
parent ad70913459
commit 67bf5bdca5
6 changed files with 74 additions and 13 deletions

View File

@@ -10,6 +10,11 @@ The project also serves as a repository of current / up to date cisco skinny/scc
- [tftp-hpa](http://www.chschneider.eu/linux/server/tftpd-hpa.shtml)
- [nginx](https://www.nginx.com/resources/wiki/)
## PHP Dependencies
- php >= 7.x
- php-cli
- php-xml
## Usage
- Clone the repository
- Move the tftpboot directory (depends on your operating system):

View File

@@ -27,7 +27,7 @@
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>192.168.1.1</processNodeName>
<processNodeName>192.168.178.3</processNodeName>
</callManager>
</member>
<member priority="1">
@@ -115,9 +115,9 @@
</commonProfile>
<vendorConfig>
<logServer>192.168.1.1</logServer>
<syslogServer>192.168.1.1</syslogServer>
<debugServer>192.168.1.1</debugServer>
<logServer>192.168.178.3</logServer>
<syslogServer>192.168.178.3</syslogServer>
<debugServer>192.168.178.3</debugServer>
<debugLevel>3</debugLevel>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
@@ -225,12 +225,12 @@
<userId>9999</userId>
<!-- Begin URL's -->
<idleURL>http://192.168.1.1/idle.php</idleURL>
<authenticationURL>http://192.168.1.1/authenticate.php</authenticationURL>
<informationURL>http://192.168.1.1/cisco_menu/help/help.php</informationURL>
<idleURL>http://192.168.178.3/idle.php</idleURL>
<authenticationURL>http://192.168.178.3/authenticate.php</authenticationURL>
<informationURL>http://192.168.178.3/cisco_menu/help/help.php</informationURL>
<messagesURL/>
<proxyServerURL/>
<servicesURL>http://192.168.1.1/tests.xml</servicesURL>
<directoryURL>http://192.168.1.1/cisco_menu/directory/menu.php</directoryURL>
<servicesURL>http://192.168.178.3/tests.xml</servicesURL>
<directoryURL>http://192.168.178.3/cisco_menu/directory/menu.php</directoryURL>
<!-- End URL's -->
</Default>

View File

@@ -2,15 +2,16 @@
if [ $# == 0 ]; then
# Create ITLFile.tlv in the tftpboot provisioning directory, the certificate used to sign the .tlv file is automatically included as providing the SAST function.
../../tools/certutils/tlvfile -b ../../tftpboot/settings/ITLFile.tlv -c CA.pem -r asterisk.pem -f ccm -r capf.pem -f capf -r tvs.pem -f tvs -r tftp.pem -f tftp -r webserver.pem -f https
#../../tools/certutils/tlvfile -b ../../tftpboot/settings/ITLFile.tlv -c CA.pem -r asterisk.pem -f ccm -r capf.pem -f capf -r tvs.pem -f tvs -r tftp.pem -f tftp -r webserver.pem -f https -r vpn.pem -f https
../../tools/certutils/tlvfile -b ../../tftpboot/settings/ITLFile.tlv -c CA.pem -r asterisk.pem -f ccm -r tftp.pem -f tftp -r webserver.pem -f https -r vpn.pem -f https
else
# Optionally, the default ITLFile.tlv can be overridden using a file name based on the MAC address of the phone, eg: ITLSEP58971ECC97C1.tlv.
#../../tools/certutils/tlvfile -b ../../tftpboot/settings/ITL${1}.tlv -c CA.pem -r vpn.pem -f https -F ITLFile.tlv
../../tools/certutils/tlvfile -b ../../tftpboot/settings/ITL${1}.tlv -c CA.pem -r asterisk.pem -f ccm -r tftp.pem -f tftp -r webserver.pem -f https -r vpn.pem -f https -F ITLFile.tlv
# Optionally, additional certificates can be included using a file name based on the MAC address of the phone, eg: CTLSEP58971ECC97C1.tlv.
# Example for the VPN certificate
../../tools/certutils/tlvfile -b ../../tftpboot/settings/CTL${1}.tlv -c CA.pem -r vpn.pem -f https -F CTLFile.tlv
#../../tools/certutils/tlvfile -b ../../tftpboot/settings/CTL${1}.tlv -c CA.pem -r vpn.pem -f https -F CTLFile.tlv
# Enable SIP-TLS mode by setting <transportLayerProtocol> to 3 and setting <deviceSecurityMode> to either 2 (Authenticated) or 3 (Encrypted) in SEPMAC.cnf.xml. Optionally, any XML services can be configured to use HTTPS.
fi

View File

@@ -2,5 +2,6 @@
if [ $# -gt 0 ]; then
# Sign SEPMAC.cnf.xml
../../tools/certutils/sgnfile -b ../../tftpboot/settings/$1 -c tftp.pem
#../../tools/certutils/sgnfile -b ../../tftpboot/settings/$1 -c tftp.pem
../../tools/certutils/sgnfile -c ../../etc/certs/tftp.pem -b $*
fi

54
lib/xml.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
include_once("config.php");
class XML {
private $config;
private $data;
private $values;
private $index;
private $parser;
function __construct($config) {
$this->config = $config;
$this->parser = xml_parser_create();
//xml_error_string
}
function __destruct() {
xml_parser_free($this->parser);
}
function readStr($content) {
xml_parse_into_struct($this->parser , $content , $this->values, $this->index);
}
function readFile($filename) {
$content = file_get_contents($filename);
$this->read($content);
}
function write() {
}
function addAttr($elem, $attr) {
}
function removeAttr($elem, $attr) {
}
function updateAttr($elem, $attr) {
}
function add($parent) {
}
function remove($parent) {
}
function update($parent) {
}
}
// Testing
if(defined('STDIN') ) {
$xml = new XML($config);
$test_cases = Array(
);
foreach($test_cases as $test) {
try {
$xml->readStr("<device></device>");
} catch (Exception $e) {
}
}
unset($resolver);
}
?>