Skip to content
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

Merged
merged 2 commits into from
Jun 5, 2017

Conversation

rwaldron
Copy link
Contributor

@rwaldron rwaldron commented Jun 1, 2017

Signed-off-by: Rick Waldron waldron.rick@gmail.com

@rwaldron rwaldron requested review from kwyn and HipsterBrown and removed request for kwyn June 1, 2017 21:47
@@ -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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@coveralls
Copy link

coveralls commented Jun 1, 2017

Coverage Status

Coverage decreased (-0.05%) to 78.475% when pulling db312f4 on 1219 into 4692d0c on master.

@@ -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);
Copy link
Contributor

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

Copy link
Contributor Author

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants