Giter Site home page Giter Site logo

mr_smime's Introduction

Mr Smime

Secure/Multipurpose Internet Mail Extensions (S/MIME) support for ActionMailer, inspired by a blog post by Andrew White: Sending S/MIME encrypted emails with Action Mailer.

Installation

Add this line to your application's Gemfile:

gem 'mr_smime'

And then execute:

$ bundle

Usage

Setup a certificate path in your application.rb:

module MyApp
  class Application < Rails::Application

    ...

    MrSmime.configure do |config|
      config.certificate_path = Rails.root.join('config', 'certificates')
    end

    ...
  end
end

Add certificates for each of your senders (and recipients if you want encryption). We expect a .key and .pem file where @ has been replaced by . (e.g. [email protected] results in john.example.com.key and john.example.com.pem)

That's it!

Configuration-options

Option Default value Description
certificate_path Pathname to location of certificate-files
enabled true Boolean to have Mr Smime actually perform it's magic

TODO

  • Make it easy to save certificates from incoming e-mails (so we can sent encrypted mails back to them)
  • Add options to use keys with passphrases
  • Add options to enable on a per something base

Changelog

0.1.0 (September 16, 2016)

  • Initial release

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Creating self signed certificates

Create a CA certificate first:

$ openssl genrsa -out ca.key 4096
$ openssl req -new -x509 -days 365 -key ca.key -out ca.crt

Then create a certificate for each of your mail addresses (I'm certain there is a better way to do this):

$ openssl genrsa -out jane.example.com.key 4096
$ openssl req -new -key jane.example.com.key -out jane.example.com.csr
$ openssl x509 -req -days 365 -in jane.example.com.csr -CA ca.crt -CAkey ca.key -set_serial 1 -out jane.example.com.crt -setalias "Self Signed SMIME" -addtrust emailProtection -addreject clientAuth -addreject serverAuth -trustout
$ openssl pkcs12 -export -in jane.example.com.crt -inkey jane.example.com.key -out jane.example.com.p12
$ openssl pkcs12 -in jane.example.com.p12 -clcerts -nokeys -out jane.example.com.pem

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bluerail/mr_smime.

mr_smime's People

Contributors

martijn avatar rvanlieshout avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.