Saturday, November 27, 2010

Troubleshooting newly build BIND DNS under Mandriva Enterprise 5

I'm having a super headache figuring out the solution on how to solve this problem. Ok the problem was i can't query the DNS server from client to Mandriva DNS Server so the solution was this:  

1. check the packets first using tcpdump :  tcpdump -pni any port 53
2. check the server and client using dig command and see if you have the ouput 
3. if you have the output then tail the log file on named  
tail -f -n0 /var/lib/named/var/log/*.log 
4. if you have no output result coming from the client meaning it is blocked by bogon network 
5. go to /var/lib/named/etc/bogon_acl.conf and trusted_networks_acl.conf
6. and check your network 
7. thats it! damn! It gives me a super headache on this simple problem.

Tnx for my fellow linux gurus..

Tuesday, November 23, 2010

LIBVRT virtualization API

The Virtualization API

libvirt is:

  • A toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes).
  • Free software available under the GNU Lesser General Public License.
  • A long term stable C API
  • A set of bindings for common languages
  • A CIM provider for the DMTF virtualization schema
  • A QMF agent for the AMQP/QPid messaging system

Hide printer icon on Samba

Hayz, this is easy as this 
add this on your global configuration.

 disable spoolss = yes

Nagios NRPE addon installation and configuration under Debian

Nagios is a service that, by default, runs on only one node. That host node can be used to check various services on other nodes - including SSH, ping, web services, and many others - but it can't execute commands on remote machines. In order to do that, you need to install the Nagios NRPE plugin, sometimes called the Nagios client. This plugin has two components: a simple plugin for Nagios on the host machine, and an NRPE daemon. The daemon needs to be installed on every machine than the host will be running remote commands on.

Mount an ISO image under Linux

Procedure to mount ISO images under Linux

1) You must login as a root user, if not root user then switch to root user using following command:
$ su -
2) Create the directory i.e. mount point:
# mkdir -p /mnt/disk
3) Use mount command as follows to mount iso file called disk1.iso:
# mount -o loop disk1.iso /mnt/disk
4) Change directory to list files stored inside an ISO image:
# cd /mnt/disk
# ls -l

Monday, November 22, 2010

Creating a ISO file using mounted Bootable CD-Rom on it

This is just an easy as this. First locate and mount device CDrom on your linux box, after mounting it create an image of it using the command below.

Saturday, November 20, 2010

Installing PHPmyAdmin on Debian/Ubuntu

1. apt-get install phpmyadmin (make sure you have php and mysql installed)

2. change apache2 configuration according to /etc/phpmyadmin/apache.conf

3. /etc/init.d/apache2 restart

http://localhost/phpmyadmin

Friday, November 19, 2010

Creating a 100Mb of file using DD

I'm not more on using dd since then on linux, but this time DD command is one the most useful tool on linux. I'm looking a way where i can create a 100Mb file for testing uploading and downloading for our network, so dd comes in my mind..here's how i do it.

1. go to /tmp or any directory you want to uphold the 100Mb file 
2. dd if=/dev/zero of=100MBfile bs=1M count=100
3. or dd if=/dev/zero of=100Mbfile bs=100M count=1

Legend : 
dd - convert and copy file -> man dd
of=FILE - write to file instead stdout
bs=BYTES - read and write Bytes at a time 
count=BLOCKS - copy only BLOCKS input blocks

Thursday, November 18, 2010

Puppet nagios module

Just to keep as referenced, in case i'll be needing it for study
class nagios {

    package {
      "nagios":  ensure => present;
      "httpd":   ensure => present;
    }


Monday, November 15, 2010

building up XEN under Debian 5.0 Lenny

I've been playing around with XEN on debian 5 Lenny,  Trip lang!

Installing XEN using source

apt-get install xen-hypervisor-i386 linux-image-2.6-xen-686 linux-headers-2.6-xen-686 \
                         xen-utils-3.2-1 xen-tools bridge-utils
 
Check ang login again 
uname -a 
Linux debian 2.6.26-2-xen-686 #1 SMP Fri Sep 17 00:54:08 UTC 2010 i686 GNU/Linux
As you see we are now running xen on kernel 2.6.26 so we now have available Dom-0 available by typing this one
 xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  3747     4     r-----     42.0

EOLUpgrades Ubuntu

Introduction

This page will explain how to upgrade an End of Life (EOL) release of Ubuntu to a supported system. This guide is not limited to Ubuntu (with the Gnome desktop). Any Ubuntu flavor (Kubuntu/Edubuntu and/or server installation and others) can use this guide. For upgrading supported releases please refer to this document. Mac users may have some difficulty upgrading to the most current release around versions 7.04/7.10.
If you want to know whether your release is EOL please have a look at the following resources:
These guides assumes that the user knows his way on the terminal, as no graphical tools are used. This said, the steps for executing all the commands are actually copy/pasteable so everyone, from beginner to advanced user running EOL releases of Ubuntu can execute the upgrade(s).

Why upgrade

Why should you upgrade instead of performing a clean install of a supported version? Some don't like to perform new installations when there is a possibility to upgrade. The advantage of this is that you can keep your current configuration without having to change much. This is often the case in production environments where you don't want to lose a machine just because it needs a higher OS version.
The scientific approach. It is possible to do, so why wouldn't we give it a shot? This is how I started out writing this guide. I had to help someone else, who was in another timezone and I thought my sleep was precious so I wrote a guide telling him how to upgrade to 8.04. When I was finished I decided it was fun to see if I could upgrade from 4.10 to the most current version (I admit, I took a shortcut when I arrived at 6.06, I upgraded directly to 8.04).
Also, if your computer cannot start a live USB for whatever reason, and all you have is a Dapper Drake installation disc, then there's no other choice: you have to download the updates and install them from within Ubuntu.
The last reason is more a flame. Why would we do it the Microsoft way? If we don't know, just restart... Why don't we try to fix the issue, even if it takes a bit more time. The time it takes per upgrade is dependent on your installation.
There are reasons why one should not upgrade, but rather reinstall. From 9.04 (jaunty) ext4 becomes available. If you want to benefit from the new features ext4 has for you then you might just as well reinstall one of the supported releases (LTS and non-LTS). 

Saturday, November 13, 2010

Another Puppet manifest for Debian

$apache2_sites = "/etc/apache2/sites"
$apache2_mods = "/etc/apache2/mods"

class apache2 {

   # Define an apache2 site. Place all site configs into
   # /etc/apache2/sites-available and en-/disable them with this type.
   #
   # You can add a custom require (string) if the site depends on packages
   # that aren't part of the default apache2 package. Because of the
   # package dependencies, apache2 will automagically be included.
   define site ( $ensure = 'present' ) {
      case $ensure {
         'present' : {
            exec { "/usr/sbin/a2ensite $name":
               unless => "/bin/readlink -e ${apache2_sites}-enabled/$name",
               notify => Exec["reload-apache2"],
               require => Package[$require],
            }
         }
         'absent' : {
            exec { "/usr/sbin/a2dissite $name":
               onlyif => "/bin/readlink -e ${apache2_sites}-enabled/$name",
               notify => Exec["reload-apache2"],
               require => Package["apache2"],
            }
         }
         default: { err ( "Unknown ensure value: '$ensure'" ) }
      }
   }

Friday, November 12, 2010

Reset Administrator Account on MAC OS without CD

I've been looking around for this solution. Got it on a simple way..
Creating a new Admin on Mac Os X: 

Here's how to reset your OS X password without an OS X CD.
the Working solution for me was to create a new admin
you can create new admin like this by deleting a specific file.

You need to enter terminal and create a new admin account:

1. Reboot
2. Hold apple key + s key down after you hear the chime. (command + s on newer Macs)
3. When you get text prompt enter in these terminal commands to create a brand new admin account (hitting return after each line):

mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h now

4. After rebooting you should have a brand new admin account. When you login as the new admin you can simply delete the old one and your good to go again!


Thursday, November 11, 2010

Ubuntu Jaunty 9.04 End of Life

Ubuntu 9.04 Jaunty has reached EOL (End Of Life). It is no longer supported by Ubuntu with security updates and patches. You have known this day was coming for 1.5 years, as all non-LTS Ubuntu releases are supported for only 18 months.
I have no plans to delete the Ubuntu 9.04 Jaunty AMIs for EC2 published under the Alestic name in the foreseeable future, but I request, recommend, and urge you to please stop using them and upgrade to an officially supported, active, kernel-consistent release of Ubuntu on EC2 like 10.04 LTS Lucid or 10.10 Maverick.

Installing FACTER on Ubuntu/Debian

 Facter is a cross-platform Ruby library for retrieving facts from operating systems. It supports multiple resolution mechanisms, any of which can be restricted to working only on certain operating systems or environments. Facter is especially useful for retrieving things like operating system names, IP addresses, MAC addresses, and SSH keys. It is easy to extend Facter to include your own custom facts or to include additional mechanisms for retrieving facts.

command :
sudo apt-get install facter

For Referenced:

Tuesday, November 9, 2010

PUPPET Dashboard on CentOS/Ubuntu

I've been testing PUPPET Dashboard engine on CentOS 5.0, this may also work on Ubuntu or Debian also.

The Puppet Dashboard allows you to display the results of your Puppet runs on your hosts and provides a node classification tool to configure your hosts.

Adding Yum or Apt repositories
First, we need to add either the Puppet Labs Yum or Apt repositories. For Yum, we need to create a Yum repo entry for Puppet Labs:

$ vi /etc/yum.repos.d/puppetlabs.repo
Add the following to the entry:
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/base/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs


Then install via Yum.
$ sudo yum install puppet-dashboard

You will be prompted to install the Puppet Labs release key as part of the installation process.
For Apt, we need to add entries to the /etc/apt/sources.list file:
deb http://apt.puppetlabs.com/ubuntulucid main
deb-src http://apt.puppetlabs.com/ubuntulucid main


And then add the Puppet Labs GPG key to Apt.
$ gpg --recv-key 4BD6EC30
$ gpg -a --export 4BD6EC30 | sudo apt-key add -


Next, we run an update:

$ sudo apt-get update

And then install the package:
$ sudo apt-get install puppet-dashboard

On both Red Hat and Ubuntu hosts, the Puppet Dashboard will be installed into the /usr/share/puppet-dashboard directory.



Configuring the Rails application
Next, we need to configure the Rails application, starting with a database. Currently the Dashboard only supports MySQL databases, so create one:
$ mysql --u root p
mysql> CREATE DATABASE dashboard CHARACTER SET utf8;
mysql> CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'password';

mysql> GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';

Here we’ve created a database called dashboard, added a user called dashboard and granted that user appropriate privileges to the database. You should replace “password” with an appropriate password.
Next, we need to tell Dashboard about the database. To do this, we configure a database.yml file in the /usr/share/puppet-dashboard/config directory.
The package contains an example file called database.yml.example that we can copy and edit:
$ cp database.yml.example database.yml
$ vi database.yml
Update the production stanza in the file like so (replacing password with the password you chose above):
production:
adapter: mysql
database: dashboard
username: dashboard
password: password
encoding: utf8
This stanza needs to be valid YAML, so ensure you keep the existing indentation.
Lastly, we need to populate our new database with tables and base data. To do this we use a Rake task.  From the /usr/share/puppet-dashboard directory, run:
$ rake RAILS_ENV=production db:migrate

Now Dashboard is fully configured and we can run the Rails application. There are a lot of ways to run Rails applications. One way is to use the internal Webrick server (this isn’t really great for production, as it doesn’t scale very well).
From the /usr/share/puppet-dashboard directory, run:
$ sudo ./script/server -e production

This will run the Dashboard on port 3000 and you can access it via a Web browser:
http://your.host.name:3000
Getting Puppet reports to the Puppet Dashboard
Now the Dashboard is running and we need to ensure it gets our Puppet reports. There are a few ways we can do this, starting with importing old reports using a Rake task. From the /usr/share/puppet-dashboard directory, run:
$ rake RAILS_ENV=production reports:import

This assumes your Puppet master is on the local host and will import any report files located in the Puppet vardir (usually /var/lib/puppet/reports, but you can specify an alternative with the REPORT_DIR option). You can run this multiple times or schedule it with a cron job -- it recognizes reports it has previously imported and will only add new reports.
You can also configure Puppet to automatically report to the Dashboard using two methods, the first for Puppet versions 0.25.x and earlier, and the second for Puppet versions 2.6.x and later. For Puppet 0.25.x and earlier, ensure you have reports enabled on your clients by adding report = true to the [puppetd] stanza of your puppet.conf configuration file on every client you wish to have reporting. Then on the Puppet master, add /usr/share/puppet-dashboard/lib/puppet to Puppet’s libdir in the puppet.conf file like so:
[main]
libdir = /usr/share//puppet-dashboard/lib/puppet:/var/puppet/lib

And enable the Puppet Dashboard report:
[puppetmasterd]
reports = puppet_dashboard, any-other-reports
This report assumes your Puppet Dashboard is running on the local host at port 3000. You can adjust this location by editing the file /usr/share/puppet-dashboard/lib/puppet/puppet_dashboard.rb file and updating the HOST and PORT options at the top of the file.
On Puppet 2.6.x and later, you need to enable reports on your clients:
[agent]
report = true
And then specify the http report type and use the new reporturl option to specify the target host and URL like so:
[master]
reporturl=http://localhost:80/reports
reports=http


Update the host and port to match your environment (you should leave the reports suffix on the URL).
Now the Puppet Dashboard should be receiving your Puppet reports and you’re done! When you navigate to the page, you should see the Puppet Dashboard’s home screen.


Reconfiguring Xorg on Debian/Ubuntu

In case, "you've encountered that dpkg-reconfigure xserver-xorg" is not working, you may try this one:
 


Code:
ctrl-alt-f1
To exit the gui.
Now login as root,and enter the following commands:

Code:
# /etc/init.d/gdm stop  (to stop gdm/kdm as required.)
# X -configure
# mv ~/xorg.conf.new /etc/X11/xorg.conf
# /etc/init.d/gdm start
You should now be back in the gui,but you need to logout as root:

Code:
ctrl-alt-f1 again.
ctrl-d
ctrl-alt-f7
Once you get to this point you should have a working xorg.conf file.
I've found this solution on this forum: 
http://www.linuxquestions.org/questions/debian-26/how-to-install-nvidia-drivers-for-debian-gnu-linux-749929/

APT-CACHER Server on Ubuntu

I've been playing this some time ago to ease bandwidth updates on ubuntu platform. Hope this maybe helpful on building your own apt.
Server Installation

1. Install apt-cacher and apache2 webserver
sudo apt-get install apt-cacher apache2

2. Enable apt-cacher
Edit /etc/default/apt-cacher and change autostart to 1

Note: I had problems doing this on a machine with apache already installed.

Added by JT: Restart apache if you already had it installed: sudo invoke-rc.d apache2 restart

Added by pablodav: I suggest to restart apt-cacher also: sudo invoke-rc.d apt-cacher restart

Then test by going to http://server/apt-cacher to verify that it's running. Added by pablodav: In Jaunty use http://server:3142 instead http://server/apt-cacher (this seems to be not working anymore with /apt-cacher).


Simple Guide on Installing LAMP on Ubuntu/Debian

A simple guide to easily setup your LAMP server
sudo apt-get install apache2
test your apache http://localhost
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
http://localhost/testphp.php

Install MySQL
sudo apt-get install mysql-server
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

FTP batch for windows uploading of file

I've been thinking;if there would be a way to upload my windows log to my FTP server. and then came out with this on my mind. Hope you find it useful..

D:                             ;where batch file the will be located
open 1.2.3.4             ; open the session for ftp given the sample address
user                          ; ftp username
password                  ; ftp password
put logon.log            ; file to put on ftp server
put logoff.log            ; same
quit                           ; quit parameter

Monitor Untangle 7.x using NRPE

I've been looking for this to monitor my untangle box using NRPE. Below is the link for the reference


http://forums.untangle.com/tip-day/12794-howto-monitoring-untangle-using-nrpe-nagios-untangle-7-x.html

Monday, November 8, 2010

keePassMobile

Have you ever wonder how to centralized store all your password and username in your mobile. Check this out see if it can help you..


KeePassMobile V0.9

Secure Password Management On The Go!


Download KeePassMobile V0.9 to your mobile phone. Don't worry if your phone says that KeePassMobile is from "unverified" or "untrusted" source. This is a default message which some phones display before installing an application. Please click YES to continue.
Click here after download has finished.

Here's the link:
http://m.keepassmobile.com/

Installing SNMPD on Debian5/Lenny

I've created this cheat just to ease researching on how to install snmpd on debian

Install snmpd with : sudo apt-get install snmpd
backup /etc/snmpd/snmpd.conf or cp /etc/snmpd/snmpd.conf snmpd.bak 
rm -f /etc/snmpd/snmpd.conf; touch /etc/snmpd/snmpd.conf
Open /etc/snmp/snmpd.conf using your favorite editor 
vim for me i'm much more of it.
sudo vim /etc/snmp/snmpd.conf


create a very minimal configuration: 

rocommunity <community string you want>
syscontact <contact cacti administrator>
syslocation <location>


Save and Exit the file


Change /etc/default/snmpd so that it contains the following line to

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid’ 
 
sudo /etc/init.d/snmpd restart.
 
To test: snmpwalk -v 1 -c <community string here> localhost 
 
That should do it. 

Connecting printer using batch file on windows

 I'm thinking if how can i remotely install printer using the command prompt
 upon searching it over the google and found the answer. I've created a very very simple batch file that will connect to remote printer sharing.

@echo off
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\ip-of-printer\<shared printer name>

I've done it on WindowsXP maybe it should work also on Windows2000 also but I'm not sure on lower Windows98,etc..

Building Nagios on Debian/Ubuntu

This is one of the things i've done on my work.
Many of you wants to have monitoring for your network, I've found this blog link on how to setup and build your Nagios on using Debian as nagios. You may checked the link below

HOWTO install Nagios:

Required Packages
Make sure you've installed the following packages on your Ubuntu installation before continuing.
  • Apache 2
  • PHP
  • GCC compiler and development libraries
  • GD development libraries
You can use apt-get to install these packages by running the following commands:
sudo apt-get install apache2

sudo apt-get install libapache2-mod-php5

sudo apt-get install build-essential

With Ubuntu 6.10, install the gd2 library with this command:
sudo apt-get install libgd2-dev

With Ubuntu 7.10, the gd2 library name has changed, so you'll need to use the following:
sudo apt-get install libgd2-xpm-dev

1) Create Account Information
Become the root user.
sudo -s

Create a new nagios user account and give it a password.
/usr/sbin/useradd -m -s /bin/bash nagios

passwd nagios

On older Ubuntu server editions (6.01 and earlier), you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu.
/usr/sbin/groupadd nagios

/usr/sbin/usermod -G nagios nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd www-data

2) Download Nagios and the Plugins
Create a directory for storing the downloads.
mkdir ~/downloads

cd ~/downloads

Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). These directions were tested with Nagios 3.1.1 and Nagios Plugins 1.4.11.
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

3) Compile and Install Nagios
Extract the Nagios source code tarball.
cd ~/downloads

tar xzf nagios-3.2.3.tar.gz

cd nagios-3.2.3

Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd

Compile the Nagios source code.
make all

Install binaries, init script, sample config files and set permissions on the external command directory.
make install

make install-init

make install-config

make install-commandmode

Don't start Nagios yet - there's still more that needs to be done...
4) Customize Configuration
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
vi /usr/local/nagios/etc/objects/contacts.cfg

5) Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.
/etc/init.d/apache2 reload

Note Note: Consider implementing the ehanced CGI security measures described here to ensure that your web authentication credentials are not compromised.
6) Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

7) Start Nagios
Configure Nagios to automatically start when the system boots.
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.
/etc/init.d/nagios start

8) Login to the Web Interface
You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier.
http://localhost/nagios/

Click on the "Service Detail" navbar link to see details of what's being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.
9) Other Modifications
If you want to receive email notifications for Nagios alerts, you need to install the mailx (Postfix) package.
sudo apt-get install mailx

sudo apt-get install postfix

You'll have to edit the Nagios email notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any '/bin/mail' references to '/usr/bin/mail'. Once you do that you'll need to restart Nagios to make the configuration changes live.
sudo /etc/init.d/nagios restart 
 
Referenced: 
http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html