FusionPBX: How to Provision binary files? - fusionpbx

I am currently trying to auto-provision a SNOM phone with FusionPBX v4.4. When it comes to provisioning of certificates, SNOM needs these in DER format, which is binary.
Provisioning of text files works like a charm by calling http://fusionpbx.example.com:80/app/provision/?mac=000413xxxxxx&file=mytextfile
However, if the requested file is binary, the call fails with
Fatal error: in
/var/www/fusionpbx/resources/templates/engine/smarty/sysplugins/smarty_internal_templatecompilerbase.php
on line 3
It seems like FusionPBX is trying to parse the file with some template engine. Is there any chance (like an URL parameter) to disable parsing of the file and just deliver it as is?

I haven't tried the DER format yet can you provide a link to info on it. So I will have example to test with?

There is no need to run a binary through the template engine. Instead just put the file in the web directory and pull the file directly.

Related

Parsing MT4 config files

I'm trying to write an install script for an MT4 expert advisor. Part of the installation process includes adding an allowed WebRequest URL. I assume this is saved as a setting in C:\Users\{User ID}\AppData\Roaming\MetaQuotes\Terminal\{Terminal ID}\config\experts.ini as I can see the allowed URLs there, but I cannot parse this data as no editor I have can decode it. Is this file parsed using a proprietary encoding or is it encrypted in some way? Any help here would be appreciated.

Reading images with special characters in Apache web server

When I try to GET images that have special characters like ấ in the filename, I can't read the files on the frontend. It will always throw a 404 error when navigating to the url as well.
My server os is CentOS, and my site is running on Apache with Nodejs. I was wondering if I have to somehow change the file encoding in order to read images with special characters. All normal images work fine, it just seems to not recognize the images with special characters at all.
There are a lot of files, which makes renaming them all not an option for me unfortunately. If anyone knows what I have to do to get the files to the correct encoding, please let me know.
Update: I've discovered a way to find the files, but I dont understand the encoding pattern. For example a file known as kt-giấy-2.jpg can be viewed directly using kt-gia%CC%82%CC%81y-2.jpg, does anyone know what kind of encoding this is? It doesnt line up with URI encoders.
For anyone that has this issue. My issue was that I transferred the files from Mac Osx to Centos directly through a zip file through Cpanel. The files are fine, but you need to use convmv to change the files. The files were readable, but they werent in the exact encoding.
Mac OSX encodes in NFC, every other os encodes in NFD
use this command in the directory of the files you want to encode differently.
convmv -r -f utf8 -t utf8 --nfc --notest .

Server side: detecting if a user is downloading (save as...) or visualizing a file in the browser

I'm writing an apache2 module
by default and when viewed in a web browser, the module would only print the first lines of a large file and convert them to HTML.
if the user choose to 'download as...', the whole raw file would be downloaded.
Is it possible to detect this choice on the server side ? (for example is there a specific http header set ?).
note: I would like to avoid any parameter in the GET url (e.g: "http://example.org/file?mode=raw" )
Pierre
added my own answer to close the question: as said #alexeyten there is no difference. I ended by a javascript code the alter the index.html file generated by apache.

Programmatically updating file path for sending files with an HTTP Request in Apache JMeter

I am using Apache JMeter 2.7 to load test Liferay. One such test I am creating involves dynamically generating files and uploading them to Liferay's Document and Media portlet. The problem I'm having has nothing to do with Liferay though... I know this because I can upload a document if I type the exact path into the "file path" box of "Send Files With the Request" in an HTTP request. This is not how I need the test to run.
I want the test to run in such a way that I generate a unique file each loop of the test with a different UUID for the file name (I do so in a BeanShell PreProcessor and it does as I want). I have a user defined variable FILENAME that I use to store the file name. In the HTTP Request, for the file path I use the path C:\Installs\Apache Jmeter\apache-jmeter-2.7\bin\${FILENAME} but JMeter does not process the variable.
When I view the Results Tree, I see the error:
java.io.FileNotFoundException: C:\Installs\Apache
Jmeter\apache-jmeter-2.7\bin\${FILENAME} (The system cannot find the
file specified)
Yet, if I hard code the file path (for example ...\bin\doc.txt) and use ${FILENAME} as the value for the title of the document(a parameter I send in the HTTP Request), the document(doc.txt) uploads to the portlet with the string value of FILENAME as the title. This lets me know the right string is stored in the variable FILENAME. From this, I deduce that JMeter simply does not replace variables in the file path for sending files in an HTTP Request. If I am incorrect in this conclusion, please let me know how to fix whatever error I have. Has anyone else had this problem?
I am currently trying to create a workaround by adding a BeanShell PreProcessor to this http request that would dynamically update the filepath with the variable name. I would need to set some variable = vars.get("FILENAME"). Anyone know how to proceed from here to set the HTTP file path programmatically? I'm looking in the API for the answer. Any help would be much appreciated because I am completely stumped right now.
It is failing because you use \${FILENAME}.
This escapes $ so variable is not interpreted.
Solution:
C:\\Installs\\Apache Jmeter\\apache-jmeter-2.7\\bin\\${FILENAME}
(I cannot test as I am on Mac OS);
C:/Installs/Apache Jmeter/apache-jmeter-2.7/bin/${FILENAME}
(this works on Windows sure).

Accessing a resource file from a filesystem plugin on SymbianOS

I cannot use the Resource File API from within a file system plugin due to a PlatSec issue:
*PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB
My understanding of the issue is that:
File system plugins are dlls which are executed within the context of the file system process. Therefore all file system plugins must have the TCB PlatSec privilege which in turn means they cannot link against a dll that is not in the TCB.
Is there a way around this (without resorting to a text file or an intermediate server)? I suspect not - but it would be good to get a definitive answer.
The Symbian file server has the following capabilities:
TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD
So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to.
However, there is a more fundamental reason why you shouldn't be using bafl.dll from within a fileserver plugin: this DLL provides utility functions which interface to the file servers client API. Attempting to use it from within the filer server will not work; at best, it will lead to the file server deadlocking as it attempts to connect to itself.
I'd suggest rethinking that you're trying to do, and investigating an internal file-server API to achieve it instead.
Using RFs/RFile/RDir APIs from within a file server plugin is not safe and can potentially lead to deadlock if you're not very careful.
Symbian 9.5 will introduce new APIs (RFilePlugin, RFsPlugin and RDirPlugin) which should be used instead.
Theres a proper mechanism for communicating with plugins, RPlugin.
Do not use RFile. I'm not even sure that it would work as the path is checked in Initialise of RFile functions which is called before the plugin stack.
Tell us what kind of data you are storing in the resource file.
Things that usually go into resource files have no place in a file server plugin, even that means hardcoding a few values.
Technically, you can send data to a file server plugin using RFile.Write() but that's not a great solution (intercept RFile.Open("invalid file name that only your plugin understands") in the plugin).
EDIT: Someone indicated that using an invalid file name will not let you send data to the plugin. hey, I didn't like that solution either. for the sake of completness, I should clarify. make up a filename that looks OK enough to go through to your plugin. like using a drive letter that doesn't have a real drive attached to it (but will still be considered correct by filename-parsing code).
Writing code to parse the resource file binary in the plugin, while theoratically possible, isn't a great solution either.