保护我自己的管理面板

发布于 2024-12-02 22:30:35 字数 383 浏览 2 评论 0原文

我需要一些方法来保护我自己的 php 管理面板。我在这里读到一些内容:

  • 使用 apache2.conf 进行简单身份验证
  • 使用 ssl 发送加密密码
  • 在完全独立的域上托管工具
  • 还应该使用适当的 robots.txt
  • 当我想使用并执行 chmod 000 时使用 chmod 777我完成了

但是每个人都有问题。 如果我想用 apache2.conf 来做到这一点,我也必须使用 ssl。只有这样才安全吗?

如果我上传其他域中的工具并使用robots.txt“隐藏”它们,有人可以找到它们吗?

使用 chmod 就像“非专业

您使用什么来保护您的管理面板?

I need ways to securize my own php administration panel. I read here about some:

  • A simple authentication using apache2.conf
  • Using ssl to send encrypted passwords
  • Host the tools on a completely seperate domain
  • A proper robots.txt should also be used
  • Using chmod 777 when i want to use and do a chmod 000 when i finish

But eachone has problems.
If i want to do it with apache2.conf, i must use ssl too. Only with this is it secured?

If i upload the tools in other domain and use robots.txt to "hide" them, could someone find them?

Using chmod is like "non-professional"

What do you use to secure your administration panel?

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

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

发布评论

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

评论(2

深海不蓝 2024-12-09 22:30:35

但是每个人都有问题。如果我想用 apache2.conf 来做,我
也必须使用ssl。只有这样才安全吗?

有点像。如果您不使用 ssl,密码会通过网络以未加密的方式发送,如果有人监听您的通信,他们就会知道密码。话虽如此,除非参与方之一已经受到威胁,或者您正在通过不安全的介质(例如未加密的公共无线局域网)进行通信,否则别人通常不可能监听您与服务器的通信。

如果我上传其他域中的工具并使用robots.txt“隐藏”
他们,有人能找到他们吗?

是的,如果他们猜出网址的话。 robots.txt 只是让您远离搜索引擎,但它并不能保护您的管理面板免受不必要的访问。

使用 chmod 就像“非专业”

并且不安全。这意味着每当您在管理面板上工作时,其他人也可以。不要这样做。

你用什么?

使用 SSL 的 Apache 访问控制(通过全局配置或 .htaccess 文件)。一开始设置可能有点痛苦,但对于给定的问题,这确实是唯一有意义的选择。

But eachone has problems. If i want to do it with apache2.conf, i
must use ssl too. Only with this is it secured?

Sort of. If you don't use ssl, passwords are sent over the net unencrypted if someone is listening in on your communication, they will know the password. That being said, it is usually impossible for someone to listen to your communication with the server unless one of the participating parties has already been compromised or you are communicating through an unsafe medium like unencrypted public wlan.

If i upload the tools in other domain and use robots.txt to "hide"
them, could someone find them?

Yes, if they guess the URL. robots.txt just hides you from search engines, but it does not work for protecting your admin panel from unwanted access.

Using chmod is like "non-professional"

And unsafe. It means that whenever you are working on the admin panel, everyone else also can. Don't do this.

What do you use?

Access control with Apache (either through the global config or an .htaccess file) with SSL. It may be a bit painful to set up at first, but for the given problem, it really is the only choice that makes any sense.

半山落雨半山空 2024-12-09 22:30:35

您可以做的是使用需要您登录或注册您的网站的 php 类。您可以通过快速 Google 找到大量信息。

然后,您应该在您的网站上创建一个 API,仅在您通过身份验证后才发送回数据。下面是一个从 MySQL 数据库读取数据的示例:

<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/accounts.class.php"; //Change this to the path to your authentication script
header("Content-Type: application/json"); //Important if you're using json
$account = new Accounts(); //A fictional Accounts class is opened
$json = array();
if (!$account->authenticated or $account->rights != "administrator") { //Ask the class if the user is not an admin
    $json = array(
        "error" => "Not an administrator"
    );
} else {
    $query = mysqli_query($link, "SELECT * FROM example"); //Assuming you use mysqli and there's a table called example
    if (!$query or mysqli_num_rows($query) < 1) {
        $json = array(
            "error" => "Query returned no results"
        );
    } else {
        while ($row = mysqli_fetch_array($query)) { //Read the data from the table
            $json[] = $row;
        }
    }
}
echo json_encode($json); //Send the data as a json string

请记住,上面的代码只是如何执行此类脚本的示例。您需要修改它才能与您正在使用的类和数据库一起使用。
现在,您可以制作自己的程序供自己内部使用,用于登录 API 并从中查询数据。这可以是在内部服务器、Windows 程序或智能手机应用程序上运行的网站。它需要做的就是填写登录网页上的表单,然后向上面的脚本发送 HTTP 请求并解码 json 结果。

What you could do is use a php class that requires you to log in or sign up to your Website. You can find plenty from a quick Google.

Then, you should make an API on your Website that only sends data back if you're authenticated. Here's an example that would read data from a MySQL database:

<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/accounts.class.php"; //Change this to the path to your authentication script
header("Content-Type: application/json"); //Important if you're using json
$account = new Accounts(); //A fictional Accounts class is opened
$json = array();
if (!$account->authenticated or $account->rights != "administrator") { //Ask the class if the user is not an admin
    $json = array(
        "error" => "Not an administrator"
    );
} else {
    $query = mysqli_query($link, "SELECT * FROM example"); //Assuming you use mysqli and there's a table called example
    if (!$query or mysqli_num_rows($query) < 1) {
        $json = array(
            "error" => "Query returned no results"
        );
    } else {
        while ($row = mysqli_fetch_array($query)) { //Read the data from the table
            $json[] = $row;
        }
    }
}
echo json_encode($json); //Send the data as a json string

Remember that the above code is only an example of how you would do this sort of script. You'll need to modify it to work with the class and database you are using.
Now you can make your own program for your own internal use that logs in to and queries data from your API. This could be a Website running on an internal server, a Windows program or a smartphone app. All it would need to do is fill in the form on the log in Webpage, then send a HTTP request to the script above and decode the json result.

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