Saturday, March 19, 2011

How To Configure ISA Proxy/Auth Setting For Yum

I was running CentOS in my LAN for my personal use and there are MS ISA servers for proxying and each user has to use his/her user name & password for Internet. So when I used my credentials in my web browser I had no problem but when I was going to do yum no success. After some googling I found this solution.

What is’NTLM Authorization Proxy Server’?

‘NTLM Authorization Proxy Server’ (APS) is a proxy software that allows you to authenticate via an MS Proxy Server using the proprietary NTLM protocol. Since version 0.9.5 APS has an ability to behave as a standalone proxy server and authenticate http clients at web servers using NTLM method. It can change arbitrary values in your client’s request header so that those requests will look like they were created by MS IE. It is written in www.python.org/” target=”_blank”>Python.

Main features:

  • supports NTLM authentication via parent proxy server (Error 407 Proxy Authentication Required);
  • supports NTLM authentication at web servers (Error 401 Access Denied/Unauthorized);
  • supports translation of NTLM scheme to standard “Basic” authentication scheme;
  • supports the HTTPS ‘CONNECT’ method for transparent tunnelling through parent proxy server;
  • has ability to change arbitrary values in client’s request headers;
  • supports unlimited number of client connections;
  • supports connections from external hosts;
  • supports HTTP 1.1 persistent connections;
  • stores user’s credentials in config file or requests password from a console during the start time;
  • supports intelligent failure detection and failover between multiple upstream proxies;

Download the ntlm rpm via your browser; because in my case Internet is working in firefox but not for yum you can also download on other pc and after that scp is the option for you.

ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/n/project/nt/ntlmaps/OldFiles/ntlmaps-0.9.9.6-1.i386.rpm

Just do copy&paste in your browser.

Open a terminal:

rpm -Uvh ntlmaps-0.9.9.6-1.i386.rpm

After that just edit server.cfg; you can find all related files by typing:

rpm -ql ntlmaps

In my case:

vi /etc/ntlmaps/server.cfg

and change the following parameters as per your requirements:
PARENT_PROXY:That_will_b_your_MS-Prosy_IP
PARENT_PROXY_PORT:That_will_b_your_MS-Proxy_Server_Port
NT_DOMAIN: That_will_b_Your_windows_Domain_name
USER:That_will_b_your_proxy-user
PASSWORD: That_will_b_your_Proxy-user_Password

Save & exit.

Now run ntlmaps deamon:

/opt/ntlmaps/main.py

You will see the following output:

NTLM authorization Proxy Server v0.9.9.6
Copyright (C) 2001-2005 by Dmitry Rozmanov, Darryl Dixon, and others.
Now listening at Testbed.abc.com on port 5865

If you see this – congratulations, you are done – otherwise troubleshoot it.

Now you have to export the proxy for yum:

http_proxy= http://127.0.0.1:5865

export http_proxy

Done!

add NTFS partitons to your Centos or RHEL

In this tutorial we will show you how to add NTFS partitions to your centos or RHEL

Install the rpmforge-release package as directed here and try the yum command again

The commands to type in order:

rpm -Uvh  http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install fuse fuse-ntfs-3g dkms dkms-fuse

Here is am example /etc/fstab entry for both you and madi_beni that should work at boot time;

 [root@localhost pirat9]# /sbin/fdisk  -l

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 6375 51207156 7 HPFS/NTFS
/dev/sda2 6376 19124 102406342+ 7 HPFS/NTFS
/dev/sda3 * 19125 19137 104422+ 83 Linux
/dev/sda4 19138 24321 41640480 5 Extended
/dev/sda5 19138 24321 41640448+ 8e Linux LVM
[root@localhost pirat9]# mkdir -p /mnt/windows_c

[root@localhost pirat9]# mkdir -p /mnt/windows_D

[root@localhost pirat9]# mount -t ntfs-3g /dev/sda1 /mnt/windows_c

[root@localhost pirat9]# mount -t ntfs-3g /dev/sda2 /mnt/windows_D

[root@localhost pirat9]# ls /mnt/windows_D
Acer-D Drivers Music RECYCLER Solaris System Volume Information
cod4- Maroua omnibot Softwars SOL-pack torrent

its working .

now you have to add these lines to /etc/fstab to make this mount permanently

/dev/sda1 /mnt/windows_c ntfs-3g auto,users,uid=0,gid=500,umask=000,rw 0 0

/dev/sda2 /mnt/windows_D ntfs-3g auto,users,uid=0,gid=500,umask=000,rw 0 0

please for any other question contact us in the forum of unixmen.net

Linux > Command line BitTorrent client

BitTorrent is the name of a peer-to-peer (P2P) file distribution protocol, and of a free software implementation of that protocol.

The BitTorrent client is a computer program developed by BitTorrent, Inc. used to download and upload files via the BitTorrent protocol. You can download python based command line BitTorrent client download for Linux/BSD/Mac OS X/UNIX link oses. This is quite useful, if you would like to download file remotely over SSH session. bittorrent.com offers bittorrent client in .deb (Debian Linux) or rpm (RedHat/Fedora Core/CentOS Linux) file formats.

To use the bittorrent in command line one you need to use command bittorrent-console or bittorrent-curses (see below for examples).
Step # 1: Find Python version

Make sure you download file according to your python version. Type following command to find out python version:
$ python -V
Output:

Python 2.4.2

Step # 2: Download bittorrent client

Use wget to download bittorrent client
Download bittorrent client for Debian Linux:

$ wget http://download.bittorrent.com/dl/bittorrent_5.0.3_python2.4.deb
Download bittorrent clientFor Red Hat / Fedora Core / Cent OS Linux

$ wget http://download.bittorrent.com/dl/BitTorrent-5.0.3-1-Python2.4.noarch.rpm
Step # 3: Linux Install BitTorrent client

First login as a root user (use su or sudo command). If you are using Debian Linux, use dpkg command install bittorrent client
# dpkg -i bittorrent_5.0.3_python2.4.deb
If you are using Red Hat / Fedora Core /Cent OS Linux, use rpm command install bittorrent client:
# rpm -ivh BitTorrent-5.0.3-1-Python2.4.noarch.rpm
Step # 4: Start using or downloading files

Use bittorrent client as follows:
$ /usr/bin/bittorrent-curses ‘http://www.some.org/DesktopBSD.iso.torrent’
OR
$ bittorrent-curses ‘http://www.some.org/DesktopBSD.iso.torrent’
OR
$ /usr/bin/bittorrent-curses ‘/path/to/file.torrent’
You can try out pure console based client bittorrent-console instead of curses based client:
$ bittorrent-console ‘/path/to/file.torrent’
$ /usr/bin/bittorrent-console ‘http://www.some.org/DesktopBSD.iso.torrent’
Tips about using and Troubleshooting BitTorrent client

(A) If you get [Errno 2] No such file or directory, you need to use wget or lynx command to download .torrent file to local hard drive first. For example
$ bittorrent-curses ‘http://www.mininova.org/get/some_file[222].torrent’
First download download .torrent file using any one of the following method:
$ lynx ‘http://www.mininova.org/get/some_file[222].torrent’
When prompted save .torrent file to a hard-disk. Another option is use wget to download .torrent file:
$ wget ‘http://www.mininova.org/get/some_file[222].torrent’
Now start the downloading as follows:
$ bittorrent-curses ‘some_file[222].torrent’

(B) If you get error ‘This seems to be an old Python version which does not support detecting the filesystem encoding. Assuming ‘ascii’, then upgrade your python version to 2.4.xx:

Debian user upgrade python version using apt-get command:
# apt-get update
# apt-get install python2.4

Red Hat Linux user try out:
# up2date python2.4
Fedora Linux user try out:
# yum install python2.4

Remember if you have both versions (python v2.3 and v2.4) installed, you need to run bittorent client as follows:
$ python2.4 /usr/bin/bittorrent-curses ‘/path/to/file.torrent’
Command line BitTorrent client should work with other UNIX like operating systems such as FreeBSD/OpenBSD/Solaris etc (as long as you have Python it should work).

The current client enables a range of features including multiple parallel downloads. It also intermediates peering between itself, source file servers (read as trackers) and other clients, thereby yielding great distribution efficiencies. The client also enables users to create and share torrent files. See help files for more information.
See also:

* Linux Iptables rules to open Bittorrent tcp ports 6881 to 6889

Install ntop for Centos|fedora|RHEL

Ntop is a network traffic probe that shows the network usage, similar to what the popular top Unix command does.but the positive side is that you can use a web browser to manage and navigate through ntop traffic information to better understand network status. Ntop is based on libpcap and it has been written in a portable way in order to virtually run on every Unix platform.

1- Install the required dependencies to install Ntop:

yum install   gcc gcc-c++ make libpcap libpcap-devel gdbm-devel libgd-devel libpng-devel libtool 
libtool-libs rrdtool rrdtool-devel

2- Now download and extract the latest version of ntop tool

wget http://superb-west.dl.sourceforge.net/sourceforge/ntop/ntop-3.3.9.tar.gz 

Extract

tar -xvf ntop-3.3.9.tar.gz 

then go to the extracted folder

 cd ntop-3.3.9

3- Now run the installation of Ntop :

./autogen.sh

4- Now use make

make

5-install

make install

6-create ntop user :

# useradd -M -s /sbin/nologin -r ntop

7-setup permioon for the ntop directories :

# chown ntop:root /usr/local/var/ntop/

 # chown ntop:ntop /usr/local/share/ntop/

8- setup ntop Admojn password

#ntop -A

9-start the ntop deamon :

# /usr/local/bin/ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check   --use-syslog=daemon

10- now open your browser with port 3000

http://localhost:3000/ or  http://ip:3000

Install webmin on Redhat, Fedora, CentOS

ebmin is a web-based interface for system administration for Unix/. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotelyyou can also create backups for the system and restore.

Webmin is very usefull also for people that they run their own home server, and are not very good using the command line, webmin will help you administer your server with a graphic interface.

To install webmin on redhat,fedora, and CentOS :

First check for some dependencies if are installed

yum install perl-Net-SSLeay 

Now download latest version of webmin 1.480 :

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.480-1.noarch.rpm

Now install :

rpm -i webmin-1.480-1.noarch.rpm

Now to run webmin localy type :

https://localhost:10000

To login to another system remotely :

https://server-adress:10000

Note that many operating systems block by default port 10000, so if you can not login to webmin in your remote server ,follow step bellow to resolve it :

Login to your server via ssh ,and manually edit the firewall configuration file. On Redhat and derived systems, this is /etc/sysconfig/iptables

and add this line :

-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT

It should be added in the file just after similar lines which grant access to ports 80, 22 and so on.

Now restart your iptables.

/etc/init.d/iptables restart

Links :