Войти или зарегистрироваться
  • Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.
  • Данный раздел создан исключительно для релизов! Вопросы по лаунчеру или обвязке задавайте ТОЛЬКО в соответсвующей теме автора. Любые другие темы будут удалены, а авторы понесут наказание.

Веб Скрипт авторизации Joomla 3 и выше(Get)

General

Старожил
Пользователь
Баллы
123
Скрипт не мой, я его лишь модифицировал 3 строки дописал и 4 изменил. Все копирайты сохраняю.
Модифицирован под лаунчер Сашка, т.е чтоб с ним работал.
[Story]
Долго искал хэш паролей новой джумлы.
Найти не удалось, только для старых версий.
Поэтому испрльзовал единственную возможность делать это через get запрос. Да-да есть можно сделать sql запрос, но углубиться в Joomla как-то не очень хотелось хотя бы потому что она хранит один и тот же пароль совершенно не типично и я резко обленился пилить sql запрос после недели безуспешных поисков.
И быстренько перепилил ранее найденный php скрипт для работы с лаунч-сервером.
Скрипт вот так просто на весь мир выкидывать не стоит, скиньте его на локалхост, т.е, доступен только лаунч-серверу.
Скрипт работает без ограничений и бан в скрипте, как и капча не встроена, ибо это невозможно, проще переписать лаунчер.
Поэтому, если у кого-то будет такой скрипт лежать в открытом доступе то подобрать пароль к логину админа будет легко.
Ну я предупредил. И там ниже есть, о том, как позаботиться совсем чуть-чуть, чтобы скрипт не валялся в открытом доступе. Есть способы и проще, но другие у меня не заработали. Воспользовался этим. Ниже увидите.

Соответственно все данные изменены.
<?php
/**
* Joomla! External authentication script
*
* @author vdespa
* @author MyauDesu
* Version 1.0
*
* Code adapted from /index.php
*
* @package Joomla.Site
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
if (version_compare(PHP_VERSION, '5.3.1', '<'))
{
die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!');
}

header("Content-Type: text/plain; charset=UTF-8");
// Verify login and password
$login = $_GET['login'];
$password = $_GET['password'];
if(empty($login) || empty($password)) {
exit('Empty login or password');
}

/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
// Instantiate the application.
$app = JFactory::getApplication('site');
// JFactory
require_once (JPATH_BASE .'/libraries/joomla/factory.php');
// Hardcoded for now
$credentials['username'] = $login;
$credentials['password'] = $password;
/**
* Code adapted from plugins/authentication/joomla/joomla.php
*
* @package Joomla.Plugin
* @subpackage Authentication.joomla
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Get a database object
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id, password')
->from('#__users')
->where('username=' . $db->quote($credentials['username']));
$db->setQuery($query);
$result = $db->loadObject();
if ($result)
{
$match = JUserHelper::verifyPassword($credentials['password'], $result->password, $result->id);
if ($match === true)
{
// Bring this in line with the rest of the system
$user = JUser::getInstance($result->id);
echo 'OK:' . $login;
}
else
{
// Invalid password
// Prmitive error handling
die('Invalid password');
}
} else {
// Invalid user
// Prmitive error handling
die('Cound not find user in the database');
}
?>




А вообще вот мои конфиги nginx'a на всякий(Соответственно все данные изменены.)
server {
listen 80;
server_name site.ru;
server_name_in_redirect on;
server_tokens off;
root /var/nginx/www/sites/oldsite/site.ru/site/site;
access_log /var/nginx/www/sites/oldsite/site.ru/site/access.log;
error_log /var/nginx/www/sites/oldsite/site.ru/site/error.log;
index index.php index.html index.htm;
error_page 404 = http://site.ru/404.html;
#error_page 403 = /15-errors/9-403-forbidden.html;


if ($host = 'www.site.ru' ) {
rewrite ^/(.*)$ $scheme://site.ru/$1 permanent;
}

#allow 127.0.0.1;


#}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}

deny 198.22.98.0/23;
deny 198.22.100.0/22;
deny 198.22.104.0/21;
deny 198.22.112.0/20;
deny 198.22.128.0/17;
deny 198.23.0.0/16;
deny 198.24.0.0/13;
deny 198.32.0.0/14;
deny 198.36.0.0/19;

if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}

if ($http_user_agent ~* msnbot|scrapbot|SputnikBot) {
return 403;
}

if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) )
{
return 403;
}
#location ~* ^/(administrator)($|\/) {deny all; return 404;}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
#Если не использовать эту опцию - то в форумах все будут сидеть под именем первого вошедшего на форум
#fastcgi_hide_header "Set-Cookie";
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;
include /etc/nginx/fastcgi.conf;
}

location = /authen.php {
deny all;
return 404;
}

location = /nginx.conf {
log_not_found off;
access_log off;
return 404;
break;
}
location = /nginx.conf.admintools {
log_not_found off;
access_log off;
return 404;
break;
}

set $file_injection 0;
if ($query_string ~ "[a-zA-Z0-9_]=http://") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
set $file_injection 1;
}
if ($file_injection = 1) {
return 403;
break;
}

if ($query_string ~ "\=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}") {
return 403;
break;
}

location = /configuration.php-dist {
log_not_found off;
access_log off;
return 404;
break;
}
location = /htaccess.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config {
log_not_found off;
access_log off;
return 404;
break;
}
location = /configuration.php {
log_not_found off;
access_log off;
return 404;
break;
}
location = /CONTRIBUTING.md {
log_not_found off;
access_log off;
return 404;
break;
}
location = /joomla.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /LICENSE.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /phpunit.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /README.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config.txt {
log_not_found off;
access_log off;
return 404;
break;
}

add_header X-Frame-Options SAMEORIGIN;

#index index.php index.html index.htm;

location ~* \.(css|js)$ {
access_log off; log_not_found off;
expires 1w;
}

location ~* \.(bmp|gif|jpg|jpeg|jp2|png|svg|tif|tiff|ico|wbmp|wbxml|smil)$ {
access_log off; log_not_found off;
expires 1M;
}

location ~* \.(pdf|txt|xml)$ {
access_log off; log_not_found off;
expires 1M;
}

location ~* \.(mid|midi|mp3|m4a|m4r|aif|aiff|ra|wav|voc|ogg)$ {
access_log off; log_not_found off;
expires 1M;
}

location ~* \.(swf|vrml|avi|mkv|mpg|mpeg|mp4|m4v|mov|asf)$ {
access_log off; log_not_found off;
expires 1M;

gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied expired no-cache no-store private auth;
gzip_min_length 1000;
gzip_http_version 1.1;
gzip_types text/plain text/css application/xhtml+xml application/xml+rss application/rss+xml application/x-javascript application/javascript text/javascript application/json text/xml application/xml image/svg+xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control "no-transform";

client_header_timeout 10;
client_body_timeout 10;
send_timeout 30;
keepalive_timeout 30s;

connection_pool_size 8192;
client_header_buffer_size 4k;
large_client_header_buffers 8 8k;
request_pool_size 8k;

sendfile on;
sendfile_max_chunk 1m;
postpone_output 0;
tcp_nopush on;
tcp_nodelay on;

output_buffers 8 32k;

charset utf-8;
source_charset utf-8;

ignore_invalid_headers on;

client_max_body_size 1G;
set $common_exploit 0;
if ($query_string ~ "proc/self/environ") {
set $common_exploit 1;
}
if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
set $common_exploit 1;
}
if ($query_string ~ "base64_(en|de)code\(.*\)") {
set $common_exploit 1;
}
if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
set $common_exploit 1;
}
if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($common_exploit = 1) {
return 403;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /index.php$ {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_akeeba\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_admintools\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_joomlaupdate\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location ~* ^/templates\/prostar/.*$
{
break;
}

location ~* ^/administrator/(components|modules|templates|images|plugins)/.*.(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|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/administrator$ {
return 301 /administrator/index.php;
}
location ~* ^/administrator/$ {
return 301 /administrator/index.php;
}


location ~* /administrator.*$ {


if (-e $request_filename) {
return 403;
}

try_files $uri $uri/ /administrator/index.php?$args;
}

location ~* ^/(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*.(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|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/includes/js/ {
return 403;
}
location ~* ^/(cache|includes|language|logs|log|tmp)/ {
return 403;
}

location ~* ^/.*$ {
try_files $uri $uri/ /index.php?$args;
}
}
Гайд по настройке доступа к файлу без долгих мучений(на апаче .htaccess помощь, в две минуты) (Здесь немного извращений, но работает и работает отлично. Т.е для локал хоста можно снять все огр., если это необходимо в один файл.
Для локалхоста
1. копируем файл site.conf
1.2 меняем имя файла например на localhost.conf
1.3 Кладём к nginx'y в папку /etc/nginx/conf.d //На линуксе.
//все действия происходят в новом файле.
2. Меняем значение переменной server_name на 127.0.0.1 localhost;
Т.е вот так server_name 127.0.0.1 localhost;

3. Удаляем запрет на файл авторизации из файла конфига локалхоста
Код:
location = /authen.php {
        deny all;
        return 404;
}
4. Меняем authProvider в конфиге(LaunchServer.cfg) лаунч-сервера
//url может отличаться в зависимости от расположение, скрипту(authen.php) лучше лежать в корне сайта. Тогда всё совпадает с гайдом.
Код:
authProvider: "request";
authProviderConfig: {
url: "http://localhost/authen.php?login=%login%&password=%password%";
response: "OK:(?<username>.+)";
};
Кое-чего потерял из-за того, что авторизация слетела, но как-то более менее компенсировал.
 
Последнее редактирование:
P.S Кое-чего потерял это все комментарии к конфигам. Огр. 15 000 символов.
Вот конфиг с комментами:
server {
listen 80;
server_name site.ru;
server_name_in_redirect on;
server_tokens off;
root /var/nginx/www/sites/oldsite/site.ru/site/site;
access_log /var/nginx/www/sites/oldsite/site.ru/site/access.log;
error_log /var/nginx/www/sites/oldsite/site.ru/site/error.log;
index index.php index.html index.htm;
error_page 404 = http://site.ru/404.html;
#error_page 403 = /15-errors/9-403-forbidden.html;
# Support Clean (aka Search Engine Friendly) URLs

######################################################################
## Redirect www to non-www
######################################################################
if ($host = 'www.site.ru' ) {
rewrite ^/(.*)$ $scheme://site.ru/$1 permanent;
}
# location /administrator {
#allow 127.0.0.1;
# deny all;
# return 404;
#}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
# Но если вдруг окажется, что нет, то вот весь диапозон buildwith.com.
# Если решили перестраховаться и вписать весь диапозон, то предыдущий IP
# вписывать не надо, он входит в диапозон ниже:
deny 198.22.98.0/23;
deny 198.22.100.0/22;
deny 198.22.104.0/21;
deny 198.22.112.0/20;
deny 198.22.128.0/17;
deny 198.23.0.0/16;
deny 198.24.0.0/13;
deny 198.32.0.0/14;
deny 198.36.0.0/19;
# Блокируем менеджеры загрузки
if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}
# Блокируем некоторые типы ботов
if ($http_user_agent ~* msnbot|scrapbot|SputnikBot) {
return 403;
}
# Секция server
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) )
{
return 403;
}
#location ~* ^/(administrator)($|\/) {deny all; return 404;}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
#Если не использовать эту опцию - то в форумах все будут сидеть под именем первого вошедшего на форум
#fastcgi_hide_header "Set-Cookie";
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;
include /etc/nginx/fastcgi.conf;
}
### ===========================================================================
### Security Enhanced & Highly Optimized NginX Configuration File for Joomla!
### automatically generated by Admin Tools 3.8.3 on 2016-05-08 08:57:33 GMT
### ===========================================================================
###
### Admin Tools is Free Software, distributed under the terms of the GNU
### General Public License version 3 or, at your option, any later version
### published by the Free Software Foundation.
###
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
### !! !!
### !! If you get an Internal Server Error 500 or a blank page when trying !!
### !! to access your site, remove this file and try tweaking its settings !!
### !! in the back-end of the Admin Tools component. !!
### !! !!
### !! Remember to include this file in your site's configuration file. !!
### !! Also remember to reload or restart NginX after making any change to !!
### !! this file. !!
### !! !!
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
###
### Prevent access to this file

location = /authen.php {
deny all;
return 404;
}

location = /nginx.conf {
log_not_found off;
access_log off;
return 404;
break;
}
location = /nginx.conf.admintools {
log_not_found off;
access_log off;
return 404;
break;
}
######################################################################
## Protect against common file injection attacks
######################################################################
set $file_injection 0;
if ($query_string ~ "[a-zA-Z0-9_]=http://") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
set $file_injection 1;
}
if ($file_injection = 1) {
return 403;
break;
}
######################################################################
## Disable PHP Easter Eggs
######################################################################
if ($query_string ~ "\=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}") {
return 403;
break;
}
######################################################################
## Block access to configuration.php-dist and htaccess.txt
######################################################################
location = /configuration.php-dist {
log_not_found off;
access_log off;
return 404;
break;
}
location = /htaccess.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config {
log_not_found off;
access_log off;
return 404;
break;
}
location = /configuration.php {
log_not_found off;
access_log off;
return 404;
break;
}
location = /CONTRIBUTING.md {
log_not_found off;
access_log off;
return 404;
break;
}
location = /joomla.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /LICENSE.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /phpunit.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /README.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config.txt {
log_not_found off;
access_log off;
return 404;
break;
}
## Protect against clickjacking
add_header X-Frame-Options SAMEORIGIN;
######################################################################
## Directory indices and no automatic directory listings
## Forces index.php to be read before the index.htm(l) files
## Also disables showing files in a directory automatically
######################################################################
#index index.php index.html index.htm;
######################################################################
## Set default expiration time
######################################################################
# CSS and JavaScript : 1 week
location ~* \.(css|js)$ {
access_log off; log_not_found off;
expires 1w;
}
# Image files : 1 month
location ~* \.(bmp|gif|jpg|jpeg|jp2|png|svg|tif|tiff|ico|wbmp|wbxml|smil)$ {
access_log off; log_not_found off;
expires 1M;
}
# Document files : 1 month
location ~* \.(pdf|txt|xml)$ {
access_log off; log_not_found off;
expires 1M;
}
# Audio files : 1 month
location ~* \.(mid|midi|mp3|m4a|m4r|aif|aiff|ra|wav|voc|ogg)$ {
access_log off; log_not_found off;
expires 1M;
}
# Video files : 1 month
location ~* \.(swf|vrml|avi|mkv|mpg|mpeg|mp4|m4v|mov|asf)$ {
access_log off; log_not_found off;
expires 1M;
}######################################################################
## Automatic compression of static resources
## Compress text, html, javascript, css, xml and other static resources
## May kill access to your site for old versions of Internet Explorer
######################################################################
# The following is the actual automatic compression setup
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied expired no-cache no-store private auth;
gzip_min_length 1000;
gzip_http_version 1.1;
gzip_types text/plain text/css application/xhtml+xml application/xml+rss application/rss+xml application/x-javascript application/javascript text/javascript application/json text/xml application/xml image/svg+xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
######################################################################
## Reduce MIME type security risks
add_header X-Content-Type-Options "nosniff";
## Reflected XSS prevention
add_header X-XSS-Protection "1; mode=block";
## Prevent content transformation
add_header Cache-Control "no-transform";
# -- Timeout handling, see http://wiki.nginx.org/HttpCoreModule
client_header_timeout 10;
client_body_timeout 10;
send_timeout 30;
keepalive_timeout 30s;
# -- Socket settings, see http://wiki.nginx.org/HttpCoreModule
connection_pool_size 8192;
client_header_buffer_size 4k;
large_client_header_buffers 8 8k;
request_pool_size 8k;
# -- Performance, see http://wiki.nginx.org/HttpCoreModule
sendfile on;
sendfile_max_chunk 1m;
postpone_output 0;
tcp_nopush on;
tcp_nodelay on;
# -- Output buffering, see http://wiki.nginx.org/HttpCoreModule
output_buffers 8 32k;
# -- Character encoding, see http://wiki.nginx.org/HttpCharsetModule
charset utf-8;
source_charset utf-8;
# -- Security options, see http://wiki.nginx.org/HttpCoreModule
ignore_invalid_headers on;
# -- Maximum client body size set to 1 Gigabyte
client_max_body_size 1G;
set $common_exploit 0;
if ($query_string ~ "proc/self/environ") {
set $common_exploit 1;
}
if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
set $common_exploit 1;
}
if ($query_string ~ "base64_(en|de)code\(.*\)") {
set $common_exploit 1;
}
if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
set $common_exploit 1;
}
if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($common_exploit = 1) {
return 403;
}
## Enable SEF URLs
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /index.php$ {
fastcgi_pass 127.0.0.1:9000;
break;
}
######################################################################
## Advanced server protection rules exceptions
######################################################################
location = /administrator\/components\/com_akeeba\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_admintools\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_joomlaupdate\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location ~* ^/templates\/prostar/.*$
{
break;
}
#location ~* ^/administrator\/.*$
#{
# return 404;
#}
######################################################################
## Advanced server protection
######################################################################
# Allow media files in select back-end directories
location ~* ^/administrator/(components|modules|templates|images|plugins)/.*.(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|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/administrator$ {
return 301 /administrator/index.php;
}
location ~* ^/administrator/$ {
return 301 /administrator/index.php;
}
# Disable access to everything else.
# Disable access to everything else.
location ~* /administrator.*$ {
# If it is a file, directory or symlink and I haven't deliberately
# enabled access to it, forbid any access to it!
if (-e $request_filename) {
return 403;
}
# In any other case, just treat as a SEF URL
try_files $uri $uri/ /administrator/index.php?$args;
}
# Allow media files in select front-end directories
location ~* ^/(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*.(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|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
## Disallow front-end access for certain Joomla! system directories (unless access to their files is allowed above)
location ~* ^/includes/js/ {
return 403;
}
location ~* ^/(cache|includes|language|logs|log|tmp)/ {
return 403;
}
# Disable access to everything else.
location ~* ^/.*$ {
# If it is a file, directory or symlink and I haven't deliberately
# enabled access to it, forbid any access to it!
#if (-e $request_filename) {
# return 403;
#}
# In any other case, just treat as a SEF URL
try_files $uri $uri/ /index.php?$args;
}
##### Advanced server protection -- END
}
 
Последнее редактирование:
что-то у меня не заработало на Joomla 3.8
вот немного другой вариант авторизации для sashok724's Launcher v3
тот же request, с теми же параметрами, что и постом выше.

проверял на Joomla 3.8
Код:
<?php
define('_JEXEC', 1);

if (file_exists(__DIR__ . '/defines.php'))
{
   include_once __DIR__ . '/defines.php';
}

if (!defined('_JDEFINES'))
{
   define('JPATH_BASE', __DIR__);
   require_once JPATH_BASE . '/includes/defines.php';
}

require_once JPATH_BASE . '/includes/framework.php';
$app = JFactory::getApplication('site');

@$username = $_GET['login'];
@$password = $_GET['password'];
$credentials = array( 'username'=>$username, 'password'=>$password );
if( JFactory::getApplication()->login( $credentials )){echo "OK:$username";}
else {echo "Ошибка авторизации";}
?>
Но способы так себе конечно. По хорошему их бы надо допилить. Тем же гет запросом как вариант передавать секретный ключ, и добавить проверку бана. Руки дойдут, может займусь этим. В любом случае, как сказано выше, обязательно закрыть доступ к файлу из вне. Дабы ограничить доступ злоумышленникам.
 
Последнее редактирование:
Долго искал хэш паролей новой джумлы.
Найти не удалось, только для старых версий.
Поэтому испрльзовал единственную возможность делать это через get запрос. Да-да есть можно сделать sql запрос, но углубиться в Joomla как-то не очень хотелось хотя бы потому что она хранит один и тот же пароль совершенно не типично и я резко обленился пилить sql запрос после недели безуспешных поисков.
И быстренько перепилил ранее найденный php скрипт для работы с лаунч-сервером.

Зря вам погружаться в джумлу не захотелось. Джумла это не валенок где прям полезай и шарь там в базе жёлтыми руками - там все пароли солёные и просто так их не выковырять и не проверить руками без самой джумлы.
Всё что надо было - подключить свой скрипт к фреймворку джумлы и воспользоваться имеющимся хелпером JUserHelper::verifyPassword для проверки паролей.

//подключаем фреймворк джумлы
if (!defined('_JEXEC')) {//подключение к Joomla
define('_JEXEC', 1);
define('JPATH_BASE', dirname(dirname(dirname(__FILE__))));
define('DS', DIRECTORY_SEPARATOR);
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
}

//Лезем в базу аднных проверять логин и пароль
$user = JFactory:: getUser($userLogin);//Ищем пользователя с таким ником в базе данных
if ($user->id != 0) {//если пользователь найден на сайте

//Проверяем пароль
$verifyPass = JUserHelper::verifyPassword($userPassword, $user->password, $user->id); //Проверем правильность пароля
if($verifyPass) {//Если пароль правильный
//Выполняем нужные действия
.....//
 
Легко. Просто алгоритм проверки надо чекнуть в коде. Если не устарело то вот https://github.com/alexandrage/Fix-Sashok/blob/master/site/launcher.php#L659
А потом жумла обновиться и всё опять будет надо переписывать) Лучше пользовать специально для этого предназначенный механизм.
 

Поделиться этой страницей

Назад
Верх