Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Executing bulk of short commands in queue#1927

Discussion options

Hey there,

Is there a way to decrease time to login process?
I amusing queues in my application, so I need to do $ssh->login in every Job class?
As I understand, there is no way to save login session / cache or serialize ssh connection to next callable php job via queue?

In this case, I think there is only one way to fasten the authentication — using ssh-agent or pubkey auth, is it right?

@terrafrost Will be glad for your tips ❤️

You must be logged in to vote

ssh-agent wouldn't really help that much. All that really does is give you a way to create a signature with a private key and retrieve the public key corresponding to a private key without being able to actually read that private key. The signatures and key exchange and all that jazz still needs to be done.

Unless you could make it so that the server doesn't randomly generate numbers there's not a whole lot you can do to cache logins. And if you did make it so that the server served up the same random bytes every time then you'd be introducing security vulnerabilities.

I think the best option, in your situation, is going to be to just make it so phpseclib is always running. Do something l…

Replies: 1 comment 1 reply

Comment options

ssh-agent wouldn't really help that much. All that really does is give you a way to create a signature with a private key and retrieve the public key corresponding to a private key without being able to actually read that private key. The signatures and key exchange and all that jazz still needs to be done.

Unless you could make it so that the server doesn't randomly generate numbers there's not a whole lot you can do to cache logins. And if you did make it so that the server served up the same random bytes every time then you'd be introducing security vulnerabilities.

I think the best option, in your situation, is going to be to just make it so phpseclib is always running. Do something like this:

$ssh =newSSH2(...);$ssh->login(...);while (true) {// query MySQL DB for commands or some such$commands = [];foreach ($commandsas$command) {$result =$ssh->exec($command);// save command output in DB    }sleep(1);}
You must be logged in to vote
1 reply
@DanielSpravtsev
Comment options

I'm think I just get rid of 1 job = 1 exec and just run it in one parent job. Thanks for advice, much appreciated.

Answer selected byDanielSpravtsev
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@DanielSpravtsev@terrafrost

[8]ページ先頭

©2009-2025 Movatter.jp