Skip to content

Add PASV Same-IP Check feature for enhanced security#111

Open
rhykw wants to merge 5 commits intopyama86:masterfrom
rhykw:feature/pasv-same-ip-check
Open

Add PASV Same-IP Check feature for enhanced security#111
rhykw wants to merge 5 commits intopyama86:masterfrom
rhykw:feature/pasv-same-ip-check

Conversation

@rhykw
Copy link

@rhykw rhykw commented Feb 20, 2026

概要

PASVモードでのデータ接続において、コントロール接続と同じIPアドレスからの接続のみを許可するセキュリティ機能を追加。

変更内容

  • EnforceSameIPCheck 設定オプションを追加
  • データ接続時の接続元IPアドレス検証ロジックを実装
  • vsftpd の pasv_promiscuous=NO と同等の動作

設定方法

# PASV データ接続の同一IP チェックを有効化(デフォルト: false)
enforce_same_ip_check = true

セキュリティ

この機能により、第三者による不正なデータ接続攻撃(FTP bounce attack等)を防ぐことができる。

後方互換性

デフォルト値は false に設定されており、既存の動作に影響しないはず。。。

Add new configuration option to enable PASV same-IP validation:
- Add EnforceSameIPCheck boolean field to config struct
- Set default value to false to maintain backward compatibility
- Add WithEnforceSameIPCheck() ConfigOption function
- TOML configuration name: enforce_same_ip_check
Add validation logic to reject PASV data connections from different IPs:
- Modify clientListenOrDial() to check client IP against control connection IP
- Implement loop to handle multiple connection attempts
- Only allow connections when EnforceSameIPCheck is enabled
- Log validation results for debugging
- Maintain vsftpd pasv_promiscuous=NO equivalent behavior
Add configuration example for enforce_same_ip_check option:
- Add documentation comment explaining the feature
- Set default value to false
- Place configuration near related ignore_passive_ip setting
Add test cases to verify EnforceSameIPCheck functionality:
- Test with enforce_same_ip_check enabled
- Test combination with IgnorePassiveIP setting
- Ensure configuration compatibility with existing features
Fix field alignment in config struct
@rhykw rhykw marked this pull request as ready for review February 20, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant