gem install bouncy-castle-java for full support - ruby-on-rails

I am getting this warning message on the deployment server, when I start the server or running the console.
OpenSSL ASN1/PKey/X509/Netscape/PKCS7 implementation unavailable
gem install bouncy-castle-java for full support.
Also, When I try to generate the Key with following command.
OpenSSL::PKey::RSA.new(PUBLIC_KEY)
I get following exception
OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:
from org/jruby/ext/openssl/PKeyRSA.java:278:in `initialize'
I am bit confused with the message. I have the bouncy-castle-java installed on the machine. But I am still confused with message.
I am not sure abt the issue. Can anyone explain the issue, Or give me some directions.

I have fixed this issue on my end by installing jruby openssl 0.8.8 on the server.
As far as I remember there was an conflict with jruby and openssl gem that was used in the gem list(So I had to update the Gem)

Related

Rails deployment on AWS server (EBS) | Issue with nokogiri-1.13.3-aarch64-linux wrt GLIBC_2.29

Have deployed my Rails application but now getting following error in /var/log/puma/puma.log file
Early termination of worker
ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:
/lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so
If that's the case, then please install Nokogiri via the `ruby` platform gem:
gem install nokogiri --platform=ruby
or:
bundle config set force_ruby_platform true
Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.
[21228] ! Unable to start worker
[21228] /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative'
Also running the recommended gem install nokogiri --platform=ruby doesn't solve the issue.
Ruby 2.7 running on 64bit Amazon Linux 2/3.4.3
Any help is appreciated.
The workaround I had success with was to use nokogiri 1.10.10. Prior to v1.11, nokogiri did not supply precompiled arch64 binaries, so that will force the instance to compile the gem natively.
In your Gemfile specify:
gem 'nokogiri', '1.10.10'
I previously tried setting BUNDLE_FORCE_RUBY_PLATFORM to true in the AWS EB instance configuration, but that did not seem to cause the gem to be natively compiled.
Any help is appreciated.
The error message tells you exactly what's wrong:
you are trying to use pre-compiled nokogiri.so
that shared library was compiled on a GLIBC-2.29 (or newer) system and requires that version
you are running on a system with GLIBC-2.16 or earlier.
To fix this, you need to get nokogiri.so that is appropriate for your (old) target system. You can't just copy it from a newer system.

Ruby on Rails SSL Issue with Windows 10

I'm new to Ruby and following the course Ruby on Rails Intro on course era and on the very first chapter installing software on Windows. After installing all the required software when the instructor asks me to run 'ruby new test_install' get the following exception:
Fetching source index from https://rubygems.org/
Could not verify the SSL certificate for
https://rubygems.org/quick/Marshal.4.8/sqlite3-0.0.0.gemspec.rz.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see "bit.ly/ruby-ssl". To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.
I should mention that I tried with gem -a sources http://rubygems.org but to no avail and I initially installed the rails 4.2.3 by giving it --source http://rubygems.org however nothing seems to work for this particular instance of command.
So far there's no fix for this that I can find. It's not limited to Win10, either. I've come across Win7 users with the same issue, so it seems to be a Rail on Windows problem.
There are also lots of Gemfiles. It's not clear which one(s) need(s) to be changed. I've tried changing couple of them with no luck.
It does look like using Linux instead of Windows is the quickest way to a solution. It might be worth giving that a try. Other than the Mac-like weirdness of the Unity interface, Ubuntu is easy to get used to and VMWare Player is free. I wouldn't bother with Virtual Box, the versions I've tried, including the latest, have been flaky.
If you do decide to try Ubuntu, you can find instructions here: https://gorails.com/setup/ubuntu/16.04
That page recommends using MySQL or Postgres. If you do use something other than SQLite (probably a good idea, in which case Postgres is probably the better option), the creation of a new rails app requires setting the database at creation:
rails new myapp --database=postgresql
for instance.
I solved the same problem with this line:
gem install bundler
Source:
I solved the problem like this:
gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem update

Capistrano deployment broken by new request for Capistrano-Harrow gem?

I thought my capistrano version was locked to 3.4.0, however it seems that it updated to 3.5. I tried going back to 3.4, but I keep getting the following message when I try to deploy my project to server.
DEBUG [72bb6fc3] An error occurred while installing capistrano-harrow (0.3.2), and Bundler cannot
continue.
Make sure that `gem install capistrano-harrow -v '0.3.2'` succeeds before
bundling.
I'm not familiar with capistrano-harrow, but read a little and doesn't seem like something I need. I did add to my gemfile in hopes of getting the deployment to send but even though that seemed to install fine, it still errors out for deployment. When I try executing gem install capistrano-harrow -v '0.3.2' - I get the following message and it doesn't install.
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/capistrano-harrow-0.3.2.gemspec.rz)
Anyone know how I can either, opt out of harrow to try and get my deploy to work, or correct this issue to move forward? Thanks!
Update
I ran the following command to "opt-out", however, it still needs to build/install the gem I suppose which is currently the real issue.
git config harrow.disabled true
capistrano-harrow's 0.3.2 version seems to be yanked from Rubygems. There's a hint in the ERROR message you've pasted: Not Found 404 was received from the CDN.
If you're back on 3.4, the gem is not supposed to be in use but if you're running 3.5, please try to bundle update capistrano.

Capistrano SSH::AuthenticationFailed, not prompting for password

I've been using capistrano successfully for a while now and all of a sudden in every project I've lost the ability to deploy.
Environment:
os X (Mavericks)
ruby 1.9.3p194
rvm (locally, not on server)
rails 3.2 and up
RubyGems 1.8.25
I'm not using rsa_keys or anything I want capistrano to prompt for user and password. Suddenly it has decided not to ask for a password, but does ask for user. Then it rolls back and gives me the following error.
[deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: sub.example.com (Net::SSH::AuthenticationFailed: Authentication failed for user user#sub.example.com)
connection failed for: sub.example.com (Net::SSH::AuthenticationFailed: Authentication failed for user user#sub.example.com)
This has occurred on my personal laptop and my iMac at work. It occurs when deploying to two different servers (both linux)
I'm completely at a loss here. Any ideas?
Figured it out! Apparently this issue was with net-ssh gem. I had version 2.8.0 installed recently with some updates to my development environment and was the cause.
I'm not sure why it was failing, but gem uninstall net-ssh -v 2.8.0< fixed it for me.
If anyone actually knows why this was an issue or how I can correct this issue with the newer version of net-ssh I'd be interested to hear it.
The answer may break your rails app due to gem dependancies.
The issue is with net-ssh as was correctly answered by Sparkmasterflex, however whilst this will get capistrano working ok it may break your rails app:
These steps fixed both capistrano and rails for me ...
In your Gemfile add gem 'net-ssh', '2.7.0'
Run bundle update net-ssh
Run bundle (just to be sure everything is working ok'
Run gem uninstall net-ssh -v 2.8.0
If you are a rails user you should now be able to run both the rails server and capistrano.
I have a workaround that doesn't require downgrading net-ssh, per a comment at the link that Zach Lipton posted. Place this code in config/deploy.rb:
set :ssh_options, {
config: false
#Other options...
}
After I did that, I got another error, Error reading response length from authentication socket. Found the solution to that here. Execute these commands at your Bash prompt:
$ eval $(ssh-agent)
$ ssh-add
Upgrading your net-ssh version to 2.8.1 will solve the problem. They released a version bump in 19th february 2014 that fix this and other problems.
Uninstall your current net-ssh gem (gem install net-ssh -v 'version')
Just paste this on your Gemfile:
gem 'net-ssh', '~> 2.8.1', :git => "https://github.com/net-ssh/net-ssh"
Run bundle install
I had the same problem while deploying using capistrano
Net::SSH::AuthenticationFailed: Authentication failed for user deployer#IP
ssh-copy-id deployer#ip
This will add your keys to server and you can login without password.
set :ssh_options, {
verbose: :debug
}
... helps a lot!
I had an issue that I generated my public and private keys with puttygen and exported private key as OpenSSH with name <somename>.id_rsa. An then saved public key with name <somename>.id_rsa.pub.
( ! ) The public key puttygen saves is in RFC 4716 format not PEM. Use public suffix instead of pub for public key file-
This snippet works for me:
group :development do
#.....
gem 'capistrano', "~> 2.15"
gem "net-ssh", "~> 2.7.0"
#.....
end
First try to connect to your server with certificate (file.pem) with this command:
ssh -i "file.pem" user#yourServerIp
Then try to run cap production deploy. It solved error for me. I think it is because time limit for certificate expired.
If all the above solutions doesn't work,please restart your system as you might be facing the issue due to net-ssh host connections.when you restart and enter the deployment command ,it will ask to add the identity to known hosts.

Rails installing a Gem - hostname does not match the server certificate

I've recently been trying to work with Amazon EC2 to upload my first Rails project. In that process I vaguely remember configuring a key somewhere in the command line to let me connect to the EC2 instance. Anyway, since that (I think), I'm unable to install Ruby Gems as I get the error:
I've been looking for hours to try and fix this with no joy so any help would be greatly appreciated!
It seems your gem config is still looking at https://gemcutter.org.
Visiting this in your browser you will quickly realise the problem, the SSL certificate is signed for rubygems.org
I suggest you change your gem source to https://rubygems.org
Try setting the gem source
gem sources --add https://rubygems.org/
Now if you run
gem sources
you should get something like
*** CURRENT SOURCES ***
https://gemcutter.org/
https://rubygems.org/
So remove gemcutter.org too
gem sources --remove https://gemcutter.org/
Then you should be fine.

Resources