-2

I want to develop below functionality, I am getting stuck how to start. If anyone already developed please help me.

  1. Reboot Server

  2. Block IP address

This tool should be written in PHP and utilize the existing Rackspace PHP SDK:

https://developer.rackspace.com/sdks/php/

The script will need to store a hardcoded username and API key; this information will be used to access the API.

Deepak Dholiyan
  • 1,774
  • 1
  • 20
  • 35
  • You say you are stuck, first thing you need to do is define how and where this script is going to be ran. Is this going to be some sort of admin interface via the web, or a cli script? Are you wanting it to reboot the server automatically when it is ran, or schedule a reboot? How do you expect it to block IP's one that's passed in via an argument via IPTables? Again is this going to happen every time it's ran? – Ryan Gibbons Jan 29 '16 at 14:55
  • Hi Ryan Gibbons, Thanks for reply. I want to create an Create a custom command line tool using php. – Deepak Dholiyan Jan 29 '16 at 15:04
  • You've ignored my other questions, You need to architect this script out more. Where it's going to be ran, which servers it's going to interact with, and how you need to block IPs (in web application, with iptables, in hosts.deny). All the operating systems involved are also very critical. I'd suggest taking a look at this - http://stackoverflow.com/help/how-to-ask – Ryan Gibbons Jan 29 '16 at 15:48
  • Hi Ryan Gibbons, Thanks for reply again. – Deepak Dholiyan Jan 29 '16 at 18:35
  • I just want to create an environment where admin will put command and hit enter this will call provided php sdk methods. This will reboot server and block provided Ip. I download the php sdk from github. I want to know how can I test this. – Deepak Dholiyan Jan 29 '16 at 18:39
  • I am currently using this link https://github.com/rackspace/php-opencloud/ – Deepak Dholiyan Jan 29 '16 at 18:42

1 Answers1

0

The reboot I'm not sure of. But the block ip you could store all ip's that visit your site in a database. Have a column with the heading blocked. Then when you get the user information look for that column. And use this code after.

if($user_id_blocked = 'blocked'){
    die('You have been blocked. Please contact admin.');
}
Niall
  • 804
  • 10
  • 27