3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

作業メモ

とある問題切り分けのため、AWS上にFTPサーバを立てて、FTPSでの疎通確認
※運用するための構築手順ではないので、きちんとした設定ができていないですが
※部分部分で何らかお役に立てれば嬉しいです。
 

環境

amzn-ami-hvm-2016.09.1.20170119-x86_64-gp2 (ami-56d4ad31)

1.事前準備

yum install gcc
yum install openssl-devel

2.proftpd install

cd /usr/local/src
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5d.tar.gz
tar -zxvf ./proftpd-1.3.5d.tar.gz
cd proftpd-1.3.5d
./configure --with-modules=mod_tls
make
make install

3.設定

vim /usr/local/etc/proftpd.conf
PassivePorts                  10000 10003(passiveModeで使うデータ転送用ポートです)
Group                           nobody (nogroupから変更)
MasqueradeAddress FTPサーバのグローバルIP

4.ホスト名を引けるようにしておく(そのまま起動したらエラーになったので)

vim /etc/hosts

5.確認用ユーザを追加

useradd -d /ftp/ftp_user -s /sbin/nologin ftp_user
passwd ftp_user

起動

/usr/local/sbin/proftpd

一旦、FTP接続確認(WinSCP利用) →OK

6.TLS/SSL化(FTPS)

オレオレ証明書
※参考にさせていただきました
http://d.hatena.ne.jp/ozuma/20130511/1368284304

openssl genrsa 2048 > ftps.key
openssl req -new -key ftps.key > ftps.csr
openssl x509 -days 3650 -req -signkey ftps.key < ftps.csr > ftps.crt
cp ./ftps.crt /etc/pki/tls/certs/ftps.crt
cp ./ftps.key /etc/pki/tls/private/ftps.key
chmod 600 /etc/pki/tls/certs/ftps.crt
chmod 600 /etc/pki/tls/private/ftps.key
vim /usr/local/etc/proftpd.conf

以下追記

<IfModule mod_tls.c>
    TLSEngine on
    TLSRequired off

    TLSLog  /var/log/proftpd/tls.log
    TLSProtocol TLS1.2
    TLSCipherSuite HIGH:MEDIUM
    
    TLSRSACertificateFile /etc/pki/tls/certs/ftps.crt
    TLSRSACertificateKeyFile /etc/pki/tls/private/ftps.key
    TLSOptions NoCertRequest
    TLSVerifyClient off
</IfModule>

proftpd上げ直し
TLS接続確認(WinSCP)→OK(鍵マーク確認)

疎通確認を通して、きちんとしなきゃなと思ったこと

・chrootの制御(FTP接続後、普通に上位ディレクトリが見えてしまってた)
・TLSCipherSuiteがよくわからんまま、なるべく安全そうなのを並べたが確証がない

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?