웹사이트 검색

Debian 8에서 TLS로 vsftpd를 설치하고 구성하는 방법(Jessie)


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • 데비안 6(스퀴즈)

이 페이지에서

  1. 1 서문
  2. 2 vsftpd 및 OpenSSL 설치
  3. 3 TLS용 SSL 인증서 생성
  4. 4 vsftpd에서 TLS 활성화\n
  5. 5 vsftpd 사용자 추가
  6. 6 TLS용 FileZilla 구성
  7. 7개의 링크

이 문서에서는 Debian 8 서버에서 TLS 지원 vsftpd 서버를 설정하는 방법과 FileZilla로 FTP 서버에 액세스하는 방법을 설명합니다. FTP는 모든 암호와 모든 데이터가 일반 텍스트로 전송되기 때문에 기본적으로 매우 안전하지 않은 프로토콜입니다. TLS를 사용하면 전체 통신을 암호화할 수 있으므로 FTP를 훨씬 더 안전하게 만들 수 있습니다.

1 서문

이 자습서에서는 호스트 이름 server1.example.com을 IP 주소 192.168.1.100과 함께 사용합니다. 이러한 설정은 사용자에 따라 다를 수 있으므로 적절하게 교체해야 합니다. 이 튜토리얼의 기초로 Debian 8 최소 서버 설정을 사용합니다.

2 vsftpd 및 OpenSSL 설치

OpenSSL은 TLS에 필요합니다. vsftpd 및 OpenSSL을 설치하려면 다음을 실행하기만 하면 됩니다.

apt-get -y install vsftpd openssl

3 TLS용 SSL 인증서 생성

TLS를 사용하기 위해서는 SSL 인증서를 생성해야 합니다. /etc/ssl/private에 생성합니다. 디렉토리가 존재하지 않으면 지금 생성합니다::

mkdir -p /etc/ssl/private
chmod 700 /etc/ssl/private

그런 다음 다음과 같이 SSL 인증서를 생성할 수 있습니다.

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

국가 이름(2자리 코드) [AU]: <-- 국가 이름(예: "DE")을 입력하세요.
주 또는 도 이름(전체 이름) [Some-State]:<-- 국가 이름을 입력하세요. 시/도 이름.
지역 이름(예: 도시) []:<-- 도시를 입력하세요.
조직 이름(예: 회사) [Internet Widgits Pty Ltd]:<-- 조직 이름을 입력하세요( 예: 회사 이름).
조직 단위 이름(예: 섹션) []:<-- 조직 단위 이름(예: "IT 부서")을 입력합니다.
일반 이름(예: 귀하 name) []:<-- 시스템의 정규화된 도메인 이름을 입력합니다(예: "server1.example.com").
이메일 주소 []:<-- 이메일 주소를 입력합니다.

4 vsftpd에서 TLS 활성화

vsftpd에서 TLS를 활성화하려면 /etc/vsftpd.conf...를 엽니다.

nano /etc/vsftpd.conf

... 다음 옵션을 추가하거나 변경합니다.

[...]

# Turn on SSL ssl_enable=YES # Allow anonymous users to use secured SSL connections allow_anon_ssl=YES # All non-anonymous logins are forced to use a secure SSL connection in order to # send and receive data on data connections. force_local_data_ssl=YES # All non-anonymous logins are forced to use a secure SSL connection in order to send the password. force_local_logins_ssl=YES # Permit TLS v1 protocol connections. TLS v1 connections are preferred ssl_tlsv1=YES # Permit SSL v2 protocol connections. TLS v1 connections are preferred ssl_sslv2=NO # permit SSL v3 protocol connections. TLS v1 connections are preferred ssl_sslv3=NO # Disable SSL session reuse (required by WinSCP) require_ssl_reuse=NO # Select which SSL ciphers vsftpd will allow for encrypted SSL connections (required by FileZilla) ssl_ciphers=HIGH # This option specifies the location of the RSA certificate to use for SSL # encrypted connections. rsa_cert_file=/etc/ssl/private/vsftpd.pem [...]

force_local_logins_ssl=YES 및 force_local_data_ssl=YES를 사용하는 경우 TLS 연결만 허용됩니다(TLS 지원이 없는 이전 FTP 클라이언트를 사용하는 모든 사용자가 잠김). force_local_logins_ssl=NO 및 force_local_data_ssl=NO를 사용하면 FTP 클라이언트가 지원하는 항목에 따라 TLS 및 비 TLS 연결이 모두 허용됩니다.

TLS 옵션 외에도 비익명 로그인을 활성화하려면 vsftpd.conf에 다음 설정이 있는지 확인하십시오.

[...]
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022

[...]

나중에 vsftpd를 다시 시작합니다.

service vsftpd restart

그게 다야. 이제 FTP 클라이언트를 사용하여 연결을 시도할 수 있습니다. 그러나 TLS를 사용하도록 FTP 클라이언트를 구성해야 합니다.

5 vsftpd 사용자 추가

이 단계에서는 연결하는 데 사용할 수 있는 로컬 Linux 사용자를 추가합니다. 암호가 "howtoforge"인 "till" 사용자를 생성하겠습니다. 모든 FTP 사용자는 mkdir /var/ftproot에 홈 디렉토리가 있으므로 이 디렉토리를 먼저 생성하겠습니다.

mkdir /var/ftproot

그런 다음 다음 명령을 사용하여 사용자를 추가합니다.

adduser --home /var/ftproot/till till

adduser 명령은 사용자 암호 및 기타 세부 정보를 묻습니다.

:/# adduser --home /var/ftproot/till till
Adding user `till' ...
Adding new group `till' (1001) ...
Adding new user `till' (1001) with group `till' ...
Creating home directory `/var/ftproot/till' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: <-- Enter the new password here
Retype new UNIX password: <-- Enter the new password here
passwd: password updated successfully
Changing the user information for till
Enter the new value, or press ENTER for the default
Full Name []: <-- Enter your name here or press enter to skip
Room Number []: <-- Enter room number here or press enter to skip
Work Phone []: <-- Enter work phone here or press enter to skip
Home Phone []: <-- Enter home phone here or press enter to skip
Other []: <-- Enter Other user details here or press enter to skip
Is the information correct? [Y/n] <-- Y

FTP 사용자를 성공적으로 추가했습니다.

6 TLS용 FileZilla 구성

TLS와 함께 FTP를 사용하려면 FileZilla와 같은 TLS를 지원하는 FTP 클라이언트가 필요합니다.

FileZilla에서 서버 관리자를 엽니다.

서버 입력란에 FTP 서버의 IP 주소 또는 호스트 이름을 입력하고 프로토콜 "FTP" 및 "TLS를 통한 명시적 FTP 필요"를 선택한 다음 사용자 입력란에 사용자 이름을 입력합니다.

이제 서버에 연결할 수 있습니다. 이 작업을 처음 수행하는 경우 서버의 새 SSL 인증서를 수락해야 합니다.

모든 것이 잘 되었다면 이제 서버에 로그인되어 있어야 합니다.

7 링크

  • vsftpd: https://security.appspot.com/vsftpd.html
  • 파일질라: http://filezilla-project.org/
  • 데비안: http://www.debian.org/