ورود

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



yebordi
December 18th, 2012, 22:39
در این پست آموزشی با انجام چند مرحله ساده خواهید توانست SSH خود را امن تر کنید.

مرحله اول) ساخت یک کاربر و غیرفعال کردن لاگین مستقیم کاربر ریشه (root):


adduser admin && passwd admin مرحله دوم) تهیه پشتیبان از فایل پیکربندی ssh:


mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak مرحله سوم) ایجاد یک فایل پیکربندی جدید:


nano -w /etc/ssh/sshd_config مرحله چهارم) مقادیر زیر را در آن قرار بدهید:


## Change to other port is recommended, etc 7412
Port 7412 ## Sets listening address on server. default=0.0.0.0
#ListenAddress 192.168.0.1
## Enforcing SSH Protocol 2 only
Protocol 2
## Disable direct root login, with no you need to login with admin user, then “su -” you into root
PermitRootLogin no
##
UsePrivilegeSeparation yes
##
AllowTcpForwarding no
## Disables X11Forwarding
X11Forwarding no
## Checks users on their home directority and rhosts, that they arent world-writable
StrictModes yes
## The option IgnoreRhosts specifies whether rhosts or shosts files should not be used in authentication
IgnoreRhosts yes
##
HostbasedAuthentication no
## RhostsAuthentication specifies whether sshd can try to use rhosts based authentication.
RhostsRSAAuthentication no
## Adds a login banner that the user can see
Banner /etc/motd
## Enable / Disable sftp server
#Subsystem sftp /usr/libexec/openssh/sftp-server
## Add users that are allowed to log in
AllowUsers admin
دکمه Control + X و سپس Y بزنید تا ذخیره شود.
مرحله پنجم) مطمئن شوید مه تنظیمات در آن ذخیره شده است:


nano -w /etc/ssh/sshd_config مرحله ششم) یک بنر پس از لاگین به SSH ایجاد کنید: (نکته امنیتی ندارد،اختیاری است)


nano -w /etc/motd مرحله هفتم) میتوانید متن دلخواه خود را بنویسید:


Salam, KHosh Amadid مرحله هشتم) سرویس SSH خود را Restart دهید:


service sshd restart کار به اتمام رسید.
پی نوشت: یکی از تول تیپ های اکثر فایروال ها مانند CSF همین مورد است که شما با انجام ایت مراحل آن تول تیپ را OK تغییر خواهید داد.