started version 0.2, added logging

This commit is contained in:
systopia 2015-02-13 13:35:32 +01:00
parent 5af6e1df18
commit 1c6690351e
7 changed files with 25 additions and 26 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
secrets.php secrets.php
proxy/file_cache proxy/file_cache
debug.log

View File

@ -2,19 +2,19 @@
<extension key="de.systopia.civiproxy" type="module"> <extension key="de.systopia.civiproxy" type="module">
<file>civiproxy</file> <file>civiproxy</file>
<name>CiviProxy</name> <name>CiviProxy</name>
<description>FIXME</description> <description>This will enable CiviProxy support for mailings</description>
<license>FIXME</license> <license></license>
<maintainer> <maintainer>
<author>B. Endres</author> <author>B. Endres</author>
<email>endres@systopia.de</email> <email>endres@systopia.de</email>
</maintainer> </maintainer>
<releaseDate></releaseDate> <releaseDate></releaseDate>
<version>0.1</version> <version>0.2</version>
<develStage>alpha</develStage> <develStage>alpha</develStage>
<compatibility> <compatibility>
<ver>4.4</ver> <ver>4.4</ver>
</compatibility> </compatibility>
<comments>This is a new, undeveloped module</comments> <comments>This is an addition to SYSTOPIA's CiviProxy security system</comments>
<civix> <civix>
<namespace>CRM/Civiproxy</namespace> <namespace>CRM/Civiproxy</namespace>
</civix> </civix>

View File

@ -18,19 +18,6 @@ return array(
'description' => 'Enables or disables the proxy', 'description' => 'Enables or disables the proxy',
'help_text' => 'TODO', 'help_text' => 'TODO',
), ),
'image_cache_enabled' => array(
'group_name' => 'CiviProxy Settings',
'group' => 'de.systopia',
'name' => 'image_cache_enabled',
'type' => 'Integer',
'html_type' => 'Select',
'default' => 0,
'add' => '4.3',
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Enables or disables image cache',
'help_text' => 'TODO',
),
'proxy_url' => array( 'proxy_url' => array(
'group_name' => 'CiviProxy Settings', 'group_name' => 'CiviProxy Settings',
'group' => 'de.systopia', 'group' => 'de.systopia',

View File

@ -1,11 +1,12 @@
{htxt id='id-proxy-enabled'} {htxt id='id-proxy-enabled'}
<p>{ts}TODO #1{/ts}</p> <p>
{/htxt} {ts}Enable CiviProxy{/ts}
{ts}This will cause all resource URLs (images, URL trackers, mail open tracers, etc.) to point to the proxy.{/ts}
{htxt id='id-image-cache-enabled'} </p>
<p>{ts}TODO #2{/ts}</p>
{/htxt} {/htxt}
{htxt id='id-proxy-url'} {htxt id='id-proxy-url'}
<p>{ts}TODO #3{/ts}</p> <p>
{ts}Enter your CiviProxy's URL here{/ts}
</p>
{/htxt} {/htxt}

View File

@ -1,4 +1,5 @@
TODO TODO
1) sanitize string values (mysql_escape_string?) 1) sanitize string values (mysql_escape_string?)
2) restrictions for files? 2) better index page
3) error page

View File

@ -12,8 +12,8 @@
** URLS ** ** URLS **
****************************************************************/ ****************************************************************/
$target_civicrm = 'https://crmtest.muslimehelfen.org'; $target_civicrm = 'https://crmtest.muslimehelfen.org';
//$proxy_base = 'https://ssl.webpack.de/wp11230065.server-he.de'; $proxy_base = 'https://ssl.webpack.de/wp11230065.server-he.de';
$proxy_base = 'http://localhost:8888/proxy'; //$proxy_base = 'http://localhost:8888/proxy';
/**************************************************************** /****************************************************************
@ -29,6 +29,8 @@ $target_open = $target_civicrm . '/sites/all/modules/civicrm/extern/open.php
$target_file = $target_civicrm . '/sites/default/files/civicrm/persist/'; $target_file = $target_civicrm . '/sites/default/files/civicrm/persist/';
$target_mail = $target_civicrm . '/civicrm/mailing/view'; $target_mail = $target_civicrm . '/civicrm/mailing/view';
// CAREFUL: only enable on debug systems. Will log all queries to given PUBLIC file
$debug = NULL; //'debug.log';
/**************************************************************** /****************************************************************

View File

@ -123,6 +123,13 @@ function civiproxy_mend_URLs(&$string) {
* @return TRUE if allowed, FALSE if not (or quits if $quit is set) * @return TRUE if allowed, FALSE if not (or quits if $quit is set)
*/ */
function civiproxy_security_check($target, $quit=TRUE) { function civiproxy_security_check($target, $quit=TRUE) {
global $debug;
if (!empty($debug)) {
$file = fopen($debug, 'a');
fwrite($file, "REQUEST FROM " . $_SERVER['REMOTE_ADDR'] . " ON " . date('Y-m-d H:i:s') . ' -- ' . print_r($_REQUEST,1));
fclose($file);
}
// TODO: implement // TODO: implement
return TRUE; return TRUE;
} }