Cobra · Infrastructure + Odoo integration
SFTP server + automatic drop stock pipeline
Context
Cobra receives stock files from its dropshipping suppliers (Sogetronic, CNSI-SD) by email or manually. The goal: automate reception via a secure SFTP server and inject files into Odoo automatically, no human intervention needed.
Server infrastructure (51.15.223.154 — Ubuntu 26.04)
fail2ban: SSH jail, maxretry=5, bantime=1h, banaction via ufwufw: deny all in, allow 22/tcp only- OpenSSH in SFTP-only mode with per-user chroot (
Match Group sftpusers,ForceCommand internal-sftp) - Isolated SFTP users:
sogetronicandcnsi-sd, chrooted in/srv/sftp/.../files/
sync_sogetronic.py script (v3)
- Detects any dropped
.xlsx/.csv, base64-encodes it, creates acobra.dropship.importrecord via XML-RPC - Calls
action_run_import()— Odoo processes in a single transaction (~8 s for 2,312 lines) - Archives the processed file,
fcntllock to prevent concurrency, cron0 * * * *
What was tricky
PasswordAuthenticationglobally blocked by60-cloudimg-settings.conf— must be re-enabled only within theMatch Group sftpusersblock- Script v1: ~7,000 XML-RPC calls = 9 min. The solution wasn't to optimize the script but to hook into the existing Odoo module that handles everything server-side — ×60 speed gain
Stack
Bash/SSH, Python 3, xmlrpc.client, base64, fcntl, ufw, fail2ban, OpenSSH (chroot SFTP), Odoo 18 Enterprise.
What this illustrates
Long multi-layer session: system infrastructure (SSH hardening, firewall, users) and application logic (Odoo pipeline). The key moment: Claude read the existing code before writing a line, avoiding a rewrite and landing directly on the right architecture.