Support is online

htaccess blocks import #7942

Open Eikka opened this topic Friday, 08 January 2016 · 12 replies
Author

hi, I have made htaccess file with Akeeba Admin tools and something on it block import but not export.
Which php.files need direct access to import to work?

I have tested htaccess code by removing parts of it and the blocking happens somewhere in following code:

Back-end protection

RewriteRule ^administrator/?$ - [L]
RewriteRule ^administrator/index.(php|html?)$ - [L]
RewriteRule ^administrator/index[23].php$ - [L]
RewriteRule ^administrator/(components|modules|templates|images|plugins|files)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|msi|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|krh|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|EOT)$ - [L]
RewriteRule ^administrator/ - [F]

Allow limited access for certain Joomla! system directories with client-accessible content

RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts|files|cache)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|msi|ttf|woff|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|EOT|krh)$ - [L]
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts|files|cache)/ - [F]

Disallow front-end access for certain Joomla! system directories (unless access to their files is allowed above)

RewriteRule ^includes/js/ - [L]
RewriteRule ^(cache|includes|language|logs|log|tmp)/ - [F]
RewriteRule ^(configuration.php|CONTRIBUTING.md|htaccess.txt|joomla.xml|LICENSE.txt|phpunit.xml|README.txt|web.config.txt) - [F]

Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed

RewriteCond %{REQUEST_FILENAME} (.php)$
RewriteCond %{REQUEST_FILENAME} !(/index[23]?.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*.php)$ - [F]

Disallow access to htaccess.txt, php.ini and configuration.php-dist

RewriteRule ^(htaccess.txt|configuration.php-dist|php.ini)$ - [F]

adding csv to allowed file types dont help

Eikka,
https://www.esoft.fi

Support

Hello,

Which php.files need direct access to import to work?

administrator/components/com_csvi/rantai/rantai.php that is the entry point for the import.

adding csv to allowed file types dont help

That is because you are not calling a csv file but a php file ;)

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

That helped. Thanks

Eikka,
https://www.esoft.fi

Author

Hi,
as I said manual Imports now works but I noticed that cron jobs don't
With 5.x version they worked fine and I have updated all of them to new format
php "/home/xxxx/public_html/administrator/components/com_csvi/helper/cron.php" --key="x" --template_name="xx" --file="/home/esoftfi/public_html/files/xxx.csv"
but nothing happens with them. I cannot even found anything in error log.
Is there also some file which should be allowed to access directly? Allowin direct access to /administrator/components/com_csvi/helper/cron.php wont help

Eikka,
https://www.esoft.fi

Support

Hello,

Does the cron job work if you run it manually or turn off the htaccess?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

turning off htaccess doesn't help but running job from putty console it worked fine also htaccess restrictions turned on.

Eikka,
https://www.esoft.fi

Support

In that case you need to check if the path to the PHP executable is correct I think. Usually only using php isn't enough and needs to be something like /usr/local/bin/php or a variation on that depending on how the system is setup.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

I have other scripts like Akeeba backup which all works fine with just php. Also CSVI version 5 cronjobs worked fine with just php. And also if I add swich -a to this job the email result is the same before but tells also "interactive mode enabled". All that proves that php runs properly

Eikka,
https://www.esoft.fi

Support

So the email only said "interactive mode enabled" and nothing else? What I am looking for is to see if the script is even triggered.

If you run the cron job with the --help switch, do you get the help text?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

yes I get the help text, help comes with your plugin help included and if I try to run cron job without key, result tells that cron job cannot be ran if secret key is not defined. Everything elese works fine but those jobs don't run. They are not visible on csvi log (when run from putty logs are created) and jobs don't make modifications to products

Eikka,
https://www.esoft.fi

Author

actually I think this is excatly the same problem that betterlead has described in "Setting up cron job"
https://www.csvimproved.com/forum?view=category&catid=44&id=32681

I have just the same error message when added -f to command row and if -f not added everyhing looks like they work but still dont

Eikka,
https://www.esoft.fi

Author

hi,
finally for some reason /usr/local/bin/php helped.

Eikka,
https://www.esoft.fi

Support

Hello,

That can help because it is usually a different PHP version.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Log in to reply to this topic.