Friday, November 7, 2008

Securing FTP server on Linux

Securing Linux FTP Server

On my previous blog I've shown on how to set up a FTP server. But the default settings that are in a default installation are

not that tight or secured yet. To mention few, one of the risk is that the default settings allow anonymous logins. Another

is that the user can navigate anywhere on the server.

On this blog I'll show you on how to make your FTP server more secured.

a.) Disallow anonymous logins

1. First is to disallow anonymous logins. To do this, open the vsftpd.conf using any text editor.

vi /etc/vsftpd/vsftpd.conf

2. Change

anonymous_enable=YES

TO
anonymous_enable=NO

3. Then restart vsftpd

if sudoer

/sbin/service vsftpd restart

if root

service vsftpd restart

b.) Never allow your ftp users to navigate on other folders except the one he owns

1. Comment this line on vsftpd.conf

from:
chroot_list_file=/etc/vsftpd.chroot_list
to:
#chroot_list_file=/etc/vsftpd.chroot_list

2. Set the following settings:

chroot_local_user=YES
chroot_list_enable=NO

3. Then finally restart the vsftpd for the changes to take effect

Here is a link of other settings you can play with:

http://vsftpd.beasts.org/vsftpd_conf.html

Hope you find this helpful. Cheers!!!! and God Bless!!!!!

INSTALLATION and SET UP of FTP Server on Linux

On this blog I'll be showing you the steps on how to set up FTP Server in Linux specifically for CentOS/RedHat distro.

For this tutorial I'll be using VSFTP for our FTP server although you can choose to install other FTP server like ProFTP and

others.

What is VSFTPD by the way. VSFTPD is a very secure and fast FTP server for Linux. This is the reason why I chose it to be the

one to discuss in here. So let's get started.

1. First download the VSFTPD package and install it. In my case I just did it via yum

yum install vsftpd

2. Now once the vsftpd has been successfully installed, we can now start the vsftpd service. No worries the default

configuration settings of vsftpd are good to make the FTP server up and running. (But we'll do few more tweaks later on)

3. To start vsftpd issue

if sudoer

/sbin/service vsftpd start

if root

service vsftpd start

4. But don't forget to allow the necessary ports for FTP service. The following are the ports needed to be openned for FTP

Port no. Details
21 ftp port
20 ftp-data port (use for active mode FTP connection)
50000 - 50004 ftp-data (for passive mode) Note: it can be any port higher than 1024

5. Now we're going to add an FTP user

First add new group where FTP members will be in

groupadd ftp-users


6. Make directory from where FTP users will upload download anything

mkdir /home/ftp-docs

7. If the directory has been created or if a directory is already existing just set the permission and owner privileges

chmod /home/ftp-docs
chown root:ftp-users /home/ftp-docs

8. Then we'll add the ftp user

useradd -g ftp-users -d /home/ftp-docs user1
passwd user1

9. Now we can login to the FTP server via the user1 credentials we made. (You may use any FTP software client such like

Filezilla, WinSCP, ProFTP and others)

CHeers!!! And God Bless!!!!

Tuesday, October 28, 2008

PHP: Always have Return on function

I had once experienced and almost freaked out locating a bug on my script, just to find out that it was just a no returning value or return on my function. The lesson I've learned here is to always use return inside functions even if it does not have to return something. This is a good programming practice to exercise. As much as possible use return();

Let me give some examples where the function will immediately return to the line from which it was called. Here are they:

(1) Use echo
function helloworld()
{
// scripts....
echo "hello World";
}


(2) Return boolean value (just if necessary)
function helloworld()
{
// scripts......

return true;
// or false
}


(3) if function will not return anything then just use return
function helloworld()
{
// scripts....
return;
}

Hope it helps everyone. Thanks and God Bless us all!!!!!

Wednesday, October 15, 2008

Installation of Bind and WMBind on Linux (A Draft)

INstallation of Bind (DNS Server) and WMBind

1.) Install first Bind
# yum install bind

2.) On CentOS 4.x there are default named.conf installed but not on CentOS 5.x

so for CentOS 5 either
a.) Copy the sample config from CentOS 4
b.) Copy the samples at /usr/share/bind/.... or locate name.conf.sample or sample folder

Firewall concern

Allow the ffg: ports

953 both udp and tcp
53 both udp and tcp


3.) Once the bind is installed, download and install Wmbind package
4.) make sure to read and follow what's on README on this package (espescially about the apache user)
a.) adding apache on group named
gpasswd -a apache named

5.) Enable mod rewrite on Apache by setting the following:

;From
AllowOverride None
;To
AllowOverride All

then restart apache

6.) Now see to it that named.conf and rndc.conf do have similar rndc-key values like as follows:

rndc.conf

key "rndc-key" {
algorithm hmac-md5;
secret "j2gS+6XTSeycPM8A+Fe5Tg==";
};

options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};

named.conf

key rndc-key {
algorithm hmac-md5;
secret "j2gS+6XTSeycPM8A+Fe5Tg==";
};

controls {
inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
inet 192.168.2.3 port 953 allow { 192.168.2.0; } keys { rndc-key; };
};

Restart named by
/sbin/service named restart

also make sure that the rndc.conf and rndckeys are readable by group named where apache is a member.

Wednesday, July 2, 2008

Mailap na Panahon ng Pag-ibig

marahil di pa panahon ng tagsibol
maaaring di pa ito ang tinakdang oras
maaring iba ang binubulong ng hangin
at wari'y may ibang laan para sa akin

panahon na siguro para kita'y limutin
ito na siguro ang tamang araw, ang tamang hudyat
upang ang puso ko'y tuluyan ko nang talikuran

ngunit sadya yatang mapagbiro ang tadhana
na tila di kayang manindigan ng aking dibdib
patuloy na sumisigaw ang damdamin
di ko mapigilan, di ko maipinid

mahirap man na tanggapin
ngunit sadyang ganito ang tinakda ng tadhana
upang ako'y magpatuloy sa lakad ng buhay
patuloy na maglakbay
at baka sakaling may makikitang liwanag

humayo ka aking mahal
humayo ka sa landas ng yong kaligayahan
tupdin mo ang sinisigaw ng yong puso
pakinggan mo ang binubulong ng yong dibdib

masaya ako na makita kitang masaya
lumilipad ng mataas at matayog
lumipad ka lng aking irog... lumipad ka...
patuloy kitang pagmamasdan sa kalangitan

kahit malayo ka na't halos di na makita
kahit malayo na at matakpan ng mga ulap
aasa at aasa akong masisilayan kang muli
kahit isang hibla ng pakpak ang saki'y bumalik

wag mo sana akong lilimutin
kahit man lng sana sa akin panaginip ay ako'y bisitahin
dalangin kong ikaw ay maging maligaya
maging maayos ka sayong patutunguhan

at kung sakali man na ika'y mahapo
kung sa pagkakataon ika'y maubusan ng lakas
at hindi mo na halos maikampay ang yong pakpak
bumalik ka lng at ako sa yo'y naghihintay..

Tuesday, July 1, 2008

Ang Maling Pagsinta

alam ko naman na may mahal ka ng iba
pero ewan ko ba, bakit pilit pa rin
ikaw ang hanap ng puso
kahit ilang beses yatang sabihan ko ang aking sarili
na tama na eh lalo naman nahuhulog ang loob ko sayo
pinipiplit ko na limutin ka at ibaon na lng sa limot ang lahat
pero sadya yatang tinarak ni kupido ang puso ko at di na makaiwas pa
lubha yata akong tinamaan sayo
ewan ko ba, matagal ko na rin di naranasan ang umibig
kahit alam kong iba na ang laman ng isip mo
ikaw pa rin ang sinisigaw at tinitibok ng aking puso
di ko hinahangad na suklian mo ang pag-ibig na alay ko
makita lng kita bawat araw na ika'y masaya
malaking kiliti na ang nagagawa nito sa puso ko
makita ko lng ang kislap ng yong mata
ang ganda ng yong ngiti
labis na ang kagalakan hatid sakin
mhal na nga yata kita
pero ako yatat mahina ang loob n sabihin ito sayo
pero bakit ko pa nga ba sasabihin kung ang atensyon at pandinig moy
nasa piling na ng iba
para yatang sumisigaw lng ang damdamin ko sa ilang
umaasa na may tutugon may makaririnig
di man tayo laan sa isat isa
malaking bahagi na ng buhay ko ay binigyan mo ng kulay
mahal na nga yata kita
di ka man mapasa akin
kahit man lng sana sa panaginip ay maging tayo
sapat na sakin ang malamang ikaw kasama ko
sapat na ikay namamasdan ko
mapuno man ako ng luha sa tuwing kasama mo sya
puso koy di magbabago
patuloy akong magmamahal sa yo

"aking anghel
ang maganda kong anghel
ang nagliliwanag kong anghel
ang walang katulad na si ____
mahal ko ang anghel na ito
kung pwede lng babaliin ko na ang pakpak ng aking anghel para lagi lng syang nsa tabi ko
pero magiging makasarili naman ako
.......lumipad ka aking anghel....
lumipad ka ng mataas at malayo.......
at su tuwing kailangan mo lng magpahinga...
bumalik ka lng,... bumalik ka lng sakin
dahil mahal kita .... mahal kita..."

So In Love

Spring, summer, fall & winter dreams.
Those are shinning like a star
They keep whispering,
"I'm so in love with you"

Spring, summer, fall & winter love
It is breezing to my heart and it keeps telling,
"I'll make you rainbow smile"

I remember when we were angels,
when we dreamed about us
All my days were happy
just like a snowy Christmas
I wish i'd have them always.

Every step I make writes a story
It is full of the heart
feeling love of my life and
missing friends of my time
I wish i'd have them all. ?

In Spring, summer, fall & winter days.
We've been sharing all the hearts
Love shines in my eyes
Love just won't fade away

If you'd all the way show me the world
Where I will stay in love
All my days will be white
Just like a snowy Christmas
You're just all I need.