Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9179067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:42:17+00:00 2026-06-17T17:42:17+00:00

I am currently working on a VPS panel that uses a master-slave model. One

  • 0

I am currently working on a VPS panel that uses a master-slave model. One master server runs a panel written in PHP, and manages multiple slave servers via SSH. The slave servers are accessed via a limited account, that can sudo to specific server administration-related commands, and all interaction is logged in a directory that the account itself does not have access to.

I am currently using PHP-SSH2, but this approach has a few problems:

  • Exit codes are not reliably returned, so all commands have to be executed in a wrapper script that packages up stdout, stderr, and the exit code into a JSON object and returns it via stdout. This script has to exist on every slave server.
  • The PHP-SSH2 library does not know the concept of a “custom connection timeout”, which means I have to probe a server with fsockopen before trying to use PHP-SSH2 to connect – if I don’t do that, an unreachable server may delay the pageload for a minute or more. This is even more worse because of the next issue.
  • Persistent connections are not possible. This causes absolutely ridiculous pageload times in the panel, especially combined with the previous issue with timeouts.

Right now, I’m trying to solve the last problem primarily.

There are several possible solutions I have run across, but all of them have an issue of some sort:

  • Using PHPSecLib, a pure PHP SSH implementation, and replacing all fsockopen calls with pfsockopen calls. This will make the connections persistent, but it’s hackier than I’d like and the security implications of persistent sockets in PHP are unclear.
  • Setting up a persistent SSH tunnel from the master server to each slave server, and running a simple daemon (bound to localhost) on each slave server that runs whatever it’s told to. This is a problem for two reasons. First off it introduces the need for a daemon on the slave servers, which is something I’d rather avoid. The second issue is that if someone were to compromise a limited account on a slave server, they could still run certain system commands simply by connecting to the “command daemon”, even if they would not have access to those commands from their own shell. This is a problem.
  • Running a daemon on the master server that manages persistent SSH connections to slave servers on behalf of the panel. This would involve writing an SSH client in Python (this is the only suitable language I am familiar with), and would probably come down to using paramiko. Since the documentation of paramiko is poor, this isn’t a very attractive option and may even cause security issues because it isn’t entirely clear to me how things are supposed to be used in paramiko.

The following are not an option:

  • Switching to a different language for the panel itself. I am writing the panel in PHP because that is the language I am most familiar with, and I’m aware of the quirks and potential issues I might encounter. Writing an important public-facing project like this in a language I am not familiar with would be a bad idea.
  • Using Twisted for the third “possible solution”. Twisted is a very large and convoluted dependency, and the documentation seems even worse than that of paramiko.
  • Running a HTTPd or otherwise non-SSH public-facing daemon on the slave servers.

In practice, I am seeing pageload times of sometimes over a minute when multiple servers have to be contacted for a pageload. This is obviously not acceptable for a VPS panel.

My goal is to have some kind of implementation that avoids the connection overhead that is introduced when using PHP-SSH2. What would be the best way to do this, in a secure manner, while introducing a minimal amount of dependencies on the slave servers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:42:19+00:00Added an answer on June 17, 2026 at 5:42 pm

    You could use autossh, and create reverse (portforward) tunnels with autossh. Then let your php application talk against those reverse ssh ports. If the ssh connection fails, autossh will keep trying to recreate the connection. Your php app will fail to connect to the reverse tunnel and not even timeout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently working on a game that uses multi touch to apply zoom to
Am currently working on a site that uses a lot of cfwindow objects and
Im currently working on a c# project that uses another .net library. This library
Currently working on a legacy script (PHP) for one of my customers. He just
currently working on an app at work that uses a tab bar controller. The
Im currently working on an RMI client that will talk to an RMI server
Currently working with converting SQLException error messages into messages that are more useful for
Am currently working on an application that requires users to submit posts and comments
I am currently working on a project that is hosted at GoDaddy and it
Currently working on something which uses ajax for some pagination. What I'm looking to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.