Tuesday, November 23, 2010

Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

My OS is ubuntu.
I have issue when I try to run 'rake db:create'.
greg@cm-test:/mydisk/ruby/blog/config$ rake db:create
(in /mydisk/ruby/blog)
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
Try running `bundle install`.


Here is what I did to fix this issue
1, find current libmysqlclient for your system. Then install it
greg@cm-test:/mydisk/ruby/blog/config$ sudo apt-get install libmysqlclient15-dev

2, After install mysql lib, need to install gem mysql

greg@cm-test:/mydisk/ruby/blog/config$ sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

You need to find correct path for mysql_config
greg@cm-test:/mydisk/ruby/blog/config$ sudo updatedb
greg@cm-test:/mydisk/ruby/blog/config$ locate mysql_config

3, do bundle all
greg@cm-test:/mydisk/ruby/blog/config$ sudo bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.10)
Using actionmailer (3.0.3)
Using arel (2.0.4)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Installing mysql2 (0.2.6) with native extensions
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

greg@cm-test:/mydisk/ruby/blog/config$ bundle show
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.3)
* actionpack (3.0.3)
* activemodel (3.0.3)
* activerecord (3.0.3)
* activeresource (3.0.3)
* activesupport (3.0.3)
* arel (2.0.4)
* builder (2.1.2)
* bundler (1.0.7)
* erubis (2.6.6)
* i18n (0.4.2)
* mail (2.2.10)
* mime-types (1.16)
* mysql2 (0.2.6)
* polyglot (0.3.1)
* rack (1.2.1)
* rack-mount (0.6.13)
* rack-test (0.5.6)
* rails (3.0.3)
* railties (3.0.3)
* rake (0.8.7)
* thor (0.14.6)
* treetop (1.4.9)
* tzinfo (0.3.23)

greg@cm-test:/mydisk/ruby/blog/config$ rake db:create
(in /mydisk/ruby/blog)

Thursday, November 18, 2010

Wednesday, October 6, 2010

nessus: The remote service supports the use of weak SSL ciphers.

1, test your ssl if support weak ssl
openssl s_client -connect 172.22.113.113:8443 -cipher LOW

2, disable tomcat weak ciphers
In order to achieve this I made a simple change:

in //conf/templates/server.xml I added:

ciphers="SSL_RSA_WITH_RC4_128_MD5" right after sslProtocol = "TLS" and restarted the hyperic server.

Tuesday, September 28, 2010

enable https in apache

step 1: generate a Private Key
openssl genrsa -des3 -out es.key 1024

step 2: generate a Certificate Signing Request
openssl req -new -key es.key -out es.csr

step 3: send csr to certificate company, like McAfee to generate certificate file
or generate a Self-Signed Certificate by yourself
openssl req -new -key es.key -x509 -out es.crt

step 4: update ssl.conf
Store public key, private key in a folder
[root@aaa ssl2010]# ll
total 44
-rw-r--r-- 1 cdong users 1488 Sep 29 13:39 cnn.com.cer
-rw-r--r-- 1 root root 4203 Sep 29 16:34 es.crt
-rw-r--r-- 1 root root 781 Sep 28 17:26 es.csr
-rw-r--r-- 1 root root 887 Sep 28 17:24 es.key

SSLCertificateFile /usr/local/apache2/conf/ssl2010/cnn.com.cer
SSLCertificateKeyFile /usr/local/apache2/conf/ssl2010/es.key
SSLCertificateChainFile /usr/local/apache2/conf/ssl2010/es.crt

Please be noticed: SSLCertificateChainFile includes 3 certificates - McAfee, RSA and PEM

Tehn reboot apache
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start


Verify public key and private key
1, public key
openssl x509 -noout -text -in es.crt -modulus

2, private key
openssl rsa -noout -text -in es.key -modulus

The "modulus" and "publicExponent" portions in the key and the certificate must match exactly.

Wednesday, September 15, 2010

Tuesday, September 7, 2010

restrict users to their home dir in the ssh

http://www.howtoforge.com/chroot_ssh_sftp_debian_etch

Check out your current bash binary:

# ls -la /bin/*bash*

if you see a "bash2" and don't see a sym-link for "rbash" then your system
is ready to be secured. Just create the needed symlink from rbash to
bash2:
# ln -s bash2 rbash

Now simply change your user's login shells in /etc/passwd from /bin/bash to
/bin/rbash

Thursday, August 12, 2010