📄 readme
字号:
This example shows how you might set up a (possibly large) internet facingFTP site.The emphasis will be on security and performance.We will see how by integrating vsftpd with xinetd, we get a powerfulcombination.Step 1) Set up your xinetd configuration file.An example xinetd configuration file "vsftpd.xinetd" is supplied.To install it:cp vsftpd.xinetd /etc/xinetd.d/vsftpdLet's look at the important content in this file and see what it does:disable = nosocket_type = streamwait = noThis says that the service is active, and it is using standard TCP sockets.user = rootserver = /usr/local/sbin/vsftpdThe server program /usr/local/sbin/vsftpd is used to handle incoming FTPrequests, and the program is started as root (vsftpd will of course quicklydrop as much privilege as possible). NOTE! Make sure that you have the vsftpdbinary installed in /usr/local/sbin (or change the file path in the xinetdfile).per_source = 5instances = 200For security, the maximum allowed connections from a single IP address is 5.The total maximum concurrent connections is 200.no_access = 192.168.1.3As an example of how to ban certain sites from connecting, 192.168.1.3 willbe denied access.banner_fail = /etc/vsftpd.busy_bannerThis is the file to display to users if the connection is refused for whateverreason (too many users, IP banned).Example of how to populate it:echo "421 Server busy, please try later." > /etc/vsftpd.busy_bannerlog_on_success += PID HOST DURATIONlog_on_failure += HOSTThis will log the IP address of all connection attempts - successful or not,along with the time. If an FTP server is launched for the connection, it'sprocess ID and usage duration will be logged too. If you are using RedHatlike me, this log information will appear in /var/log/secure.Step 2) Set up your vsftpd configuration file.An example file is supplied. Install it like this:cp vsftpd.conf /etcLet's example the contents of the file:# Access rightsanonymous_enable=YESlocal_enable=NOwrite_enable=NOanon_upload_enable=NOanon_mkdir_write_enable=NOanon_other_write_enable=NOThis makes sure the FTP server is in anonymous-only mode and that all writeand upload permissions are disabled. Note that most of these settings arethe same as the default values anyway - but where security is concerned, itis good to be clear.# Securityanon_world_readable_only=YESconnect_from_port_20=YEShide_ids=YESpasv_min_port=50000pasv_max_port=60000These settings, in order- Make sure only world-readable files and directories are served.- Originates FTP port connections from a secure port - so users on the FTPserver cannot try and fake file content.- Hide the FTP server user IDs and just display "ftp" in directory listings.This is also a performance boost.- Set a 50000-60000 port range for passive connections - may enable easierfirewall setup!# Featuresxferlog_enable=YESls_recurse_enable=NOascii_download_enable=NOasync_abor_enable=YESIn order,- Enables recording of transfer stats to /var/log/vsftpd.log- Disables "ls -R", to prevent it being used as a DoS attack. Note - siteswanting to be copied via the "mirror" program might need to enable this.- Disables downloading in ASCII mode, to prevent it being used as a DoSattack (ASCII downloads are CPU heavy).- Enables older FTP clients to cancel in-progress transfers.# Performanceone_process_model=YESidle_session_timeout=120data_connection_timeout=300accept_timeout=60connect_timeout=60anon_max_rate=50000In order,- Activates a faster "one process per connection" model. Note! To maintainsecurity, this feature is only available on systems with capabilities - e.g.Linux kernel 2.4.- Boots off idle users after 2 minutes.- Boots off idle downloads after 5 minutes.- Boots off hung passive connects after 1 minute.- Boots off hung active connects after 1 minute.- Limits a single client to ~50kbytes / sec download speed.Step 3) Restart xinetd.(on RedHat)/etc/rc.d/init.d/xinetd restartIf you run into problems, check:1) Your /etc/xinetd.d directory only has one FTP service.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -