fixed SystemSSHEnabled
This commit is contained in:
parent
129281fc96
commit
d35d9afa3e
@ -40,7 +40,7 @@ func SystemSSHEnabled() (bool, error) {
|
||||
return false, fmt.Errorf("failed to read ssh config: %w", err)
|
||||
}
|
||||
|
||||
return strings.Contains(string(data), "127.0.0.1:22"), nil
|
||||
return !strings.Contains(string(data), "127.0.0.1:22"), nil
|
||||
}
|
||||
|
||||
// SystemEnableSSH server
|
||||
|
@ -43,12 +43,12 @@ func TestSystemSSHEnabled(t *testing.T) {
|
||||
ass.NoError(ioutil.WriteFile(systemDropbearConfig, []byte("test"), os.ModePerm))
|
||||
value, err := SystemSSHEnabled()
|
||||
ass.NoError(err)
|
||||
ass.False(value)
|
||||
ass.True(value)
|
||||
|
||||
ass.NoError(ioutil.WriteFile(systemDropbearConfig, []byte("DROPBEAR_OPTS=\"-p 127.0.0.1:22\""), os.ModePerm))
|
||||
value, err = SystemSSHEnabled()
|
||||
ass.NoError(err)
|
||||
ass.True(value)
|
||||
ass.False(value)
|
||||
|
||||
_ = os.Remove(systemDropbearConfig)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user