-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect id_rsa permissions problems and bail out early. Fixes gh-1219 #1222
Conversation
@@ -48,7 +47,7 @@ LAN.Connection = function(opts) { | |||
this.ssh = undefined; | |||
|
|||
if (Tessel.isProvisioned()) { | |||
this.auth.privateKey = opts.privateKey || fs.readFileSync(path.join(Tessel.LOCAL_AUTH_KEY)); | |||
this.auth.privateKey = opts.privateKey || fs.readFileSync(Tessel.LOCAL_AUTH_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we write a common module that reads the auth key and throws the EACCESS error even in this case?. Then we can use it in both lib/controller.js
and here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the permissions problem exists, no operation will ever reach this code.
lib/controller.js
Outdated
@@ -28,6 +29,17 @@ var responses = { | |||
auth: 'No Tessels Found.' | |||
}; | |||
|
|||
// Alert the user that they have a permissions problem. | |||
try { | |||
fs.readFileSync(Tessel.LOCAL_AUTH_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably be fs.accessSync
which wouldn't read the file into memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good call. Let me try that
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Signed-off-by: Rick Waldron waldron.rick@gmail.com