viernes, 6 de agosto de 2010
Forcing Apache 2.2 to use browser enconding
Anyway here we go again, Apache by default comes configured with the most popular charset encoding : UTF-8.
This setup can cause some problems when you are not born in the countries where the languaje of Shakespeare is used. If you find yourshelf asking why accents, and european signs are being transformed in question marks, then it's time to comment this setting on httpd.conf:
#AddDefaultCharset UTF-8
and add your setting :
AddDefaultCharset ISO-8859-1
Cheers , and happy holidays!!!
jueves, 24 de junio de 2010
How to configure system services
martes, 15 de junio de 2010
Stunnel with Linux
stunnel -p /etc/stunnel/stunnel.pem -D 7 -o /var/log/stunnel4/stunnel.log -A /ca/cacert.pem -d 25443 -f -r 2080
To test the server we can issue the following command
openssl s_client -connect 192.168.56.126:25443
Cheerssss
Del.icio.us
jueves, 27 de mayo de 2010
Create a Loopback filesystem from a file. Linux
miércoles, 26 de mayo de 2010
Using NTP for time sync
# and when no outside source of synchronized time is available.
server 127.127.1.0
# local clock
#fudge
127.127.1.0 stratum 10
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntp/drift
ntpdate -d 132.236.56.250
After that we will need to perform an initial sync , with the command:
ntpdate 192.168.56.101
viernes, 30 de abril de 2010
Generic script for managing a Unix service
Create a file with the following contents:
#!/bin/bash
export user_name="root"
export srv_name="serv"
export exec_dir_stop="/home/$user_name/bin/stop_serv.sh"
export exec_dir_start="/home/$user_name/bin/start_serv.sh"
case "$1" in
start)
echo -n "Starting $srv_name Service Daemon"
/usr/bin/sudo -u $user_name $exec_dir_start
;;
stop)
echo -n "Shutting $srv_name Service Daemon"
/usr/bin/sudo -u $user_name $exec_dir_stop
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Save it with a descriptive name on /etc/init.d (or /etc/rc.d) , for instance http_filter . Change the access rights to the user in charge of managing the service, and create a softlink on the run level you want the service to be started.
martes, 6 de abril de 2010
How to use ffmpeg to convert a video stream from avi to flv
martes, 16 de marzo de 2010
Curl https client certificate negotiation
curl --cert buenokpl.pem --key buenokpr.pem --pass fulano123 -k -v https://www.google.es
Reading socket identifier from proc fs
ls -ltr|grep -i socket
fetch the socket id on the rigth side and do a netstat -ae|grep -i
miércoles, 10 de marzo de 2010
Getting server certificates with openssl
jueves, 18 de febrero de 2010
Mounting an iso file.
No more words needed...
mount -o loop -t iso9660 /var/spool/isoFile.iso /mnt/cdrom
lunes, 15 de febrero de 2010
Copy MBR from one disk to another
dd if=/dev/sda of=/dev/sdb bs=512 count=1
Getting Virtualized!!!
There are a few steeps that are needed in order to achive this goal:
- Define a virtualized hardware: CPU, Memory, IO, Networking.
- Export the data: this is the most critical process.
In order to get an vmkd file or vdi of an existing physical instalation consists in a few steps that i will explain here:
- First, boot the operating system with a live linux cd.
- Second, identify the partition or partitions involved in the recovery. For instance hd3
- Third, make a good use of dd like this one:
dd if=/dev/hdc of=/mnt/USB/diskImage/win2k3.img bs=1024
the partition will be dumped into a file.
- Fourth: qemu-img convert -f raw /mnt/USB/diskImage/w2k3.img -O vmdk /mnt/external/diskImage/w2k3.vmdk
VMware: Using player to install yor VM's
I had found a website that allows you to define a vmx file (the configuration file) but i have found also a procedure to create your own.
The basics.
virtualHW.version
This parameter defines the version used. Defaults to 4
displayName
This parameter will be used in order to identify the virtual machine.
memsize
This parameter is obvious. Configures the amount of memory reserved for the vm.
defaults to Megabytes. Example 512
ideX:X.fileName
This parameter will be used in order to identify the disk . An example could look like this: "FREEDOS.vmdk"
ideX:X.present
Enables the availability of the disk to the vm. TRUE/FALSE
guestOS
The id of the operating system. See bellow in the Guest OS section list.
example winXPPro
Network
This section is a little bit more complicated. Each nic can have 3 status:
- bridget.
- hostOnly
- Internal Network.
Example :
ethernet0.present = "TRUE"
ethernet0.vnet = "VMnet0"
ethernet0.virtualDev = "vlance"
cdrom.
ide1:0.fileName = "E:\2k3-sp1-pebuilder313\pebuilder.iso"
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1.1.present = "FALSE"
A more complex vmx file.
This example has been extracted from http://sanbarrow.com/vmxbuilder.html
###### stupid-long-name .vmx #################
######
###### use copy and paste
###### to export this file
######
#######################################
####### generated by Ullis VM builder #
####### Identity ######################
displayName = "stupid-long-name"
# Devices
config.version = "8"
virtualHW.version = "4"
memsize = "512"
numvcpus = "2"
guestOS = "winNetEnterprise"
####### ide-disks #####################
ide0.0.present = "FALSE"
ide0.1.present = "FALSE"
ide1:0.present = "TRUE"
ide1:0.fileName = "E:\2k3-sp1-pebuilder313\pebuilder.iso"
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1.1.present = "FALSE"
####### scsi-controllers ##################
scsi0.present = "TRUE"
scsi0.virtualDev = "buslogic"
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
####### scsi-disks #####################
scsi0:0.present = "FALSE"
scsi0:1.present = "FALSE"
scsi0:2.present = "FALSE"
scsi0:3.present = "FALSE"
scsi0:4.present = "FALSE"
scsi0:5.present = "FALSE"
scsi0:6.present = "FALSE"
scsi1:0.present = "FALSE"
scsi1:1.present = "FALSE"
scsi1:2.present = "FALSE"
scsi1:3.present = "FALSE"
scsi1:4.present = "FALSE"
scsi1:5.present = "FALSE"
scsi1:6.present = "FALSE"
####### nics ##########################
ethernet0.present = "TRUE"
ethernet0.vnet = "VMnet0"
ethernet0.virtualDev = "vlance"
ethernet1.present = "TRUE"
ethernet1.vnet = "VMnet1"
ethernet1.virtualDev = "vmXnet"
ethernet2.present = "TRUE"
ethernet2.vnet = "VMnet2"
ethernet2.virtualDev = "vlance"
ethernet3.present = "TRUE"
ethernet3.vnet = "VMnet3"
ethernet3.virtualDev = "vmXnet"
####### sound #########################
sound.present = "FALSE"
####### usb ###########################
usb.present = "FALSE"
####### floppies #######################
floppy0.present = "FALSE"
floppy0.startConnected = "FALSE"
floppy1.present = "FALSE"
floppy1.startConnected = "FALSE"
####### ports #########################
parallel0.present = "FALSE"
serial0.present = "FALSE"
serial1.present = "FALSE"
####### cluster-options ##################
####### skipping Cluster-options ###########
The Guest Os supported.
Bellow is the list of operating systems supported and the Id
Microsoft Windows, 32-bit
winVista = Windows Vista (experimental)
longhorn = Windows Longhorn (experimental)
winNetBusiness = Windows 2003 Small Business Server
winNetEnterprise = Windows 2003 Enterprise Server
winNetStandard = Windows 2003 Server
winNetWeb = Windows 2003 Web Server Edition
winXPPro = Windows XP Professional Edition
winXPHome = Windows XP Home Edition
win2000AdvServ = Windows 2000 Advanced Server
win2000Serv = Windows 2000 Server
win2000Pro = Windows 2000 Professional
winNT = Windows NT
winMe = Windows Me
win98 = Windows 98
win95 = Windows 95
win31 = Windows 3.1 / Windows 3.11
windows = Other Windows
Microsoft Windows, 64-bit
winVista-64 = Windows Vista x64 Edition (experimental)
longhorn-64 = Windows Longhorn x64 Edition (experimental)
winNetEnterprise-64 = Windows 2003 Enterprise Server x64 Edition
winNetStandard-64 = Windows 2003 Server x64 Edition
winXPPro-64 = Windows XP Professional x64 Edition
Linux, 32-bit
ubuntu = Ubuntu Linux
redhat = Red Hat Linux
rhel4 = Red Hat Enterprise Linux 4
rhel3 = Red Hat Enterprise Linux 3
rhel2 = Red Hat Enterprise Linux 2
suse = SuSE Linux
sles = SuSE Linux Enterprise Server
mandrake = Mandrake Linux
nld9 = Novell Linux Desktop 9
sjds = Sun Java Desktop System
turbolinux = Turbo Linux
other26xlinux = Other Linux on a 2.6.x kernel
other24xlinux = Other Linux on a 2.4.x kernel
linux = Other Linux
Linux, 64-bit
ubuntu-64 = Ubuntu Linux 64-bit
rhel4-64 = Red Hat Enterprise Linux 4 64-bit
rhel3-64 = Red Hat Enterprise Linux 3 64-bit
sles-64 = SuSE Linux Enterprise Server 64-bit
suse-64 = SuSE Linux 64-bit
other26xlinux-64 = Other Linux 2.6.x 64-bit
other24xlinux-64 = Other Linux 2.4.x 64-bit
otherlinux-64 = Other Linux 64-bit
Sun Microsystems Solaris
solaris10-64 = Solaris 10 64-bit
solaris10 = Solaris 10
solaris9 = Solaris 9
solaris8 = Solaris 8
solaris7 = Solaris 7
solaris6 = Solaris 6
solaris = Other Solaris
Novell Netware
netware6 = Netware 6.x
netware5 = Netware 5.x
netware4 = Netware 4.x
netware = Other Netware
FreeBSD
freeBSD-64 = FreeBSD 64-bit
freeBSD = FreeBSD
Apple Darwin
darwin = Apple Darwin (unsupported)
Other
other = Other OS
other-64 = Other 64-bit OS
viernes, 12 de febrero de 2010
VMDK file creation with QEMU
and execute the following command:
>qemu-img.exe create -f vmdk WindowsXPPro.vmdk 2G for windows
>qemu-img create -f vmdk WindowsXPPro.vmdk 2G for linux
jueves, 11 de febrero de 2010
Ldap timestamp search
I had to produce an incremental ldif file from an ldap server. This file had to have all ldap entries modified from a certain date (for example 1st of Febrary 2010). But the issue was not as easy as it sounds, mainly because i had to guess what was the search string that provided a valid filter in order to get the desired results.
The format is as follows:
YYYYMMDDhhmmssZ
4 digit Year
2 digits Month
2 digits Day
2 digits hour
2 digits minute
2 digits second
End with "Z" char
Example:
ldapsearch -x -H ldaps://A.B.C.D:636 -D "cn=admin,o=demo" -W -b "ou=users,o=kasa" "modifyTimestamp>=20100201000000Z" >tst.ldif
I hope that it will be usefull for you.
martes, 2 de febrero de 2010
Multiple CPU top report
lunes, 25 de enero de 2010
Changing ip address with IP command
jueves, 7 de enero de 2010
Changing the UUID of a disk for a virtual machine on Sun Virtual Box
First of all, I want to wish to every person who visits this site a happy new year.
2009 has been a very difficult year for a lot of people i know (even myself) , and i hope 2010 to be much better with a lot of new challenges, experiences, etc...
Back to our blog, i want to share a tip that will allow us to duplicate the UUID of a disk.
This is very helpful when you need to reuse a clean operating system installation on several vms on the same machine.
By default Virtual Box will complain with a message saying that
"hard disk with UUID {55b773b8-cbcb-42ea-9a44-1368b3XXXX} or with the same properties is already registered" failing to load the disk.
In order to avoid this, just type :
VBoxManage internalcommands setvdiuuid
and a new UUID will be generated and assigned.
Ciaooo!