-
Notifications
You must be signed in to change notification settings - Fork 302
fleetctl: "askToTrustHost" doesn't work correctly with cluster and empty "known_hosts" #1499
Comments
Yet another example. When you have four nodes and you have units on all of them, try to approve ssh fingerprints for three nodes only and skip last one. Then try to retrieve status once again with the |
@jonboulle I have not a clue what is wrong. But when I removed session.Stdin = os.Stdin string from I also played a lot with these constants inside |
UPD: |
A few things to check:
|
Answer to 1st one:
|
Answer to 3rd one: bash expands |
When you use pure bash without any promt string ( |
Added debug of the stdin: diff --git a/ssh/ssh.go b/ssh/ssh.go
index ca02dd9..32ae5df 100644
--- a/ssh/ssh.go
+++ b/ssh/ssh.go
@@ -18,6 +18,8 @@ import (
"errors"
"net"
"os"
+ "io"
+ "fmt"
"strconv"
"strings"
"time"
@@ -68,7 +70,12 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize
session.Stdout = os.Stdout
session.Stderr = os.Stderr
- session.Stdin = os.Stdin
+ //session.Stdin = os.Stdin
+ stdin_file, err := os.OpenFile("/home/core/stdin.log", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
+ if err != nil {
+ fmt.Fprintf(os.Stderr,"%v", err)
+ }
+ session.Stdin = io.TeeReader(os.Stdin, stdin_file)
modes := gossh.TerminalModes{
gossh.ECHO: 1, // enable echoing
@@ -89,6 +96,8 @@ func makeSession(client *SSHForwardingClient) (session *gossh.Session, finalize
finalize = func() {
session.Close()
+ stdin_file.Close()
+ fmt.Fprintf(os.Stderr,"state: %#v\n",oldState)
terminal.Restore(fd, oldState)
} when you use regular ssh |
Here is more simple solution Which provides this output with
|
@kayrus I'm not sure I follow all the notes, but you should also try to see if a PTY was allocated or not and the interactive mess here.. ?! not sure how the ssh Go implementation works either... |
This code removes gossh.ONLCR: 0, |
https://github.com/madebymany/moltar/blob/master/sshclient.go - yet another ssh terminal implementation |
The issue caused by unavailability to terminate io.Copy goroutine when you close session. It's being terminated only when user presses Enter key. |
@jonboulle do you know how is it possible to interrupt io.Copy on demand? |
I was able to interrupt |
I guess it's worth a try to test this solution |
Assign session.stdin using StdinPipe() to avoid cases of ssh connetions being blocked on user input. WIP. Reported-by: kayrus <[email protected]> maybe partly resolves coreos#1499
Steps to reproduce:
[email protected]
:~/.fleetctl/known_hosts
fleetctl start hello@{1..10}.service
fleetctl status hello@{1..10}.service
then type "yes" for each request. second request will not work until you type it twice.The text was updated successfully, but these errors were encountered: