
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
h1. Apple Push Notification Server Toolkit
h2. Description
apnserver is a server and set of command line programs to send push notifications to the iPhone. Apple recomends to maintain an open connection to the push notification service and refrain from opening up and tearing down SSL connections reapeated. To solve this problem an intermediate network server is introduced that queues are requests to the APN service and sends them via a persistent connection.
h2. Remaining Tasks
h2. Issues Fixed
h2. APN Server Daemon
Usage: apnserverd [options] --pem /path/to/pem
--bind-address bind address (defaults to 0.0.0.0)
bind address of the server daemon
--proxy-port port
the port that the daemon will listen on (defaults to 22195)
--server server
APN Server (defaults to gateway.push.apple.com)
--port port of the APN Server
APN server port (defaults to 2195)
--pem pem file path
The PEM encoded private key and certificate.
To export a PEM ecoded file execute
# openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
--help
usage message
--daemon
Runs process as daemon, not available on Windows
h2. APN Server Client
With the APN server client script you can send push notifications directly to Apple's APN server over an SSL connection or to the above daemon using a plain socket. To send a notification to Apple's APN server using SSL the --pem option must be used.
Usage: apnsend [switches] (--b64-token | --hex-token)
--server the apn server defaults to a locally running apnserverd
--port <2195> the port of the apn server
--pem the path to the pem file, if a pem is supplied the server
defaults to gateway.push.apple.com:2195
--alert the message to send"
--sound the sound to play, defaults to 'default'
--badge the badge number
--custom a custom json string to be added to the main object
--b64-token a base 64 encoded device token
--hex-token a hex encoded device token
--help this message
To send a base64 encoded push notification via the command line execute the following:
$ apnsend --server gateway.push.apple.com --port 2195 --pem key.pem \
--b64-token j92f12jh8lqcAwcOVeSIrsBxibaJ0xyCi8/AkmzNlk8= --sound default \
--alert Hello
h2. Sending Notifications from Ruby
To configure the client to send to the local apnserverd process configure the ApnServer client with the following.
# configured for a using the apnserverd proxy
ApnServer::Config.host = 'localhost'
ApnServer::Config.port = 22195
To configure the client to send directly to Apple's push notification server, bypassing the apnserverd process configure the following.
ApnServer::Config.pem = '/path/to/pem'
ApnServer::Config.host = 'gateway.push.apple.com'
ApnServer::Config.port = 2195
Finally within we can send a push notification using the following code
notification = ApnServer::Notification.new
notification.device_token = Base64.decode64(apns_token) # if base64 encoded
notification.alert = message
notification.badge = 1
notification.sound = 'default'
notification.push
h2. Installation
To install apnserver execute the following gem command:
$ gem install bpoweski-apnserver --source http://gems.github.com
Adding apnserver to your Rails application
config.gem "bpoweski-apnserver", :lib => 'apnserver', :source => "http://gems.github.com"
h2. License
(The MIT License)
Copyright (c) 2009 Ben Poweski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that bpoweski-apnserver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.