Tuesday, February 17, 2015

Vps Deploy (stable!)

This is a script I am working on. The point is to quickly secure and configure a vps and install necessary software. The script will attempt to quickly guild the user through the process. I hate getting root passwords in the mail. Eventually this script should copy itself and automatically run on the target system to minimize the time that the server is sitting like lame duck with port 22 wide open and the root password emailed in plain text...

Script should be placed in a directory with a sub directory called "conf" with your public key file on one line in a file named "authorized_keys", and also your desired sshd_config file. The entire directory should be uploaded to the server with scp or similar. So the structure is
/folder/script+directory "conf"
Directory "conf" contains:
authorized_keys/
sshd_config".

I have not tested it yet. I am open to suggestions. Excuse my blogs formatting, this looked better in the terminal.

Updated 2/18/15 to reload open-ssh after configuration + fix format errors.

Updated again, removed many syntax errors (2/19/15) and simplified things. About to test it on a VM...

Updated 2/22/15: Script works great and is available on github: https://github.com/darkerego/vpsdeploy

1 comment:

  1. This script works, however I need to find a better way to add the user. Perhaps using 'adduser' instead of 'useradd' would work better. Does anyone have any ideas?

    ReplyDelete