热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux系统为ProFTPd和vsftpd配置ssl加密传输

在LINUX系统上建立FTP加密传输1、下载最新的软件版本:#wgetftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0rc3.tar.gz2、创建FTP组和用户首先创建ROFTPD运行的用户和组:#groupaddnogroup#useradd?gnogroup?d/
在LINUX系统上建立FTP加密传输
1、下载最新的软件版本:
# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0rc3.tar.gz
2、创建FTP组和用户
首先创建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
   用户密码设置略
3、编译安装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
4、配置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                                      "jekay"
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.

AllowOverwrite                                  on

# 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

AllowGroup ftp
DenyAll

SSL加密的参数在这里,重点!
#########################ssl/tls#######################
MOD_TLS SETTING

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######################


DenyGroup ftp

TransferRate RETR 150 group ftp



DenyGroup ftp

TransferRate STOR 150 group ftp

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/
最后创建PROFTPD启动脚本:
# vi /etc/init.d/proftpd #!/bin/sh
# Startup script for ProFTPD
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server
# processname: proftpd
# config: /etc/proftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/proftpd ]; then
      . /etc/sysconfig/proftpd
fi
PATH="$PATH:/usr/local/proftpd/sbin"
# See how we were called.
case "$1" in
        start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd         stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd         status)
status proftpd         restart)
$0 stop
$0 start         reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo         suspend)
hash ftpshut >/dev/null 2>&1
if [ $? = 0 ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with '$*' "
ftpshut $*
else
echo -n "Suspending NOW "
ftpshut now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo         resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo         *)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
hash ftpshut
if [ $? = 1 ]; then
echo '}'
else
echo '|suspend}'
echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
fi
exit 1
esac
if [ $# -gt 1 ]; then
        shift
        $0 $*
fi
exit 0
================+================+================
# chomd 755 /etc/init.d/proftpd
# chkconfig ?-add proftpd
# chkconfig proftpd on
5、客户端连接测试
到这里ftp服务器端安装设置完毕,登陆服务器的客户端我用了完全免费的FileZilla
本服务器支持两种客户端加密连接方式:
1. FTP over ssl (显示加密)方式连接。
2. FTP over tls (显示加密) 方式连接
建立在LINUX系统上的VSFTP加密传输
参考文档:ftp://vsftpd.beasts.org/users/ce ... pd-2.0.1/README.ssl
在众多的FTP服务器中VSFTP以安全,小巧著称。近年来一直受到人们的喜爱。通常情况下FTP包括认证过程,传输是明文传输的,在传输一些敏感数据时总是不能让人放心。
1.下载
最新的VSFTPD:
# wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.3.tar.gz
2、 编译安装VSFTPD:
# tar ?zxvf vsftpd-2.0.3.tar.gz
# cd vsftpd-2.0.3
3、修改VSFTPD使其支持SSL传输:
修改builddefs.h文件中的:
#undef VSF_BUILD_TCPWRAPPERS
#define VSF_BUILD_PAM
#undef VSF_BUILD_SSL #define VSF_BUILD_TCPWRAPPERS
#undef VSF_BUILD_PAM
#define VSF_BUILD_SSL
4、开始编译安装:
# make
# make install
# cp vsftpd.conf /etc/
创建SSL证书:
# openssl req -new -x511 -nodes -out vsftpd.pem -keyout vsftpd.pem
# cp vsftpd.pem /usr/share/ssl/certs/vsftpd.pem
创建需要的帐号和目录:
# useradd ?d /dev/null ?s /sbin/nologin nobody
# mkdir /usr/share/empty
# mkdir /var/ftp
# useradd -d /var/ftp ?s /sbin/nologin ftp
# chown root:root /var/ftp
# chmod og-w /var/ftp
5、配置VSFTPD:
# vi /etc/vsftpd.conf anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#chown_uploads=YES
#chown_username=whoever
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
#idle_session_timeout=600
#data_connection_timeout=120
#nopriv_user=ftpsecure
#async_abor_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to Serv-U FTP Server v5.0 for WinSock.
#deny_email_enable=YES
#banned_email_file=/etc/vsftpd.banned_emails
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=NO
hide_ids=YES
userlist_enable=NO
use_localtime=YES
listen=YES
listen_port=21
tcp_wrappers=YES
ssl_enable=YES
ssl_sslv2=YES
allow_anon_ssl=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
rsa_cert_file=/usr/share/ssl/certs/vsftpd.pem # touch /etc/vsftpd.chroot_list
写一个VSFTPD启动教本:
# vi /etc/init.d/vsftpd #!/bin/sh
# Copyright (c) 2004 by LLZQQ
# All rights reserved. # chkconfig: - 110 30
# description: Starts and stops the Vsftpd Service
# config: /etc/vsftpd.conf case "$1" in
start)
        /usr/local/sbin/vsftpd & stop)
        pkill vsftpd *)
        echo "Usage: $0 { start | stop }"
        exit 1 esac
exit 0
===========+=============+===========
# chmod 755 /etc/init.d/vsftpd
# chkconfig ?-add vsftpd
# chkconfig vsftpd on
6、测试
到这里ftp服务器端安装设置完毕,登陆服务器的客户端我用了完全免费的FileZilla

推荐阅读
  • 本文介绍了Python高级网络编程及TCP/IP协议簇的OSI七层模型。首先简单介绍了七层模型的各层及其封装解封装过程。然后讨论了程序开发中涉及到的网络通信内容,主要包括TCP协议、UDP协议和IPV4协议。最后还介绍了socket编程、聊天socket实现、远程执行命令、上传文件、socketserver及其源码分析等相关内容。 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • 学习SLAM的女生,很酷
    本文介绍了学习SLAM的女生的故事,她们选择SLAM作为研究方向,面临各种学习挑战,但坚持不懈,最终获得成功。文章鼓励未来想走科研道路的女生勇敢追求自己的梦想,同时提到了一位正在英国攻读硕士学位的女生与SLAM结缘的经历。 ... [详细]
  • 本文介绍了在rhel5.5操作系统下搭建网关+LAMP+postfix+dhcp的步骤和配置方法。通过配置dhcp自动分配ip、实现外网访问公司网站、内网收发邮件、内网上网以及SNAT转换等功能。详细介绍了安装dhcp和配置相关文件的步骤,并提供了相关的命令和配置示例。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 本文介绍了在Hibernate配置lazy=false时无法加载数据的问题,通过采用OpenSessionInView模式和修改数据库服务器版本解决了该问题。详细描述了问题的出现和解决过程,包括运行环境和数据库的配置信息。 ... [详细]
  • 禁止程序接收鼠标事件的工具_VNC Viewer for Mac(远程桌面工具)免费版
    VNCViewerforMac是一款运行在Mac平台上的远程桌面工具,vncviewermac版可以帮助您使用Mac的键盘和鼠标来控制远程计算机,操作简 ... [详细]
  • 本文详细介绍了云服务器API接口的概念和作用,以及如何使用API接口管理云上资源和开发应用程序。通过创建实例API、调整实例配置API、关闭实例API和退还实例API等功能,可以实现云服务器的创建、配置修改和销毁等操作。对于想要学习云服务器API接口的人来说,本文提供了详细的入门指南和使用方法。如果想进一步了解相关知识或阅读更多相关文章,请关注编程笔记行业资讯频道。 ... [详细]
  • 生成对抗式网络GAN及其衍生CGAN、DCGAN、WGAN、LSGAN、BEGAN介绍
    一、GAN原理介绍学习GAN的第一篇论文当然由是IanGoodfellow于2014年发表的GenerativeAdversarialNetworks(论文下载链接arxiv:[h ... [详细]
  • [译]技术公司十年经验的职场生涯回顾
    本文是一位在技术公司工作十年的职场人士对自己职业生涯的总结回顾。她的职业规划与众不同,令人深思又有趣。其中涉及到的内容有机器学习、创新创业以及引用了女性主义者在TED演讲中的部分讲义。文章表达了对职业生涯的愿望和希望,认为人类有能力不断改善自己。 ... [详细]
  • 本文介绍了Hyperledger Fabric外部链码构建与运行的相关知识,包括在Hyperledger Fabric 2.0版本之前链码构建和运行的困难性,外部构建模式的实现原理以及外部构建和运行API的使用方法。通过本文的介绍,读者可以了解到如何利用外部构建和运行的方式来实现链码的构建和运行,并且不再受限于特定的语言和部署环境。 ... [详细]
author-avatar
圣菁振婷玉勇
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有