Tuesday, August 23, 2011

HOWTO : Pure-ftpd and atftpd on Back|Track 5

You may use FTP and/or atftpd services on Back|Track 5. The following tutorial is showing you how to set it up on Back|Track 5.

PART I - PURE-FTPD

Step 1 :

apt-get install pure-ftpd

Step 2 :

cd /etc/pure-ftpd/conf/

echo ,21 > Bind

Step 3 (Optional) :

If you are behind NAT, you should set the following. The IP of your machine is suppose to be 192.168.1.1 and the passive ports are between 5000 and 5600.

echo 192.168.1.1 > ForcePassiveIP
echo 5000 5600 > PassivePortRange


Step 4 (Optional) :

The following settings are for security only. It is optional :

echo yes > ChrootEveryone
echo yes > ProhibitDotFilesRead
echo yes > ProhibitDotFilesWrite
echo yes > NoChmod
echo yes > BrokenClientsCompatibility


Step 5 :

The following settings are for preventing abuse :

echo 4 > MaxClientsPerIP
echo 20 > MaxClientsNumber


Step 6 :

To use PureDB authentication :

echo no > PAMAuthentication
echo no > UnixAuthentication
echo /etc/pure-ftpd/pureftpd.pdb > PureDB
ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure


Step 7 :

groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser


Step 8 :

Create a virtual user - samiux :

pure-pw useradd samiux -u ftpuser -d /ftphome/

pure-pw mkdb

*** "pure-pw mkdb" should be issued when a new user is added.

*** Make sure you have a directory /ftphome.

Step 9 :

Add TLS/SSL support and generate a private certificate :

cd /etc/pure-ftpd/conf/
echo 1 > TLS
openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

chmod 600 /etc/ssl/private/pure-ftpd.pem


Restart the pure-ftpd (or reboot your system) :

/etc/init.d/pure-ftpd restart

Remarks :

I encounter a problem when login to the pure-ftp as invalid username and password. I reboot the system and the problem gone.

PART II - ATFTPD

Step a :

cp /etc/default/atftpd /etc/default/atftpd-old

nano /etc/default/atftpd


Step b :

Change the content as is :

USE_INETD=false
OPTIONS="--tftpd-timeout 300 --retry-timeout 5 --maxthread 100 --verbose=5 --daemon --port 69 /tftpboot"


Step c :

/etc/init.d/atftpd restart

*** Make sure you have a directory /tftpboot.

That's all! See you.

Thursday, August 04, 2011

HOWTO : Anonymous in chat.freenode.net with XChat

IRC will display your IP address to other users that online. However, you can hide it by using IRC Proxy or Bouncer.

PART I - MY-BNC.NET

First of all, go to My-BNC.net to register an account. For example, the username is android and password is androidpass. Then, login with your username and password that registered before.

Step 1 :

Go the the menu on the browser, choose "Setting" to setup your account.

(a) Server setting

ssl = on
port = 7000
server = chat.freenode.net
password = <Do not require>
vhost = my-bnc.net


perform 1 = JOIN #<Your Channel>

(b) User setting

Realname = My-BNC User
Nickname = android
Password = androidpass

Profile = Private


(c) Services Authorisation & NickServ

Auth name = android
Auth password = androidpass
Auto-auth = on


PART II - XCHAT AND ZNC

Step 2 :

sudo apt-get update
sudo apt-get install znc xchat


Step 3 :

znc --makeconf

[ ** ] Building new config
[ ** ]
[ ** ] First lets start with some global settings...
[ ** ]
[ ?? ] What port would you like ZNC to listen on? (1 to 65535): 6697
[ ?? ] Would you like ZNC to listen using SSL? (yes/no) [no]: yes
[ ** ] Unable to locate pem file: [/home/samiux/.znc/znc.pem]
[ ?? ] Would you like to create a new pem file now? (yes/no) [yes]:
[ ?? ] hostname of your shell (including the '.com' portion): irc.my-bnc.net
[ ok ] Writing Pem file [/home/samiux/.znc/znc.pem]...
[ ?? ] Would you like ZNC to listen using ipv6? (yes/no) [no]:
[ ?? ] Listen Host (Blank for all ips):
[ ** ]
[ ** ] -- Global Modules --
[ ** ]
[ ?? ] Do you want to load any global modules? (yes/no): yes

[ ** ] And 10 other (uncommon) modules. You can enable those later.
[ ** ]
[ ?? ] Load global module <partyline>? (yes/no) [no]:
[ ?? ] Load global module <webadmin>? (yes/no) [no]: yes
[ ** ]
[ ** ] Now we need to setup a user...
[ ** ]
[ ?? ] Username (AlphaNumeric): android
[ ?? ] Enter Password: androidpass
[ ?? ] Confirm Password: androidpass
[ ?? ] Would you like this user to be an admin? (yes/no) [yes]:
[ ?? ] Nick [android]:
[ ?? ] Alt Nick [android_]:
[ ?? ] Ident [android]:
[ ?? ] Real Name [Got ZNC?]:
[ ?? ] VHost (optional):
[ ?? ] Number of lines to buffer per channel [50]: 500
[ ?? ] Would you like to keep buffers after replay? (yes/no) [no]:
[ ?? ] Default channel modes [+stn]:
[ ** ]
[ ** ] -- User Modules --
[ ** ]
[ ?? ] Do you want to automatically load any user modules for this user? (yes/no): yes

[ ** ] And 33 other (uncommon) modules. You can enable those later.
[ ** ]
[ ?? ] Load module <admin>? (yes/no) [no]: yes
[ ?? ] Load module <chansaver>? (yes/no) [no]: yes
[ ?? ] Load module <keepnick>? (yes/no) [no]: yes
[ ?? ] Load module <kickrejoin>? (yes/no) [no]:
[ ?? ] Load module <nickserv>? (yes/no) [no]:
[ ?? ] Load module <perform>? (yes/no) [no]:
[ ?? ] Load module <simple_away>? (yes/no) [no]: yes
[ ** ]
[ ** ] -- IRC Servers --
[ ** ]
[ ?? ] IRC server (host only): freenode
[ ?? ] [freenode] Port (1 to 65535) [6667]: 7000
[ ?? ] [freenode] Password (probably empty):
[ ?? ] Does this server use SSL? (probably no) (yes/no) [no]: yes
[ ** ]
[ ?? ] Would you like to add another server? (yes/no) [no]:
[ ** ]
[ ** ] -- Channels --
[ ** ]
[ ?? ] Would you like to add a channel for ZNC to automatically join? (yes/no) [yes]: yes
[ ?? ] Channel name: <Your Channel>
[ ?? ] Would you like to add another channel? (yes/no) [no]:
[ ** ]
[ ?? ] Would you like to setup another user? (yes/no) [no]:
[ ok ] Writing config [/home/samiux/.znc/configs/znc.conf]...
[ ** ]
[ ** ] To connect to this znc you need to connect to it as your irc server
[ ** ] using the port that you supplied. You have to supply your login info
[ ** ] as the irc server password like so... user:pass.
[ ** ]
[ ** ] Try something like this in your IRC client...
[ ** ] /server 6697 android:<pass>
[ ** ]
[ ?? ] Launch znc now? (yes/no) [yes]:
[ ok ] Opening Config [/home/samiux/.znc/configs/znc.conf]...
[ ok ] Binding to port [+6697] using ipv4...
[ ** ] Loading user [samiux]
[ ok ] Loading Module [admin]... [/usr/lib/znc/admin.so]
[ ok ] Loading Module [chansaver]... [/usr/lib/znc/chansaver.so]
[ ok ] Loading Module [keepnick]... [/usr/lib/znc/keepnick.so]
[ ok ] Loading Module [simple_away]... [/usr/lib/znc/simple_away.so]
[ ok ] Adding Server [freenode +7000]...
[ ok ] Loading Global Module [webadmin]... [/usr/lib/znc/webadmin.so]
[ ok ] Forking into the background... [pid: 9141]
[ ** ] ZNC 0.092+deb3 - http://znc.sourceforge.net


*** In case, you make a mistake and want to re-generate the config file. You should delete the "znc.conf" under "/home/<Your name>/.znc".

rm -R .znc

Step 4 :

Open XChat. Under the "Network List" window :

User Information

Nickname : android
Second choice : android_
Third choice : android__
User name : android
Real name : Android


Press "Add" button on the right. Then name it to "My-BNC BNC" and highlight it. Choose "Edit", on the top big box change to "irc.my-bnc.net/6697".

Only connect to chosen network : enable
Auto connect to this network : enable

Username : android

Use SSL for all servers in this networks : enable
Accept invalid certificate : enable

Server password : androidpass


Step 5 :

Choose "Connect" on the XChat window.

That's all! See you.