分享
 
 
 

vsftpd-1.1.3配制实例之一:INTERNET_SITE

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

This example shows how you might set up a (possibly large) internet facing

FTP site.

The emphasis will be on security and performance.

We will see how by integrating vsftpd with xinetd, we get a powerful

combination.

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/vsftpd

Let's look at the important content in this file and see what it does:

disable = no

socket_type = stream

wait = no

This says that the service is active, and it is using standard TCP sockets.

user = root

server = /usr/local/sbin/vsftpd

The server program /usr/local/sbin/vsftpd is used to handle incoming FTP

requests, and the program is started as root (vsftpd will of course quickly

drop as much privilege as possible). NOTE! Make sure that you have the vsftpd

binary installed in /usr/local/sbin (or change the file path in the xinetd

file).

per_source = 5

instances = 200

For security, the maximum allowed connections from a single IP address is 5.

The total maximum concurrent connections is 200.

no_access = 192.168.1.3

As an example of how to ban certain sites from connecting, 192.168.1.3 will

be denied access.

banner_fail = /etc/vsftpd.busy_banner

This is the file to display to users if the connection is refused for whatever

reason (too many users, IP banned).

Example of how to populate it:

echo "421 Server busy, please try later." /etc/vsftpd.busy_banner

log_on_success += PID HOST DURATION

log_on_failure += HOST

This 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's

process ID and usage duration will be logged too. If you are using RedHat

like 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 /etc

Let's example the contents of the file:

# Access rights

anonymous_enable=YES

local_enable=NO

write_enable=NO

anon_upload_enable=NO

anon_mkdir_write_enable=NO

anon_other_write_enable=NO

This makes sure the FTP server is in anonymous-only mode and that all write

and upload permissions are disabled. Note that most of these settings are

the same as the default values anyway - but where security is concerned, it

is good to be clear.

# Security

anon_world_readable_only=YES

connect_from_port_20=YES

hide_ids=YES

pasv_min_port=50000

pasv_max_port=60000

These 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 FTP

server 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 easier

firewall setup!

# Features

xferlog_enable=YES

ls_recurse_enable=NO

ascii_download_enable=NO

async_abor_enable=YES

In order,

- Enables recording of transfer stats to /var/log/vsftpd.log

- Disables "ls -R", to prevent it being used as a DoS attack. Note - sites

wanting to be copied via the "mirror" program might need to enable this.

- Disables downloading in ASCII mode, to prevent it being used as a DoS

attack (ASCII downloads are CPU heavy).

- Enables older FTP clients to cancel in-progress transfers.

# Performance

one_process_model=YES

idle_session_timeout=120

data_connection_timeout=300

accept_timeout=60

connect_timeout=60

anon_max_rate=50000

In order,

- Activates a faster "one process per connection" model. Note! To maintain

security, 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 restart

If you run into problems, check:

1) Your /etc/xinetd.d directory only has one FTP service.

vsftpd.conf

# Access rights

anonymous_enable=YES

local_enable=NO

write_enable=NO

anon_upload_enable=NO

anon_mkdir_write_enable=NO

anon_other_write_enable=NO

# Security

anon_world_readable_only=YES

connect_from_port_20=YES

hide_ids=YES

pasv_min_port=50000

pasv_max_port=60000

# Features

xferlog_enable=YES

ls_recurse_enable=NO

ascii_download_enable=NO

async_abor_enable=YES

# Performance

one_process_model=YES

idle_session_timeout=120

data_connection_timeout=300

accept_timeout=60

connect_timeout=60

anon_max_rate=50000

vsftpd.xinetd

# vsftpd is the secure FTP server.

service ftp

{

disable = no

socket_type = stream

wait = no

user = root

server = /usr/local/sbin/vsftpd

per_source = 5

instances = 200

no_access = 192.168.1.3

banner_fail = /etc/vsftpd.busy_banner

log_on_success += PID HOST DURATION

log_on_failure += HOST

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有