Puppet Installation

In my lab I have set up the CentOS 6.3 as the Puppet Master server, and Ubunt 12.10 as the Puppet agent.

Install Puppet-Server on CentOS (Master)

sudo rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-6.noarch.rpm
sudo yum install puppet-server

Install Puppet on Ubuntu (Agent)

wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
sudo dpkg -i puppetlabs-release-precise.deb
sudo apt-get update
sudo apt-get install puppet 

Specify the Puppet Master server name in /etc/puppet/puppet.conf in Agent


Enable the service

In Agent: sudo puppet resource service puppet ensure=running enable=true
In Master: sudo puppet resource service puppetmaster ensure=running enable=true

Request (Agent) and Sign Certificate (Master)

In Agent: sudo puppet agent –test (or sudo puppet agent, when with ‘–test’ it only runs once)
In Master: sudo puppet cert sign –all

Test – Create a file in the Agent

In Master: 

vi /etc/puppet/manifests/site.pp

node default{
file {“/tmp/puppet_test_file”:
content => “this is a puppet test file”}

In Agent: sudo puppet agent –test

Reference: http://docs.puppetlabs.com/guides/installation.html

Disable the blinking wifi LED in Ubuntu

The wifi LED keeps blinking in my Ubunut 12.10 laptop (Intel chips) when it is connected. To disable it, I have changed the led_mode to 0. Here is how I did it:

1) Change to root user.

jchen@JC:~$ sudo -i
[sudo] password for jchen: 

2) Find out the wifi module.

root@JC:~# lsmod | grep iw
iwlwifi               348584  0 
mac80211              461203  1 iwlwifi
cfg80211              175574  2 iwlwifi,mac80211

3) Change the led_mode to 1.

root@JC:~# vi /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system.  When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod)
&& /sbin/modprobe -r mac80211
options iwlwifi led_mode=1

4) Reload the wifi module

root@JC:~# modprobe -r iwlwifi && modprobe iwlwifi 
root@JC:~# exit

Screen brightness reset in Ubuntu

My Ubuntu laptop’s screen brightness resets everytime after reboot. I have found a way to make the brightness adjustment ‘stay permantly':

1) Adjust the brightness to the level that I like, then run ‘cat /sys/class/backlight/acpi_video0/brightness ‘. The command will return the brightness level in a integer value. Mine is 12.
2) Add the line ‘echo 12 > /sys/class/backlight/acpi_video0/brightness‘ into the /etc/rc.local file.

Fortinet SSL VPN Client in Ubuntu

It is intereting that the Fortinet SSL VPN client works fine in my Windows machine, but does not work in my Ubuntu laptop. I have found the reason is that a few routes are missed in the routing table. To make it work, I wrote a script to manually add those routes after VPN is connected.

Create an executable file named VPN under /usr/local/bin. Next time just run the command VPN to connect vpn and add routes.


# Start VPN

# Check if ppp0 is ready
while ! ifconfig  | grep ppp0 >/dev/null 2>&1
echo VPN is connecting…
sleep 3

# Add routes
IP=`ifconfig ppp0 | grep ‘inet addr’ | awk ‘{print $2}’ | cut -d':’ -f2`
sudo route add -net gw $IP dev ppp0
sudo route add -net gw $IP dev ppp0

Auto Configure Proxy in Ubuntu

It is painful to turn the proxy on and off in my Ubuntu laptop between office and home.  As a lazy guy, I would like to make it automatic. Easy life now :)
1) Create 3 scripts named proxy_on, proxy_off and check_proxy under /usr/local/bin.
gsettings set org.gnome.system.proxy.socks host ‘proxy.company.local’
gsettings set org.gnome.system.proxy.socks port 80
gsettings set org.gnome.system.proxy mode ‘manual’
gsettings set org.gnome.system.proxy mode ‘none’

ping_test=`ping -c 2 proxy.company.local | grep bytes | wc -l`
if [ "$ping_test" -gt 1 ]; then

2) Add check_proxy to the auto startup programes by creating the file ~/.config/autostart/check_proxy.desktop
[Desktop Entry]