在Debian上配置FTP SSL证书,通常需要使用FTPS(FTP over SSL)或SFTP(SSH File Transfer Protocol)。以下是配置FTPS的步骤:
安装Certbot:
sudo apt update
sudo apt install certbot
获取SSL证书: Certbot通常用于HTTP/HTTPS网站,但也可以用于FTP。你需要先创建一个自签名证书或从Let’s Encrypt获取证书。
sudo certbot certonly --standalone -d yourdomain.com
按照提示完成证书的获取和安装。
假设你使用的是vsftpd
作为FTP服务器,以下是配置步骤:
安装vsftpd:
sudo apt update
sudo apt install vsftpd
配置vsftpd:
编辑/etc/vsftpd.conf
文件:
sudo nano /etc/vsftpd.conf
添加或修改以下配置:
listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
ssl_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
rsa_private_key_file=/etc/letsencrypt/live/yourdomain.com/privkey.pem
ssl_ciphers=HIGH
重启vsftpd服务:
sudo systemctl restart vsftpd
确保防火墙允许FTP流量:
sudo ufw allow 21/tcp
sudo ufw allow 990/tcp # FTPS控制端口
sudo ufw allow 40000:50000/tcp # FTPS数据端口(可选)
sudo ufw reload
使用FTP客户端连接到你的服务器,确保SSL证书正确安装并且连接是加密的。
ftp -v yourdomain.com
你应该看到类似以下的输出,表明连接是加密的:
Connected to yourdomain.com.
220 (vsFTPd 3.0.3)
AUTH TLS
234 AUTH command ok. Expecting TLS Negotiation.
User (yourdomain.com:yourusername) OK. Password required
Password:
230 Login successful.
通过以上步骤,你应该能够在Debian上成功配置FTP SSL证书。