ورود

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : آموزش بستن پورت روی سنت اوس با csf



mobinhost.david@gmail.com
September 19th, 2012, 19:40
سلام از اونجایی که خیلی ها برای بستن پورت ها و جلوگیری از به وجود امدن اسپم و... روی سرور لینوکس مشکل دارن
و خیلی ها با نصب اسکویید روی سرورشون یوزرهای زیادی رو به سرور متصل می کنن برای جلوگیری از به وجود اومدن مشکل می تونن سرورشون رو مجهز به 1 فایروال قدرتمند و مجانی بکنن
من خودم در گذشته خیلی مشکل برام به وجود اومده بود که ترجیح دادم به کسایی که مثل خودم 1 روز مشکل داشتن کمک کنم

دستورات نصب فایروال csf

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

دستورات زیادی در نت وجود داره ولی خیل هاش به درد نم خوره همجنین فایروال های دیگه ای هم هست که من چون این روی سنت اوس و برای حل مشکل من عالی جواب داده رو پیشنهاد می کنم
اگه کسی قبل یا بعد نصب مشکل داشت من در خدمتم

arash1372
September 25th, 2012, 20:48
ممنون

baghebahar
September 26th, 2012, 14:17
سلام از اونجایی که خیلی ها برای بستن پورت ها و جلوگیری از به وجود امدن اسپم و... روی سرور لینوکس مشکل دارن
و خیلی ها با نصب اسکویید روی سرورشون یوزرهای زیادی رو به سرور متصل می کنن برای جلوگیری از به وجود اومدن مشکل می تونن سرورشون رو مجهز به 1 فایروال قدرتمند و مجانی بکنن
من خودم در گذشته خیلی مشکل برام به وجود اومده بود که ترجیح دادم به کسایی که مثل خودم 1 روز مشکل داشتن کمک کنم

دستورات نصب فایروال csf

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

دستورات زیادی در نت وجود داره ولی خیل هاش به درد نم خوره همجنین فایروال های دیگه ای هم هست که من چون این روی سنت اوس و برای حل مشکل من عالی جواب داده رو پیشنهاد می کنم
اگه کسی قبل یا بعد نصب مشکل داشت من در خدمتم
واسه اینکه خوب کار کنه نیاز به کانفیگ داره...

baghebahar
September 26th, 2012, 14:21
دستورات تکمیلی



wget <<path_of_tgz_file>>

2. Untar it

tar -zxf csf.tar.gz

3. Run the Install script.

sh /csf/install.sh

Thats it! wait until the script ends!

4. Remove APF or IPTables Firewall

If you have any existing IP tables firewall remove them using uninstall scripts located at /etc/csf. In this case i was running APF firewall and BFD in my server so i have to remove it.

sh /etc/csf/remove_apf_bfd.sh

5. Start the Firewall in Testing Mode

Start the firewall with the following command.

csf -s
// start the firewall
csf -r
// restart the firewall
csf -f
// flush the rules or stop the firewall.

If you are running a VPS plan, then you might get the error like this

“iptables LKM ip_tables missing so this firewall cannot function unless you enable MONOLITHIC_KERNEL in /etc/csf/csf.conf
Error: aborted, at line 156″

To fix:
Open the /etc/csf/csf.conf and look for a line MONOLITHIC_KERNEL = “0″ and change to MONOLITHIC_KERNEL = “1″

Thats all! Now restart the firewall.

7. Specify which ports you want to allow.

It is very important to check the firewall on which ports to open and close all remaining port numbers. Open the /etc/csf/csf.conf and edit the following line with port numbers

# Allow incoming TCP ports
TCP_IN = “20,21,22,25,53,80,110,143,443,465,953,993,995,2 077,2078,2082,2083,2087″
# Allow outgoing TCP ports
TCP_OUT = “20,21,22,25,37,43,53,80,110,113,443,587,873,953 ,2087,2089,2703″
# Allow incoming UDP ports
UDP_IN = “20,21,53,953″
# Allow outgoing UDP ports
# To allow outgoing traceroute add 33434:33523 to this list
UDP_OUT = “20,21,53,113,123,873,953,6277″

21 => FTP
22 => SSH
23 => Telnet
25 => SMTP Mail Transfer
43 => WHOIS service
53 => name server (DNS)
80 => HTTP (Web server)
110 => POP protocol (for email)
443 => HTTP Secure (SSL for https:// )
995 => POP over SSL/TLS
9999 => Urchin
3306 = > MysQL Server
2082 => CPANEL Default
2083 => CPANEL – Secure/SSL
2086 => CPANEL WHM
2087 => CPANEL WHM – Secure/SSL
2095 => cpanel webmail
2096 => cpanel webmail – secure/SSL
Plesk Control Panel => 8443
DirectAdmin Control Panel => 2222
Webmin Control Panel => 10000



6. Disable the Testing Mode and Start the Firewall

Remember by default the firewall is running in testing mode. You might want to disable the firewall running in testing mode.

nano /etc/csf/csf.conf

//Look for the first line and set testing mode to “0″
TESTING = “0″

//Now restart the firewall!
csf -r
In Cpanel

If you have successfully installed the CSF firewall, then you will find this CSF Security & Firewall option within cpanel WHM at the bottom of the menu. Just click on the link and you can also edit the firewall settings inside Cpanel, which is very easy to do.
Config Files

/etc/csf/csf.conf CSF Firewall configuration file
/etc/csf/csf.allow => Config file to allow IPs
/etc/csf/csf.deny => Config file to deny IPs
/etc/csf/ => Alert files with TXT extension are stored within this directory
Final Steps

1. Check the status of firewall inside cpanel
2. Harden the firewall security by performing the system security check. To do this go to Cpanel WHM > CSF Firewall & Security > Check System Security. There it will list WARNINGS based on your server.

mobinhost.david@gmail.com
October 15th, 2012, 00:28
ممنون
خواهش می کنم
اگه در نصب و کانفیگش مشکلی داشتین من در خدمتم

mobinhost.david@gmail.com
October 15th, 2012, 00:30
دستورات تکمیلی

برای کسایی که با اکانتینگ ها کار می کنن .یک سری پورت مورد نیاز رو باید باز گداشت . مثلا
smtp
به دردشون نمی خوره و دردسر زا هست

mobinhost.david@gmail.com
October 28th, 2012, 22:53
nano /etc/csf/csf.conf
ba zadan in dastor be dakhele tanzimate csf miird
baed onja
testing ro az 1 be 0 taghyir midin

dar qesmte payin
barye porthaye udp va tcp
hast ke baste be kari ke mikoonid bayad porthaye morede niyazeton ro baz bokonid

barye accounting behtre 25 baste bashe


nano /etc/csf/csf.conf

dakkeh20
August 12th, 2014, 23:48
دوستان من الان این تاپیک و دیدم و تو سرچ پیدا نکردمش .

من تاپیک مشابهی باز کردم که میخواستم پورت ها رو از طریق خود iptables ببندم . دوستان هم لطف کردن و راهنمایی کردن .

الان که بستن پورت ها رو با csf دیدم انگاری کارو راحت تر میکنه .

فقط یه مشکلی دارم .

اونم اینه که وقتی ما یک سری پورت ها رو از طریق این تنظیمات :



# Allow incoming TCP ports
TCP_IN = “20,21,22,25,53,80,110,143,443,465,953,993,995,2 077,2078,2082,2083,2087″
# Allow outgoing TCP ports
TCP_OUT = “20,21,22,25,37,43,53,80,110,113,443,587,873,953 ,2087,2089,2703″
# Allow incoming UDP ports
UDP_IN = “20,21,53,953″
# Allow outgoing UDP ports
# To allow outgoing traceroute add 33434:33523 to this list
UDP_OUT = “20,21,53,113,123,873,953,6277″


باز میکنیم .
آیا برای بستن بقیه پورت ها باید چیز دیگه ای اضافه بشه یا اینکه خودش اوتوماتیک بقیه پورت ها رو میبنده ؟

- - - Updated - - -

خودم از طریق این سایت پورت های دیگر رو چک کرد همشون بسته بود :113:

http://www.t1shopper.com/tools/port-scan/

در کل از استارتر و بقیه دوستان ممنون