Linux machines are known to be pretty secure. آلات لينكس من المعروف أن جميلة آمن. Studies have shown that Linux has been designed in a secure manner. وقد أظهرت الدراسات أن لينكس وقد صمم بطريقة مأمونة. Yet, despite all the security features that come bundled with a Linux installation, you need to configure these features correctly to make them work for you. ومع ذلك ، وعلى الرغم من جميع الخصائص الأمنية التي يأتي المجمعة مع تركيب لينكس ، تحتاج إلى تكوين هذه السمات بشكل صحيح لجعلها العمل للكم. I’ll guide you through the process of setting up of one of the tools that help secure your machine - the firewall. سوف دليل لكم من خلال عملية إنشاء واحدة من الأدوات التي تساعد على تأمين جهازك -- جدار الحماية. We will use the iptables firewall for this exercise. سوف نستخدم الجدار الناري iptables لهذه العملية. I am assuming that you are using a server running Red Hat Enterprise Linux 4 or similar. وأنا على افتراض أن كنت تستخدم خدمة إدارة المشاريع وريد هات لينوكس 4 أو ما شابه ذلك. However, most of the steps should work fine on other Linux distributions as well. بيد أن معظم الخطوات التي ينبغي العمل غرامة على توزيعات لينكس الأخرى كذلك. In this article we will setup a firewall on a Linux server running the Apache Web Server, FTP, and SSH. في هذه المادة فإننا سوف الإعداد جدار ناري على لينكس تشغيل خادم أباتشي خادم الويب ، وبروتوكول نقل الملفات ، وSSH.
Let us first see what ports these applications use and which of them need to have a port open on the firewall. دعونا نرى أولا ما الموانئ استخدام هذه التطبيقات والتي منها الحاجة إلى وجود ميناء مفتوح على جدار الحماية.
The Apache web server runs on port 80 by default. أباتشي خادم الويب وتدير 80 ميناء على افتراضيا. Apache is going to server all our web content on this port, therefore we need to keep this port open on the firewall. اباتشي هو الذهاب إلى كل خادم ويب على محتوى هذا الميناء ، ولذلك نحن بحاجة إلى إبقاء هذه الموانئ المفتوحة على جدار الحماية. The SSH service runs on port 22. وقد SSH يدير الخدمة على المنفذ 22. We need to be able to remotely connect to our server to work, so we keep it open. ونحن بحاجة إلى أن تكون قادرة على ربط عن بعد لجهاز الشبكة إلى العمل ، حتى أننا ابقائه مفتوحا. FTP runs on port 21 and it too needs the port to be open to communication. بروتوكول نقل الملفات وتدير 21 ميناء على أنها أيضا واحتياجات الميناء لتكون مفتوحة أمام الاتصالات.
Next, make sure you have iptables installed. المقبل ، التأكد من انك iptables تركيبها. Run this command as the root user: تديرها هذه القيادة بوصفها المستخدم الجذر :
# rpm -qa | grep iptables # دورة في الدقيقة بين سؤال وجواب | grep iptables
If you have iptables installed the system should give you the version of iptables you have installed. وإذا كان لديك iptables تركيب هذا النظام يجب أن يقدم نسخة من iptables قمت بتثبيته. In case you don’t you can try something like the following to get it and start it: في حالة أنك لا يمكنك أن تجرب شيئا مثل التالية إلى الحصول عليها وتبدأ بما يلي :
# yum install iptables # yum تركيب iptables
# /etc/init.d/iptables start # / الخ / init.d / iptables بداية
To check what kind of configuration iptables is currently running with: لفحص أي نوع من التشكيل iptables هو حاليا مع :
# iptables –list # iptables - قائمة
Chain INPUT (policy ACCEPT) سلسلة الإدخال (السياسة اعقد)
target prot opt source destination الهدف prot اختيار مصدر المقصد
Chain FORWARD (policy ACCEPT) سلسلة امام (السياسة اعقد)
target prot opt source destination الهدف prot اختيار مصدر المقصد
Chain OUTPUT (policy ACCEPT) سلسلة الناتج (السياسة اعقد)
target prot opt source destination الهدف prot اختيار مصدر المقصد
This command will list out all the firewall rules that have been set currently. هذه القيادة سوف القائمة خارج جدار الحماية لجميع القواعد التي تم تحديدها حاليا. I will proceed with the assumption that you do not have any firewall rules in your iptables configuration. سأشرع مع افتراض أن لم يكن لديك أي الجدار الناري iptables قواعد في التكوين الخاص بك. Let’s now configure the firewall to allow open communication on the ports 80 for your web server, 22 for SSH, and port 21 for FTP. دعنا الآن تكوين جدار الحماية للسماح الاتصال المفتوح على 80 موانئ لمركز خدمة الويب الخاص بك ، و 22 لSSH ، والميناء 21 لبروتوكول نقل الملفات. We’ll also make sure that we block communication to any port other than specified. سنقوم أيضا أن نتأكد من أننا الاتصالات لمنع أي ميناء آخر غير محدد.
Here’sa firewall script configuration script. Here'sa البرنامج النصي التكوين الجدار الناري في البرنامج النصي. Create a new file and call it iptable-firewall.sh . إنشاء ملف جديد ويطلق عليه iptable - firewall.sh. Copy the following text into it: نسخة إلى النص التالي :
#!/bin/sh #! / بن / ش
ANY=”0/0″ أي = "0 / 0"
OPEN_PORTS=”21 22 80″ OPEN_PORTS = "21 22 80"iptables -P INPUT ACCEPT iptables - ف مستلزمات اعقد
iptables -P FORWARD ACCEPT iptables - ف اعقد إلى الأمام
iptables -P OUTPUT ACCEPT iptables - ف الناتج اعقد# Flush (-F) all specific rules # فلوش (واو) جميع قواعد محددة
iptables -F INPUT iptables - واو مستلزمات
iptables -F FORWARD iptables - واو الأمام
iptables -F OUTPUT iptables - واو الناتجfor port in $OPEN_PORTS للدولار في ميناء OPEN_PORTS
do يفعل
iptables -A INPUT -i eth0 -p tcp -s $ANY -d $ANY –destination-port $port –syn -j ACCEPT iptables - A المدخلات ط ع برنامج التعاون الفني بين eth0 - دولار سنغافوري أي بين د دولار أي بين المقصد الميناء دولار من الميناء syn - اعقد ي
iptables -A INPUT -i eth1 -p tcp -s $ANY -d $ANY –destination-port $port –syn -j ACCEPT iptables - A المدخلات ط ع برنامج التعاون الفني بين eth1 - دولار سنغافوري أي بين د دولار أي بين المقصد الميناء دولار من الميناء syn - اعقد ي
done فعلiptables -A INPUT -i eth1 -p icmp -s $ANY -d $ANY -j ACCEPT iptables - A المدخلات ط eth1 - ع اللجنة الدولية المعنية بالأشخاص المفقودين - دولار سنغافوري أي بين د دولار أي بين اعقد ي
#Allow any related/established connections # السماح لأية المتصلة / أقام صلات
iptables -A INPUT -i eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT iptables - A المدخلات eth0 - ط م للدولة على إقامة دولة ، ذات الصلة بين اعقد ي
iptables -A INPUT -i eth1 -m state –state ESTABLISHED,RELATED -j ACCEPT iptables - A المدخلات eth1 - ط م للدولة على إقامة دولة ، ذات الصلة بين اعقد ي#Kill everything else # اقتل كل شيء آخر
iptables -A INPUT -i eth0 -j DROP iptables - A المدخلات ط eth0 - إسقاط ي
iptables -A INPUT -i eth1 -j DROP iptables - A المدخلات ط eth1 - إسقاط ي#write for boot # الكتابة عن الحذاء
iptables-save > /etc/sysconfig/iptables iptables - إنقاذ> / الخ / sysconfig / iptables
Now save the above file, grant it executable permissions and then run it: الآن انقاذ الملف أعلاه ، أنه منح أذونات للتنفيذ وثم تشغيله :
# chmod +x iptable-firewall.sh # chmod + س iptable - firewall.sh
# ./iptable-firewall.sh #. / iptable - firewall.sh
Now check your firewall rules: الآن التحقق من اتصالك جدار النظام ، بما يلي :
# iptables –list # iptables - قائمة
All your firewall rules should now be set. جميع قواعد الجدار الناري الخاص بك الآن يجب أن تكون مجموعة. Your server is now secure. الخادم الخاص بك هو الآن آمنة. To make any modification or additions to this set of rules, edit the line where the OPEN_PORTS parameter is defined and add or remove ports form the list. لجعل أي تعديل أو إضافات إلى هذه المجموعة من القواعد ، وتحرير الخط حيث OPEN_PORTS بارامتر يعرف وإضافة أو إزالة الموانئ شكل قائمة. Remember to run the script again after making any changes to it. تذكر لتشغيل البرنامج النصي مرة أخرى بعد إجراء أي تغييرات عليه.
If all of this command line stuff has you a bit leery, see the tutorial وإذا كان كل من هذه الاشياء قد سطر الأوامر لكم قليلا خشية ، انظر الدروس How to setup Firestarter - an easy to use Linux Firewall كيفية الإعداد Firestarter -- سهلة لاستخدام جدار حماية لينوكس - which has an easy to use graphical interface. -- الذي سهلة لاستخدام واجهة رسومية.

![[سبورل]](/images/sharing/stumbleupon.png)




















{ 0 comments… (0 التعليقات... add one now إضافة واحد الآن } )
Leave a Comment ترك التعليق