Impresspages file uploads mask - impresspages

Linux server, running suphp with Apache 2.2.22 and PHP5.5.17
When I upload an image using the image widget, it is stored in a date-based path under /file
the path directories are created with properties of -rwx------, and the file is stored with properties of -rw-------
This works fine when I am traversing the directory using shell, but Apache can't see the files, as it runs as not me.
What is a safe file into which I can add umask(002); that will be early enough in the application logic, but won't get overridden by updates? Can I create a Plugin and make it the only thing in the routes.php? Can I put this in my Theme file?

There is no such setting in ImpressPages yet. I guess you have to configure your Linux to use the right mask by default. Have you seen such a setting on other CMSs or Frameworks?

Related

BlueZ: Change local storage directory

By default, BlueZ stores its persistent data in /var/lib/bluetooth. This includes controller settings and information about paired devices. However, I'm working in a system where the /var directory is unreliable, so I wonder if there is any way I can change this directory?
I have seen examples where it can be changed during installation, with the "--localstatedir" flag, but I'm looking for a solution that doesn't require reinstallation.
Without reinstalling its not possible. Path is configured at compile time so recompilation and installation is required. You can replace STORAGEDIR macro with string which is read from main.conf to different path at runtime. After modifying these changes you can restart bluetoothd every time you change path then it works.

Accessing absolute file paths from linux kernel driver in the context of application calling from a chroot

Linux Driver question.
I have an application effectively calling into my kernel module.
The kernel module has to read files from a specific absolute path, during the call from the application.
This all works fine under normal conditions.
The problem occurs when the application is being run from a chroot.
At that point, running within the context of the application that is running from chroot, my driver no longer has access to the absolute path for the file it must read.
The driver is using filp_open() to open the file, which fails when application is running from chroot.
Is there way for me to specify the root for my file opens to use without disturbing the application's chroot, or causing races with the application accessing other files within the chroot.
The Linux version is centos 7.1 kernel 3.10.0-229-el7.x86_64
Any info greatly appreciated.
This took a lot of crawling around through the kernel code, but I figured out how to this.
First I needed to use get_fs_root(init_task.fs, &realrootpath)
This gets the real root path, not the chroot path.
Then I needed to lookup the file name using filename_lookup() setting namei data to my rootpath and passing in the LOOKUP_ROOT flag so it looks it up from the real root path.
Finally I had to use dentry_open() to open the file using the path I looked up.
At this point I could access and read a file that outside the current tasks chroot environment.

Php extension not loaded

Using a .user.ini file with extension=geoip.so (or mysqli.so) I'm trying unsuccessfully to load the relevant module: in the phpinfo() page of Php 7.1 (or even Php5.4) the module is never shown.
1) The .user.ini file is working correctly because I'm able to modify the variable memory_limit.
2) The phpinfo() function correctly shows the extension_dir folder containing .so extensions that I want to load (in the php.ini file this variable is not present, however).
3) The php error log contains no message.
Every suggestion is welcome.
The .user.ini files can only set certain PHP ini settings. It just so happens that the extension setting is not one of them. In fact, according to the manual, the extension setting is only valid in the core php.ini file. So put the extension=geoip.so in your main php.ini file.
As a side note: I use Ubuntu/Debian for most of what I do with PHP. The standard PHP distro that is available through the Debian package archives has extra code compiled into it that allows for a distributed configuration. The way this works is the SAPI module scans a conf.d directory and includes any ini files. Typically when you package an external PHP extension for Debian (which I might add is a pain - I've done it for my own extensions) you include a little ini file that includes the extension (e.g. extension=myext.so). The package installs it in the distributed config directory and it is included into the php.ini file when PHP spins up. Perhaps you meant to install a Debian-based config like this?
Another side note: Since you are probably using a CGI SAPI and might want different sites to load different modules (exclusively), you could perhaps look into getting the Web server to point the CGI PHP at a different php.ini file. I'm just presuming you want to achieve something like this. However loading modules for certain directories using .user.ini files is just not possible.
Try disable or configure selinux. Check selinux audit log.

Make Apache virtual directory from the contents of a zip file

I have a couple of compressed zip file with static HTML content (e.g. a directory tree of documentation with several static html pages that link to each other, images, css, etc.) For instance, the javadoc zip file serves as an equivalent example for my purpose.
My question is, if there's an apache module that would allow apache to "mount" a zip file as a virtual directory, whose contents are those of the zip file. The operating system in which I'm hosting apache is Mac OS X Snow Leopard.
There is a zip filesystem for FUSE, which is supported on OS X via the MacFUSE project. This will let you mount a zip file via the mount command, thus allowing Apache -- or any other application -- to access its contents as a normal directory.
I don't have my Mac handy at the moment so I can't actually test it out.
I'm not aware of any existing Apache modules to do this, but you could implement it without touching Apache internals by adding a CGI script which handles access to ZIP archives:
Action zip-archive /cgi-bin/ziphandler.cgi
AddHandler zip-archive .zip
This will make ziphandler.cgi get called for all accesses to .zip files, or (more importantly!) to files in "directories" under .zip files. From there, it should be pretty straightforward.
Using proxy_http you can forward requests to Jetty which will serve any ZIP file.
Download Jetty Runner from here: http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-runner
You can run it using e.g. java -jar jetty-runner-9.3.0.M2.jar --port 8082 myZIPFile.zip. Now set up Apache to forward requests to localhost:8082. You can do that for even only one subdirectory.

Build and Debug application outside the default package

If I try to build an application with the application class outside the default package, so the application file path is /app/AppClass.mxml instead of /AppClass.mxml (as would normally be the case), Flash builder cannot launch the application for debugging because it is looking for the SWF in debug/app/AppClass.swf and the SWF is being output to debug/AppClass.swf instead. Changing the output folder to debug/app makes it put the swf in debug/app, but then it puts the application configuration file "AppClass-app.xml" in /debug/app/app and then that can't be found.
Is there a way to change only the SWF output folder, or the location of the xml configuration file in the run-configuration?
You may use symbolic link to created swf file - http://en.wikipedia.org/wiki/Symbolic_link
for example for Windows :
cd project/path/bin-debug/package/path/
MKLINK ClassName.swf project/path/bin-debug/ClassName.swf
and it's work
or you can use symbolic link for folder:
cd project/path/bin-debug/package/
MKLINK path project/path/bin-debug/ /D
I think I remember this worked for me. But it was long time ago. And, yes, it is a known problem, I also recall Adobe people mentioning it as a limitation of FB.
In my Ant script, you'll need to do the adjustments to reflect your actual file names and directory structure. Also note that it will make it more cumbersome to debug it from FB. You'll need to use the debugging target in Ant, and then connect the debugger to the running application (so that some info, especially on the startup) will be lost. The only way you would be able to debug it, though I've never tried it, is with the commandline tools (I'm not sure of adl syntax for breakpoints / printing / stack frames, so idk how to do it.
Also, for the released application you will probably want to change the signing mechanism.