Friday, November 10, 2017

SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch

Error:

SSL_CTX_use_PrivateKey_file("/opt/nginx/ssl/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch

Solution:

To match CSR key and generated SSL certificate
echo "--Certificate:" && openssl x509 -noout -modulus -in ssl_certificate_file && echo "--Key:" && openssl rsa -noout -modulus -in csr_key_file
 Here change ssl_certificate_file and csr_key_file with your own file names.

With this command, you can get 2 modules. And if this both modules value looks same then it should work else key and SSL certificate is not correct.

You can also compare serial key from your order of SSL certificate:
openssl x509 -in ssl_certificate.cer -serial -noout

If it will not match then Reissue certificate or check your key or SSL if it is an old one.

Wednesday, September 06, 2017

How to install Docker on Ubuntu 16.04

Nowadays, docker is going to use globally. As a developer, it will help me a lot with this:

  • Escape app dependency
  • works with any technology
  • Easy to share via repo
Here are few steps for easy installation of Docker in Ubuntu 16.04

Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
Add the GPG key for the official Docker repository to the system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Now update the package for Docker
sudo apt-get update
Now, Install Docker with:
sudo apt-get install -y docker-ce
Check if Docker is running or not with
sudo systemctl status docker
Now you can check that if you are able to access and download Docker images from Docker hub or not with "Hello World" image
docker run hello-world

If it will give you permission error due to sudo then add sudo with command

If image is not searchable on locally then it will get it from Docker hub


Sachin New 


Sachin 10 Oct 


Steve Single Product 

Thursday, July 06, 2017

NoMethodError: undefined method `last_comment' for #

I found this error for rake new version:
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x000000027b6798>
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/rspec-core-2.99.2/lib/rspec/core/rake_task.rb:143:in `initialize'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/rspec-rails-2.99.0/lib/rspec/rails/tasks/rspec.rake:11:in `new'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/rspec-rails-2.99.0/lib/rspec/rails/tasks/rspec.rake:11:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `load'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `block in load'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `load'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/rspec-rails-2.99.0/lib/rspec-rails.rb:10:in `block in <class:Railtie>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/railtie.rb:194:in `instance_exec'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/railtie.rb:194:in `block in load_tasks'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/railtie.rb:194:in `each'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/railtie.rb:194:in `load_tasks'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/engine.rb:423:in `block in load_tasks'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/application/railties.rb:8:in `each'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/application/railties.rb:8:in `all'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/engine.rb:423:in `load_tasks'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/application.rb:145:in `load_tasks'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/railties-3.2.22.5/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/sachin/rails_projects/sachin/Rakefile:7:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

Solution:

Rake 11.0.1 removes the methodlast_comment which Rails 2.3 rspec-core (< 3.4.4) uses. Therefore until/if a patch is released we need to pin rake to an older version in Gemfile:


`gem 'rake', '< 11.0'`


Then `bundle update rake`


It will resolve your issue.

Friday, June 02, 2017

Gem Load Error is: uninitialized constant Mysql2::Client::SECURE_CONNECTION on Ubuntu 16.04

While I am trying to create DB with rake db:create then I am getting this error:

rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'mysql2'.
Gem Load Error is: uninitialized constant Mysql2::Client::SECURE_CONNECTION
Backtrace for gem load error is:
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/mysql2-0.3.16/lib/mysql2/client.rb:12:in `<class:Client>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/mysql2-0.3.16/lib/mysql2/client.rb:2:in `<module:Mysql2>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/mysql2-0.3.16/lib/mysql2/client.rb:1:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/mysql2-0.3.16/lib/mysql2.rb:10:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/mysql2-0.3.16/lib/mysql2.rb:10:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p545@oomph-sachin/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
/home/sachin/rails_projects/sachin/config/application.rb:8:in `<top (required)>'


Solution:

Update your Gemfile to version 0.3.20

     gem 'mysql2', '~> 0.3.20'

Then run "bundle update mysql2" and then try it will work!