Archive

Archive for the ‘Debian’ Category

cloning disk using dd

May 29th, 2008

from your machine to external usb disk:

dd if=/dev/<your machine disk> | gzip > /path/nameofyourimg.gz

from your img saved to external usb disk:

zcat /path/nameofyourimg.gz | dd of=/dev/<your machine disk>

Debian, Linux, Shell , , , ,

Apply Quota Patch To Postfix

April 30th, 2007

apt-get install build-essential dpkg-dev fakeroot debhelper libdb4.2-dev libgdbm-dev libldap2-dev libpcre3-dev libmysqlclient10-dev libssl-dev libsasl2-dev postgresql-dev po-debconf dpatch (1 line!)
cd /usr/src
apt-get source postfix
wget http://web.onda.com.br/nadal/postfix/VDA/postfix-2.1.5-trash.patch.gz
gunzip postfix-2.1.5-trash.patch.gz
cd postfix-2.1.5
patch -p1 < ../postfix-2.1.5-trash.patch
dpkg-buildpackage
cd ..
dpkg -i postfix_2.1.5-9_i386.deb
dpkg -i postfix-mysql_2.1.5-9_i386.deb
dpkg -i postfix-tls_2.1.5-9_i386.deb

Debian, Linux , ,

Ping a list of many hosts

December 21st, 2006

cat config |grep title |awk -F- ‘{print $4}’|grep -o ‘[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9]*’ |xargs -n 1 -P 254 ping -c1 -w1

Debian, Linux ,

Postgrey report

December 19th, 2006

#cat /var/log/mail.log | postgreyreport \
–nosingle_line –check_sender=mx,a –show_tries \
–separate_by_subnet=”:===============================================================================================\n”

Debian, Linux ,

Install Debian on CF

November 16th, 2006

dmesg # look for your CF part, mine is hde
cfdisk /dev/hdx #delete all, make a partition, set bootable, write, exit
mkfs.ext3 /dev/hdx1
mkdir /mnt/cf
mount /dev/hdx1 /mnt/cf

debootstrap sarge /mnt/cf # edit /usr/lib/debootstrap/scripts/sarge
# to remove unwanted packages, like man
# cdebootstrap also exists in testing

sync
du -sh /mnt/cf

Debian, Linux , ,

Monitoring your hardware’s temperature

November 13th, 2006

Sometimes it is useful to know the temperature of your hardware, to prevent it from frying. This information can easily be found, if your hardware provides the sensors needed, and we have the necessary software.

Most computers come with temperature sensors, which can be used to prevent your hardware from excessive heat. The most important thing to watch is, of course, your CPU temperature. This is where lm-sensors comes in. So, lets install it: Read more…

Debian, Linux , ,

Install Steps VHCS 2.4.6.2 in Debian 3.1 base install

November 6th, 2006

On install of Debian, select no packages to be installed, allow it to connect to the internet and let it download anything it needs, usually its libs etc. Exim is most likely installed at this point so dont worry it will be removed shortly.

1).vi /etc/apt/sources.list (add the following sources)

Code:
deb ftp://ftp.uk.debian.org/debian/ stable main
deb-src ftp://ftp.uk.debian.org/debian/ stable main
deb http://security.debian.org/ stable/updates main

(dont forget to run “apt-get update” after)

2). apt-get install postfix postfix-tls proftpd-mysql courier-authdaemon courier-base courier-imap courier-maildrop courier-pop libberkeleydb-perl libc-dev libcrypt-blowfish-perl libcrypt-cbc-perl libcrypt-passwdmd5-perl libdate-calc-perl libdate-manip-perl libdbd-mysql-perl libdbi-perl libio-stringy-perl libmail-sendmail-perl libmailtools-perl libmd5-perl libmime-base64-perl libmime-perl libnet-dns-perl libnet-netmask-perl libnet-perl libnet-smtp-server-perl libperl5.8 libsnmp-session-perl libterm-readkey-perl libtimedate-perl perl perl-base perl-modules bind9 diff gzip iptables libmcrypt4 mysql-client-4.1 mysql-common-4.1 mysql-server-4.1 patch php4 php4-mcrypt php4-mysql php4-pear procmail libterm-readpassword-perl libsasl2-modules libsasl2 sasl2-bin apache2 apache2-common apache2-mpm-prefork libapache2-mod-php4 gawk libgd1g bzip2 wget make

(when you get to the courier screen screen select no to web directories)
(when you get to the postfix screen select internet site and then type root for mail. If you set debian up correctly on install your domain should be already on screen. Select no to force sync updates.)
(when yo get to the mysql screen, select standalone)

3). mysql -u root (no password at this stage, change it later!)

Code:

create database vhcs2;
use vhcs2
grant all privileges on *.* to ‘vhcs2′@’localhost’ identified by ‘vhcs2′ with grant option;
\q (quit program)

4). apt-get remove apache-common (if installed – not needed)

5). wget http://ufpr.dl.sourceforge.net/sourceforge/vhcs/vhcs2.4.6.2.tar.bz2

6). tar -xjvf vhcs2.4.6.2.tar.bz2

7). cd vhcs2.4.6.2

8). cd configs

9). vi vhcs2.conf (make the changes to match your requirements, dont forget to change database name, username and password, these are what you need to change)

Code:

DEFAULT_ADMIN_ADDRES = your email
SERVER_HOSTNAME = your hostname
BASE_SERVER_IP = your ip
DATABASE_TYPE = mysql
DATABASE_HOST = localhost
DATABASE_NAME = vhcs2
DATABASE_PASSWORD = vhcs2
DATABASE_USER = vhcs

10). cd .. (back to the root of the vhcs2 directory)

11). make install (if command not found run ‘apt-get install make’)

12). cd /tmp/vhcs2*

13). cp -R * /

14). cd /var/www/vhcs2/engine/setup

15). ./vhcs2-setup (install script)

Code:

Wlecome to VHCS2 ’2.4 Spartacus’ Setup Dialog.

This program will set up VHCS2 system on your server.

Please press ‘Enter’ to continue.

Please enter system hostname (Enter for defaults) [debian]: yourhostname

Please enter system network address (Enter for defaults) [192.168.0.128]: your ipaddress

Please enter SQL server host (Enter for defaults) [localhost]:

Please enter system SQL database (Enter for defaults) [vhcs2]: vhcs2

Please enter system SQL user (Enter for defaults) [root]: vhcs2

Please enter system SQL password (Enter for defaults) [none]: vhcs2
Please repeat system SQL password: vhcs2

Please enter VHCS ftp SQL user (Enter for defaults) [vftp]: vftp

Please enter VHCS ftp SQL user password (Enter for defaults) [none]: vftp
Please repeat VHCS ftp SQL user password: vftp

Please enter administrator login name (Enter for defaults) [admin]:

Please enter administrator password: your password
Please repeat administrator password: your password

Please enter admininistrator email address: your email address

16). echo “Include /etc/apache2/sites-available/vhcs2.conf” >> /etc/apache2/httpd.conf (forgotten in install script)

17). sh /etc/init.d/apache2 restart

18). vi /etc/init.d/courier-authdaemon

Code: (change this line) ${libexecdir}/authlib/authdaemon stop
(to this) killall authdaemond.plain

19). sh /etc/init.d/courier-authdaemon restart

20). vi /etc/resolv.conf (and add to the top)

Code:

nameserver your ip (this removes errors about virtual hosts when starting apache)

21). (vhcs2 does not start automatically on reboot so we need to add it as a startup script )

First, you must get the startup runlevel by the command “runlevel” in the bash. You’ll get something like N 2, N means there was no previous runlevel, 2 is the actual runlevel.

For those who don’t have an N, you know what you’re doing, simply look in your inittab, then go in the folder /etc/rc2.d (if 2 is your startup runlevel)

Make an ls -al to see how it works, it isn’t hard to understand. At startup everthing from S01xx to S99xx is started in that order.

Code:

Example: ln -s /etc/init.d/vhcs2_daemon /etc/rc2.d/S98vhcs

22). (You may need to change permissions on the tools folder)

Code:

chmod -R 766 /var/www/vhcs2/gui/tools

23) Thats about it, vhcs should be installed and working now visit http://localhost/vhcs/

Debian, Linux ,

SSH dynamic port forwarding with SOCKS

October 26th, 2006

SSH has numerous uses beyond just logging into a remote system. In
particular, SSH allows you to forward ports from one machine to another,
tunnelling traffic through the secure SSH connection. This provides a
convenient means of accessing a service hosted behind a firewall, or one
blocked by an outgoing firewall.

However, forwarding an individual port still requires you to change
where your program connects, telling it to use a non-standard port on
|localhost| rather than the standard port on the remote machine, and it
requires a separate port forward for each machine you want to access.
Dynamic port forwarding via SOCKS
provides a more convenient alternative.

The examples in this article assume that you reside behind a restrictive
firewall which does not allow outgoing SMTP connections except to a
designated mail server. You want to connect to a different mail server,
|mail.example.net|, on port 25. You have an SSH account on a machine
|shell.example.org|, which does not reside within the restrictive
firewall and can thus access port 25 on |mail.example.net|.

With standard SSH port forwarding, you could enter the command:

ssh -L 2525:mail.example.net:25 shell.example.org

This will forward port 2525 on your machine to port 25 on
|mail.example.net|, by way of |shell.example.org|. You will then need to
configure your mailer to send mail to |localhost|, port 2525, and use
the authentication information for your mail account on
|mail.example.net|. For example, in Thunderbird^WIcedove, you could add
an additional outgoing mail server via Edit->Preferences, “Outgoing Mail
Server (SMTP)”, “Add…”, and either set it as the default or explicitly
set your mail account to use that server. You can then send your mail,
which will potentially (if you use secure authentication with
|mail.example.net|) give you a security warning about |localhost|
presenting a certificate for |mail.example.net|, and then prompt you for
your account password. After you have finished sending all the mails you
want to send, you can then change your outgoing mail server back to the
previous setting, and exit SSH.

To avoid all this hassle, SSH also supports dynamic port forwarding via
SOCKS. SOCKS defines a standard mechanism for a client to connect to a
server by way of a proxy. SSH can serve as the proxy, allowing you to
connect to |shell.example.org| and make connections from there to an
arbitrary server such as |mail.example.net|. Simply run:

ssh -D 1080 shell.example.org

to make the connection to |shell.example.org| and start a SOCKS proxy on
|localhost| port 1080.

In order to make use of the SOCKS proxy, you can either use applications
which can speak SOCKS natively, or you can use a socksifier program like
tsocks. tsocks provides a library used with |LD_PRELOAD|, which replaces
the standard sockets functions like |socket|, |connect|, and |sendto|
with functions that make use of a designated SOCKS proxy. The tsocks
script runs a program with this library loaded. The library will read
|/etc/tsocks.conf| to find out what SOCKS proxy to use. To configure
tsocks to work with an SSH SOCKS proxy on localhost, edit the default
|/etc/tsocks.conf|, change the server variable to 127.0.0.1, and comment
out the path example.

Now that you have tsocks configured, you can run the following whenever
you want to send mail via |mail.example.net|:

ssh -D 1080 shell.example.org
tsocks thunderbird

This will open the SSH-tunnelled SOCKS proxy to |shell.example.org| and
run thunderbird. You can then send mail normally, without changing the
outgoing server configuration, and without seeing any authentication
mismatch warnings.

Debian , , , , ,