操作系统  办公  实用知识  设计  开发  WEB开发  移动开发  数据库  软件工程  网管  安全  管理  信息化  答疑  渠道 

在LINUX系统上建立FTP加密传输

2006-9-21 网友评论 0 条 点击进入论坛

在众多的FTP服务器中PROFTPD由于它的配置灵活,安装简便。近年来一直受到人们的喜爱。通常情况下FTP包括认证过程,传输是明文传输的,在传输一些敏感数据时总是不能让人放心。今天我在网上找了一些零散的资料结合自己的实作写了个帖子贡献给大家。

下载最新的软件版本:

# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0rc3.tar.gz

首先创建ROFTPD运行的用户和组:

# groupadd nogroup
# useradd –g nogroup –d /dev/null –s /sbin/nologin nobody

首先创建上传下载的用户和组:

# groupadd ftp
# useradd –g ftp –d /home/down –s /sbin/nologin down
# useradd –g ftp –d /home/upload –s /sbin/nologin upload
用户密码设置略

编译安装PROFRPD:

# tar –zxvf proftpd-1.3.0rc3.tar.gz
# cd proftpd-1.3.0rc3
# ./configure 
--prefix=/usr/local/proftpd 
--sysconfdir=/etc 
--enable-autoshadow 
--localstatedir=/var/run 
--enable-ctrls 
--with-modules=mod_tls

# make
# make install

配置PROFTPD服务器:

# vi /etc/proftpd.conf
================+================+=================
# This is a basic ProFTPD configuration file (rename it to
# ''proftpd.conf'' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName                                      "llzqq"
ServerType                                      standalone
DefaultServer                                   on
AllowRetrieveRestart                            on
AllowStoreRestart                               on
ServerType                                      standalone
ServerIdent                                     on
SystemLog                                       /var/log/proftpd.log
UseReverseDNS                                   off
IdentLookups                                    off
RequireValidShell                               off
# Port 21 is the standard FTP port.
Port                                            21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                                           022
MaxInstances                                    100
# Set the user and group under which the server will run.
User                                            nobody
Group                                           nogroup
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite                                  on
</Directory>
# We want ''welcome.msg'' displayed at login, and ''.message'' displayed
# in each newly chdired directory.
DisplayLogin                                    .welcome
DisplayFirstChdir                               .message
# Limit User of being enbled login ftp server
<Limit LOGIN>
AllowGroup ftp
DenyAll
</Limit>
#########################ssl/tls############################
# MOD_TLS SETTING
<IfModule mod_tls.c>
TLSEngine on
TLSLog /var/log/proftpd-tls.log
TLSProtocol SSLv23
# Are clients required to use FTP over TLS when talking to this server?
TLSRequired ctrl
# Server''s certificate
TLSRSACertificateFile /etc/proftpd.crt
TLSRSACertificateKeyFile /etc/proftpd.key
# Authenticate clients that want to use FTP over TLS
TLSVerifyClient off
#########################ssl/tls############################
<Directory /home/down>
<Limit WRITE>
DenyGroup ftp
</Limit>
TransferRate RETR 150 group ftp
</Directory>
<Directory /home/upload>
<Limit RMD RNFR DELE RETR>
DenyGroup ftp
</Limit>
TransferRate STOR 150 group ftp
</Directory>
MaxClientsPerHost 200
PassivePorts 55000 56000
================+================+=================

创建PROFTPD的日志文件:

# touch /var/log/proftpd.log
# touch /var/log/proftpd-tls.log
# chown nobody:nogroup /var/log/proftpd.log /var/log/proftpd-tls.log

创建SSL传输的证书和密匙:

# cp /usr/share/ssl/openssl.cnf ./
# openssl req -new -x509 -nodes -config openssl.cnf -out proftpd.crt –keyout  proftpd.key
这里安装提示需要输入证书信息略

把证书和密匙复制到指定目录:
# cp proftpd.crt proftpd.key /etc/

已有 0 位对此文章感兴趣的网友发布了看法    
我来评两句 用户名: 密码:
  匿名发表
今日推荐
技术文库(共有 46294 篇文章)
操作系统
办公软件
实用知识
网络管理
软件开发
WEB开发
软件工程
数据库
设计在线
信息安全
行业信息化
管理信息化
移动开发
重点推荐
电子杂志订阅
点击电子杂志名称查看样刊
输入E-mail地址即可订阅
E-mail