熱點推薦:
您现在的位置: 電腦知識網 >> 操作系統 >> Windows服務器 >> 正文

在LINUX系統上構建FTP加密傳輸

2022-06-13   來源: Windows服務器 

  在眾多的FTP服務器中PROFTPD由於它的配置靈活安裝簡便近年來一直受到人們的喜愛通常情況下FTP包括認證過程傳輸是明文傳輸的在傳輸一些敏感數據時總是不能讓人放心今天我在網上找了一些零散的資料結合自己的實作寫了個帖子貢獻給大家

  下載最新的軟件版本

  #wgetftp:///distrib/source/proftpdrctargz

  首先創建ROFTPD運行的用戶和組

  #groupaddnogroup

  #useradd?Cgnogroup?Cd/dev/null?Cs/sbin/nologinnobody

  首先創建上傳下載的用戶和組

  #groupaddftp

  #useradd?Cgftp?Cd/home/down?Cs/sbin/nologindown

  #useradd?Cgftp?Cd/home/upload?Cs/sbin/nologinupload

  用戶密碼設置略

  編譯安裝PROFRPD:

  #tar?Czxvfproftpdrctargz

  #cdproftpdrc

  #/configure

  prefix=/usr/local/proftpd

  sysconfdir=/etc

  enableautoshadow

  localstatedir=/var/run

  enablectrls

  withmodules=mod_tls

  #make

  #makeinstall

  配置PROFTPD服務器

  #vi/etc/nf

  ================+================+=================

  #ThisisabasicProFTPDconfigurationfile(renameitto

  #&#;nf&#;foractualuseItestablishesasingleserver

  #andasingleanonymousloginItassumesthatyouhaveauser/group

  #nobodyandftpfornormaloperationandanon

  ServerNamellzqq

  ServerTypestandalone

  DefaultServeron

  AllowRetrieveRestarton

  AllowStoreRestarton

  ServerTypestandalone

  ServerIdenton

  SystemLog/var/log/proftpdlog

  UseReverseDNSoff

  IdentLookupsoff

  RequireValidShelloff

  #PortisthestandardFTPport

  Port

  #Umaskisagoodstandardumasktopreventnewdirsandfiles

  #frombeinggroupandworldwritable

  Umask

  MaxInstances

  #Settheuserandgroupunderwhichtheserverwillrun

  Usernobody

  Groupnogroup

  #TocauseeveryFTPusertobejailed(chrooted)intotheirhome

  #directoryuncommentthisline

  DefaultRoot~

  #Normallywewantfilestobeoverwriteable

  AllowOverwriteon

  #Wewant&#;welcomemsg&#;displayedatloginand&#ssage&#;displayed

  #ineachnewlychdireddirectory

  DisplayLoginwelcome

  Dssage

  #LimitUserofbeingenbledloginftpserver

  AllowGroupftp

  DenyAll

  #########################ssl/tls############################

  #MOD_TLSSETTING

  TLSEngineon

  TLSLog/var/log/proftpdtlslog

  TLSProtocolSSLv

  #AreclientsrequiredtouseFTPoverTLSwhentalkingtothisserver?

  TLSRequiredctrl

  #Server&#;scertificate

  TLSRSACertificateFile/etc/proftpdcrt

  TLSRSACertificateKeyFile/etc/proftpdkey

  #AuthenticateclientsthatwanttouseFTPoverTLS

  TLSVerifyClientoff

  #########################ssl/tls############################

  DenyGroupftp

  TransferRateRETRgroupftp

  DenyGroupftp

  TransferRateSTORgroupftp

  MaxClientsPerHost

  PassivePorts

  ================+================+=================

  創建PROFTPD的日志文件

  #touch/var/log/proftpdlog

  #touch/var/log/proftpdtlslog

  #chownnobody:nogroup/var/log/proftpdlog/var/log/proftpdtlslog

  創建SSL傳輸的證書和密匙

  #cp/usr/share/ssl/f/

  #opensslreqnewxnodfoutproftpdcrt?Ckeyoutproftpdkey

  這裡安裝提示需要輸入證書信息略

  把證書和密匙復制到指定目錄

  #cpproftpdcrtproftpdkey/etc/

  最後創建PROFTPD啟動教本

  #vi/etc/initd/proftpd

  ================+================+=================

  #!/bin/sh

  #StartupscriptforProFTPD

  #chkconfig:

  #description:ProFTPDisanenhancedFTPserver

  #processname:proftpd

  #config:/etc/nf

  #Sourcefunctionlibrary

  /etc/rcd/initd/functions

  if;then

  /etc/sysconfig/proftpd

  fi

  PATH=$PATH:/usr/local/proftpd/sbin

  #Seehowwewerecalled

  case$in

  start)

  echonStartingproftpd:

  daemonproftpd$OPTIONS

  echo

  touch/var/lock/subsys/proftpd

  ;;

  stop)

  echonShuttingdownproftpd:

  killprocproftpd

  echo

  rmf/var/lock/subsys/proftpd

  ;;

  status)

  statusproftpd

  ;;

  restart)

  $stop

  $start

  ;;

  reread)

  echonRereadingproftpdconfig:

  killprocproftpdHUP

  echo

  ;;

  suspend)

  hashftpshut>/dev/null>&

  if;then

  if;then

  shift

  echonSuspendingwith&#;$*&#;

  ftpshut$*

  else

  echonSuspendingNOW

  ftpshutnowMaintananceinprogress

  fi

  else

  echonNowaytosuspend

  fi

  echo

  ;;

  resume)

  if;then

  echonAllowingsessionsagain

  rmf/etc/shutmsg

  else

  echonWasnotsuspended

  fi

  echo

  ;;

  *)

  echonUsage:${start|stop|restart|status|reread|resume

  hashftpshut

  if;then

  echo&#;}&#;

  else

  echo&#;|suspend}&#;

  echo&#;suspendacceptsadditionalargumentswhicharepassedtoftpshut()&#;

  fi

  exit

  esac

  if;then

  shift

  $$*

  fi

  exit

  ================+================+=================

  #chomd/etc/initd/proftpd

  #chkconfig–addproftpd

  #chkconfigproftpdon

  到這裡ftp服務器端安裝設置完畢登陸服務器的客戶端我用了完全免費的FileZilla(前兩天網上看到說FileZilla支持SSL不錯)FileZilla的設置也比較簡單本服務器支持兩種客戶端加密連接方式

   FTPoverssl(顯示加密)方式連接

   FTPovertls(顯示加密)方式連接

  如下圖所示

alt= src=http://imgeducitycn/img_///jpg >

   FTP over tls (顯示加密)

alt= src=http://imgeducitycn/img_///jpg >

   FTP over ssl (顯示加密)


From:http://tw.wingwit.com/Article/os/fwq/201404/30364.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.