Skip to content

manage SolVPS virtual private servers from the command line

License

Notifications You must be signed in to change notification settings

dlenski/solvpscli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

vpn-slice

This is a command-line tool for managing virtual private servers from SolVPS. It works by scraping the web-based user interface.

Usage

usage: solvpscli.py [-h] [--show-passwords] [-u USERNAME] [-p PASSWORD] [-k]
                    [vpsid]
                    [{status,browse,boot,reboot,shutdown,linux-console,windows-console,passwd}]

This is a tool to manage SolVPS virtual private servers directly from the
command line. It works by scraping the web-based user interface at
https://www.solvps.com/secure/clientarea.php

positional arguments:
  vpsid                 SolVPS numeric ID, or domain name
  {status,browse,boot,reboot,shutdown,linux-console,windows-console,passwd}
                        Action to perform on the VPS

optional arguments:
  -h, --help            show this help message and exit
  --show-passwords      Show password fields in status output
  -u USERNAME, --username USERNAME
  -p PASSWORD, --password PASSWORD
  -k, --insecure        Don't verify certificates

In order to avoid being prompted for your username and password on every invocation, add your SolVPS username and password to the file ~/.solvps_credentials:

user.name@company.com
SecretPassword321

List active VPS

If no specific system is given on the command line, solvpscli will list the numeric IDs and domain names of all the active VPS accessible by your account:

$ solvpscli
Logging in to SolVPS...
No VPS ID or domain name specified. List:
[12345]	linuxbox1.company.com
	Linux VPS - Custom VPS
[12346]	windoze2.company.com
	Windows VPS - Custom Windows VPS

status

The status action is the default if no other action is specified. It displays status and configuration information on a VPS:

$ solvpscli --show-passwords linuxbox1
Logging in to SolVPS...
Found domain linuxbox1.company.com (Linux VPS - Custom Linux VPS) with VPS ID 12345
VM status:
	Status               : online
	Type                 : xen
	Hostname             : linuxbox1.company.com
	Main IP Address      : 101.102.103.104
	IP Addresses         :
	Root Password        :
	Bandwidth            : 13.43 GB of 100 TB Used / 99.99 TB Free 0%
	HDD                  : 27.74 GB of 50 GB Used / 22.26 GB Free 55%
Remote access credentials:
	Access Protocol:     : SSH (Secure Shell) How to Connect ›
	Server Address:      : 101.102.103.104
	Username:            : root
	Password:            : deadbeef0x
	SSH Port:            : 22
Options:
	Processor - CPU      : 1 Core $1.00 USD
	Memory - RAM         : 4 GB $1.00 USD
	SSD Storage          : 25 GB $1.00 USD
	Bandwidth - Data     : Unlimited Data Transfer
	Bandwidth - Speed    : 1Gbps Port Capacity
	Operating System     : Ubuntu 17.04
	Server Location      : Europe - London

Change password

For Linux VPS systems, it's possible to change the root password via the management interface.

$ solvpscli linuxbox1 passwd
Logging in to SolVPS...
Found domain linuxbox1 (Linux VPS - Custom Linux VPS) with VPS ID 12345
Enter new password: ****
Retype new password: ****
Success.

Console interfaces

SSH console (Linux only)

For Linux VPS systems, it's possible to access the kernel console which may be useful for troubleshooting an otherwise non-responsive system. Invoking solvpscli [vpsid] linux-console provisions an SSH console and displays a shortcut to connect with no password prompt, using sshpass and OpenSSH:

$ solvpscli linuxbox1 linux-console
Logging in to SolVPS...
Found domain linuxbox1 (Linux VPS - Custom Linux VPS) with VPS ID 12345
Linux system console can now be accessed via ssh:

        sshpass -p 'F0o0BarBz1' ssh -o StrictHostKeyChecking=no console-foO0BR@12.34.56.78

(The credentials for the SSH console will expire after about one hour.)

Graphical console (Windows only)

For Windows VPS systems, it's possible to access the Windows /admin console via a browser-based Windows Remote Desktop Protocol client. Invoking solvpscli [vpsid] windows-console will open the browser-based view for the server in question, in your default web browser:

$ solvpscli windoze2 windows-console
Logging in to SolVPS...
Found domain windoze2.company.com with VPS ID 12346
Opening graphical console interface in browser: https://www.solvps.com/secure/clientarea.php?action=productdetails&id=12346&mg-action=novnc ...
Success.

Other actions

The boot, reboot, and shutdown actions should be self-explanatory. They display a short JSON response from the web service:

$ solvpscli linuxbox1 boot
Logging in to SolVPS...
Found domain linuxbox1.company.com with VPS ID 12345
Success.

The browse action opens the web view for the server in question, in your default web browser:

$ solvpscli windoze2 browse
Logging in to SolVPS...
Found domain windoze2.company.com with VPS ID 12346
Opening in browser: https://www.solvps.com/secure/clientarea.php?action=productdetails&id=12346 ...

License

GPLv3 or later.

TODO

  • Scrape console interface for Windows systems as well

About

manage SolVPS virtual private servers from the command line

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages