在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證書。