1

I am looking for an open-source package to set up an HTTP API to create, modify and tear down other server types in a Linux server. I would like to be able to administrate:

  • An SSH server (including SFTP)
  • An FTP server (including FTPS)
  • An Apache server

For example, I would like to be able to say:

  • Create an Apache instance listening on 1.2.3.4:8080 with docroot /var/www/mydocroot
  • Create an SSH server listening on 1.2.3.5:8081
  • List all of the FTP servers currently known about
  • Tear down the FTP server listening on 1.2.3.6:8082

I have suggested an HTTP-based API since this seems to be the most sensible way to communicate with this system remotely. I would imagine it would also be RESTful. However, this is not a strong requirement - if there is another way to communicate in a standards-based fashion, then it might still fit.

In case it is helpful to guide answers, my use case is an suite of integration tests that test an application that does software deployments. Individual tests will need to create web servers and various file transport systems in order to check the operation of the application. Presently I just test in a Docker environment and turn the SSH/FTP servers on and off with shell commands (this means the current set of tests cannot be parallelised, since they all use a single instance of each service).

I envisage that this tool will administrate servers upon the same server it is installed upon, and that it would need to run as root. However, it could administrate another server instead.

If there is an HTTP API for something like cPanel or WebMin, that might work. I found this service, but it's not open source, and it's only for a hosted FTP service rather than a package one can self-install.

I was thinking about writing this service myself and open-sourcing it, but it makes sense to see if it exists first. My web searches are indicating "no" at present, but it pays to make sure.

1 Answer 1

2

It sounds very much like what you actually want here is a way to simplify handling of configuration management and system provisioning. My personal recommendation would be to use Ansible for this.

Ansible is a scale-out configuration management and deployment automation tool written in Python. It uses one central system for management which it must be installed on, but requires almost nothing on any of the systems being managed. Ansible playbooks (their equivalent of scripts) use a really simple and easy to learn syntax based on YAML and Jinja2 to specify what modules (essentially commands) to run on what systems.

A huge assortment of different modules are provided with Ansible (see here for the full list), including ones for handling of Docker containers, managing packages installed on a host, handling which services are enabled or not, deploying software, altering configuration, and many other things.

Somewhat notable is the fact that Ansible supports what they call 'dynamic inventory', which pretty much means you can trivially spin up ephemeral virtual machines or containers and use them without having to worry about naming yourself.

You can also invoke individual modules by hand, allowing for freeform configuration changes like you are describing.

The only thing it really lacks given your constraints is an HTTP API (it runs from the command-line, and there is no persistent service associated with it either on the local system or the managed systems).

2
  • Thanks for the suggestion. That's a novel way of thinking about the problem, and I'll give it some thought as to how to apply it. I have a bit of Ansible experience, though I've not used it for a few years; I remember liking it. My hesitancy is how a test box will cope with parallel streams of configuration coming from parallel tests - my tests presently set things up as they need them, rather than setting it all up at the start.
    – halfer
    Commented May 7, 2018 at 21:27
  • Partly some of this is due to the dynamic nature of the tests - for example, I have some transport auto-detection code which selects either SFTP/FTPS/FTP, and so I need to set up the relevant servers, and then turn them on/off as appropriate to ensure the detection code gets the right answer.
    – halfer
    Commented May 7, 2018 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.