Skip to content

Push key configuration documentation for ElasticBeanstalk #1798

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

Closed
barnaclejive opened this issue May 15, 2016 · 1 comment
Closed

Push key configuration documentation for ElasticBeanstalk #1798

barnaclejive opened this issue May 15, 2016 · 1 comment

Comments

@barnaclejive
Copy link

barnaclejive commented May 15, 2016

Request for additional documentation about best practices for push key installation and permissions when using ElasticBeanstalk.
For example, I'm not sure if I am placing the .p12 files in the correct location with the correct permissions for parse-server to use them. For security, it wouldn't be a good idea to bundle the keys with the application or even key locations in index.js. What I have done is create environment variables for the key locations

push: { ios: [ { pfx: process.env.MYAPP_PUSH_KEY_PATH_DEV, // Dev PFX or P12 bundleId: process.env.MYAPP_PUSH_BUNDLEID, production: false // Dev }, { pfx: process.env.MYAPP_PUSH_KEY_PATH_PROD, // Prod PFX or P12 bundleId: process.env.MYAPP_PUSH_BUNDLEID, production: true // Prod } ] }

Where the paths are set in the ElasticBeanstalk environment properties:

MYAPP_PUSH_KEY_PATH_DEV   /home/ec2-user/.ssh/myapp_push_key_dev.p12
MYAPP_PUSH_KEY_PATH_PROD   /home/ec2-user/.ssh/myapp_push_key_disb.p12
MYAPP_PUSH_BUNDLEID   com.foo.myapp

However, when I attempt to send a push notification, I am seeing a permission denied error in the npm-debug.log:

npm ERR! Linux 4.4.8-20.46.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/npm" "start"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] start script 'node index.js'.
npm ERR! This is most likely a problem with the petfetch-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs petfetch-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls petfetch-server
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log

[email protected] start /var/app/current
node index.js

parse-server-example running on port 8081.
/var/app/current/node_modules/parse-server/lib/ParseServer.js:339
throw err;
^

Error: EACCES: permission denied, open '/home/ec2-user/.ssh/myapp_push_key_disb.p12'
at Error (native)

I have tried giving the .p12 files 400, 644, and even 777 permissions but always get the access denied error.

@barnaclejive
Copy link
Author

Seems to be a generic user access issue. I moved the keys and made the nodejs user owner and the permission error went away.

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

No branches or pull requests

1 participant