Joomla访问控制和修改的index.php

发布于 2024-12-11 17:53:30 字数 609 浏览 0 评论 0原文

我正在使用 Joomla 网站,该网站的 index.php 文件已被修改以更改默认的访问控制行为。请记住这是 Joomla 1.5,这一行:

$mainframe->authorize($Itemid);

已包含在一些条件代码中,用于查找远程 IP,并且如果 IP 在白名单范围内,则不会调用 authorize() [*] 。这是为了允许在不登录的情况下无缝访问某些资源。

虽然我是 Joomla 开发的新手,但我猜这不是最好的方法。其一,这可能意味着在未来 Joomla 升级时重新修补 index.php。拦截身份验证检查的最佳替代方法是什么?

[*] 这是另一个谜团:IP 管理通过一个名为“IP 过滤器”的组件在前端进行。 components/com_ipfilter 处有一个完全空的目录,但 administrator/components/com_ipfilter 处有一个功能更丰富的目录。该组件将数据存储在名为kip_filters 的表中(为什么是“k”?),并且组件清单文件中列出的authorUrl 会转到一个看起来像垃圾邮件的药品页面。一切都相当令人担忧...

I'm working with a Joomla site, whose index.php file has been modified to alter the default access control behaviour. Bearing in mind this is Joomla 1.5, this line:

$mainframe->authorize($Itemid);

has been wrapped in some conditional code that looks up the remote IP and doesn't call authorize() if the IP is within a whitelisted range [*]. This is to allow seamless access to certain resources without logging in.

Although I'm new to Joomla development, I'm guessing this isn't the best way of doing that. For one, it probably means re-patching index.php in the event of a future Joomla upgrade. What's the best alternative approach to intercepting the authentication check?

[*] This is another mystery: the IP management takes place on the front-end via a component called 'IP filters'. There's a totally empty directory at components/com_ipfilter, but a more featureful-looking one at administrator/components/com_ipfilter. The component stores data in a table named kip_filters (why the 'k'?) and the authorUrl listed in the component's manifest file goes to a spammy-looking like pharma page. All quite worrying ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

花期渐远 2024-12-18 17:53:30

您正在寻找的是一个不需要破解任何文件的系统插件。您可以使用相当多的系统事件来触发插件并进行 IP 测试,然后确定是继续显示页面还是将访问者重定向到某种警告页面。

查看有关系统事件的文档 - http://docs.joomla.org/Plugin/Events /System

--- 更多细节 ---

查看 API 执行顺序,对 authorize() 的调用无论如何都会发生 (http://docs.joomla. org/API_Execution_Order)。由于默认行为是调用authorize(),因此您必须欺骗它返回肯定响应。

您的插件应该由 onAfterInitialise 触发,并且您应该操作 JUser。当您调用 authorize() 时,该函数需要一个从 JUser 对象和 getuser() 函数获取的用户 ID。您所需要做的就是创建一个具有所需权限的用户,然后让插件设置用户 ID,以便 authorize() 返回 true。

What you are looking for is a system plugin which would not require hacking any files. There are quite a few system events that you can use to trigger your plugin and do your IP test, then determine whether to continue displaying the page or redirecting the visitor to some sort of warning page.

Take a look at the documentation on system events - http://docs.joomla.org/Plugin/Events/System

--- More detail ---

Looking at the API execution order, the call to authorize() is going to happen no matter what (http://docs.joomla.org/API_Execution_Order). Since the default behavior is to call authorize() you are going to have to trick it into returning a positive response.

Your plugin should be triggered by onAfterInitialise and you should manipulate JUser. When you call authorize() the functions needs a user id which it gets from the JUser object and the getuser() function. All you need to do is create a user with the permissions you want, then have the plugin set the user ID so that authorize() returns true.

花想c 2024-12-18 17:53:30

对于安全问题,你可以使用这些步骤,我也会给你一个很好的 ip 过滤组件:

首先,这是你可以为 joomla 拥有的最重要的组件:
http://extensions.joomla.org/extensions /access-a-security/site-security/site-protection/16363
它为您提供了避免任何黑客攻击、垃圾邮件或 php 错误的最重要方法,并且还为您的 joomla 网站提供非常快速的升级:) 它还提供了 IP 黑名单管理器,这是解决您问题的完整解决方案。

希望这篇文章能给某人带来光明!
问候,
雷德·拉比

For the security problems you can use these steps and i will give you a good ip filter component as well :

First of all this is the most important component you can have for joomla :
http://extensions.joomla.org/extensions/access-a-security/site-security/site-protection/16363
it gives you the most important ways to avoid any hacking or spamming or php bugs and also provide a very fast upgrade for your joomla site :) also it offering a IP Blacklisting manager which is a complete solution for your problem.

Hope this post will give someone a light !
Regards,
Raeed Rabie

小猫一只 2024-12-18 17:53:30

我建议将表前缀从 jos_ 更改为随机名称,例如 hsfdaghadfg_

您也可以 重新定位您的配置文件以提高安全性。

I'd advise changing your table prefix from jos_ to something random, like hsfdaghadfg_

You can also relocate your configuration file for extra security.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文