How to defend against cron attacks?

Source: Internet
Author: User
Tags config

A few days ago the friend said his station consumes the cloud bean to be formidable, then sees the log to discover most is the visit cron.php. And then is not the intranet IP access, and also did not add monitoring and so on, it is estimated that the malicious visit by others. But feel that the modification of the name is also somewhat unsafe, the IP blacklist effect will not be very strong.

Because IP can be changed at any time, so I added a piece of code to solve this problem. is to add a get cron.php to pass the parameters, and then in Config.yaml modified cron, the malicious access problem solved, these days the consumption must also be reduced.

This example tells us, if you are using open source program, when someone else find your open source program, you can see the code to try to consume your cloud beans. So we have to chastened wiser, although the technical content is not high, but it will be much safer. After all, he doesn't know that your cloud beans are not consumed, he is just going to try to attack your program. But I set the more wretched, because at the beginning, cron is output OK, now he does not get to pass data, but also return OK, but now the real execution succeeds, return is yes.

Let's go to the bottom of the line, and first add the following sentence to the cron.php.

if (Empty ($_get[' password ')) | | | $_get[' password ']!= ' user@test ') exit (' OK '); Both password and user@test can be modified arbitrarily.

The way to access is the domain name/program name. Php?password=user@test

Then modify the Config.yaml file,

Add a simple cron.php followed by "program name. Php?password=user@test"

Here's "program name. Php?password=user@test" is not absolute oh.

If you have modified password and user@test in the If place, you need to modify it here as well.

As in the following example.

-Description:task url:cron.php?password=user@test Schedule: */1 * * * * * *

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.