8/1/12

GIỚI HẠN TRUY CẬP FTP


1.1.1.     GIỚI HẠN TRUY CẬP FTP

Yêu cầu bài tập

-   Cấu hình chỉ cho phép người dùng cục bộ truy cập vào ftp server ngoại trừ người dùng hv2
-   Cấm host 192.168.1.200 truy cập vào ftp server

Hướng dẫn cấu hình

a)     Tạo người dùng cục bộ
b)     Cấu hình ftp
1)     Giới hạn người dùng anonymous
2)     Giới hạn host truy cập ftp server
c)     Khởi tạo ftp server
d)     Kiểm tra hoạt động trên linux
1)     Kiểm tra tiến trình vsftps
2)     Kiểm tra tên miềnftp.serverlinux.vn
e)     Kiểm tra hoạt động trên windows
1)     Login bằng người dùng anonymous
2)     Login bằng người dùng cục bộ
3)     Login từ host 192.168.1.200

Các bước thực hiện cấu hình

a)   Tạo người dùng cục bộ
[root@localhost ~]# useradd hv1
useradd: user hv1 exists

[root@localhost ~]# passwd hv1
Changing password for user hv1.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@localhost ~]# useradd hv2
useradd: user hv2 exists
[root@localhost ~]# passwd hv2
Changing password for user hv2.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@localhost ~]# su - hv2
b)  Cấu hình /etc/vsftpd/vdftpd.conf
-   Cấu hình cấm người dùng anonymous truy cập ftp server
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
anon_root=/var/ftp
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
-   Cấm user cục bộ hv1 truy cập ftp serrver trong tập tin /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
hv1
-   Và trong tập tin /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
Root
Bin
Daemon
Adm
Lp
Sync
Shutdown
Halt
Mail
News
Uucp
Operator
Games
Nobody
hv1
-   Cấm host 192.168.1.200 truy cập ftp server trong tập tin /etc/hosts.deny
#
# hosts.deny      This file describes the names of the hosts which are
#           *not* allowed to use the local INET services, as decided
#           by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.In particular
# you should know that NFS uses portmap!
vsftpd:192.168.1.200
c)   Kiểm tra sự hoạt động của ftp
[root@localhost ~]# host
[root@localhost ~]# host ftp.serverlinux.vn
ftp.serverlinux.vn is an alias for dns1.serverlinux.vn.
dns1.serverlinux.vn has address 192.168.1.3
 [root@localhost ~]# pgrep vsftpd
4821
d)  Cấu hình iptables để cho phép ftp được phép truy cập qua firewall
-   Bằng tiện ích #setup
root@localhost ~]# /etc/init.d/iptables restart
Flushing firewall rules:                              [OK]
Setting chains to policy ACCEPT: nat mangle filter    [OK]
Unloading iptables modules:                           [OK]
Applying iptables firewall rules:                     [OK]
Loading additional iptables modules: p_conntrack_netbios_n[OK]ntrack_ftp

Bài đăng phổ biến