I encountered an error today with below error when I push my code to server.

ActionView::Template::Error (Not a valid color stop: Sass::Script::String: top
  (in /path/app/assets/stylesheets/books.css)):

It looks like Sass is not able to compile the css. I found similar issue reported at https://github.com/Compass/compass/issues/217

It doesn’t state the solution but I managed to solve the problem by upgrading my sass-rails to V5.0.0 and compass-rails from 0.12.7 to 1.0.0.

I have written an article regarding how to set up Ruby on Rails Action Mailer to send email using Zoho email service some times ago. For those who don’t know redmine, “Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.” (Taken from the official Redmine website) So if you are looking for a lightweight and free project management tools, do try it out. It won’t let you down.



You need to set up the email settings while configuring Redmine, so that Redmine will send out notifications with emails. There is an official documents on Redmine Email Configuration. However, it doesn’t cover how you can do it with Zoho. So below are steps on how you can do it.

Step 1: Create the Configuration File

Under the root directory of the redmine folder, copy the config/configuration.yml.example to config/configuration.yml

Step 2: Configure the Configuration File

Edit the settings file config/configuration.yml. Inside this file, you will find the following default settings:

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.example.net
      port: 25
      domain: example.net
      authentication: :login
      user_name: "redmine@example.net"
      password: "redmine"

Change it to the following (replace the user_name and password):

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.zoho.com
      port: 465
      domain: investingnote.com
      authentication: :plain
      user_name: "notifications@investingnote.com"
      password: "password"
      ssl: true

Note that if you don’t set the ssl to true, you will see error “Email delivery error: Net::ReadTimeout” in the log/production.log. Also remember to restart your redmine service after you have updated the configuration.

Step 3: Change the sender email address

Go to the redmine settings page, under the tab ‘Email notifications’, change the ‘Emission email address’ to the email address you set in the above configuration.yml. If you don’t do so, you will face the following error while sending email.

Email delivery error: end of file reached

What is Shellshock? (Bash Vulnerability)

On Sep 24th, a vulnerability was announced with the Bash program. Bash is a program which is used on every Linux system and Mac OS. It is command interpreter and processor, typically run in a text window, allowing the user to type commands. Refer to bash description at wiki.

This vulnerability allows remote hackers to inject any code into your system and to run shell commands. Due to the vast popularity of Bash used across all web servers, most websites in the world are affected.

How to Test If Your System is Affected by Shellshock?

Try running the following command in your shell.

env x='() { :;}; echo vulnerable' bash -c "echo hello"

If your system is vulnerable for Shellshock attack then you will see:
vulnerable
If your system is alright then you will see:
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x’
hello

From the code, you can tell that the problem lies on specific characters are included as part of a variable definition for bash. If the characters “{ :;};” are included as the function definition, then any arbitrary code that is inserted after that is interpreted, which is not supposed to happen.

How to Patch Your System Against Shellshock?

If you are in Ubuntu, CentOS and other Linux Systems, you can run the following command, as most Linux distributions have already released patches for this vulnerability:

sudo apt-get update && sudo apt-get install --only-upgrade

For personal computer like Mac OS, although Apple said that the vast majority of OS X users are not at risk to recently reported bash vulnerabilities unless you have configured advanced Unix services. Refer to apple announcement here. However, upgrading your bash is still highly recommended as you won’t know if any of your program installed has opened some port and is also using bash interpreter. To upgrade bash, it is recommended to use brew or port, which is a Mac package manager.

If you are using brew, run the following commands:

 brew update
 brew install bash
 sudo sh -c 'echo "/usr/local/bin/bash" >> /etc/shells'
 chsh -s /usr/local/bin/bash
 sudo mv /bin/bash /bin/bash-backup
 sudo ln -s /usr/local/bin/bash /bin/bash

If you are using Port, run the following commands:

sudo port self update
sudo port upgrade bash

Some of the commands are taking from the official shellshock website and you should refer to the official shellshock website for more update on this issue.

You create a new user in linux with the following command. -m means create the home directory for the user.

useradd investingnote -m

Then you switch to the user.

su investingnote

Funny things happens, you can’t use up and down arrow in the terminal. It shows unreadable characters. This is because the login shell for this user is not /bin/bash but possibly /bin/sh. To check on this. Run command:

env

Possible output
TERM=xterm-256color
XDG_SESSION_ID=11
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
XDG_RUNTIME_DIR=/run/user/1001
LANG=en_US.UTF-8
SHELL=/bin/sh

Look for the last line, it tells me that I am using /bin/sh.

Change Login Shell to /bin/bash

vim /etc/passwd

You will see a line similiar to below:

investingnote:x:1001:1002::/home/investingnote:

Update it with

investingnote:x:1001:1002::/home/investingnote:/bin/bash

Now switch user and it will use /bin/bash as the login shell.

I am setting up NFS client to connect to my NFS server. In order for it to be mounted automatically whenever the server reboots, you need to add the entry to /etc/fstab.

10.01.03.45:/var/nfs  /mnt/nfs/var/nfs  nfs  auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800 0 0

After you have added new mount entry in /etc/fstab file, the new mount won’t be automatically mounted after you save the file. In order to reload /etc/fstab, you can either restart the server or use the following mount command to mount all filesystems mentioned in /etc/fstab.

mount -a

Mount All Filesystems