r/ClaudeCode • u/SoBeefy • 5d ago
Tips & Workflows I'm migrating a project from dev to prod. The prod server will contain sensitive information that I don't want to transmit. I'd like to use Claude to help configure and maintain the server. What's the approach here?
I can continue to use Claude in dev and upload code changes.
I'm interested in using Claude for the systems integration aspect of configuring and managing the production server. The server is currently running linux with a CPanel interface.
Can I make use of Claude without compromising(transmitting) the sensitive data that will live in a number of directories and databases? Is anyone else successfully managing this dichotomy? I am wondering if blacklisting the locations of sensitive data will limit or remove the benefit of Claude assisted configuration and maintenance.
Prod Server:
- Running Linux [NAME="AlmaLinux" VERSION="9.8 (Olive Jaguar)"]
- CPanel interface for host management is present.
- Will run DJango, nginx, and postgres.
- Hosts email server (in place now).
EDIT: I asked Claude... https://claude.ai/share/eb081365-148e-43a6-897a-635d10f14909
It feels like mistakes would be easy to make here.
•
u/AutoModerator 5d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/gybemeister 5d ago
I have the same problem. I setup a staging server with testing data and had Claude create scripts (and documentation) to do all the management tasks I could think of. Then, using passwordless ssh, had Claude test and validate the scripts against the staging server. Finally, nuked the server and run the scripts myself to ensure it works. Then prod.
8
u/markedness 5d ago
The usual way to do this predates Claude and is best practice
Use infrastructure as code. Something like terraform, Ansible, etc. have Claude write that into a (usually separate, sometimes same) repo.
Then you setup staging per this and then for prod you run its commands and paste back errors. But it should generally work. Since it works on staging.
The other thing is secrets. Those could be as simple as a file that you use as your environment or ideally some sort of more cryptography secure secrets manager. Like Vault.
1
u/Dhaupin 5d ago
Claude cli locally on the server? Or remote? What os? Do the db's run in same space? What will it be managing? What levels of the stack? Through what account? How are you currently deploying dev to prod?
1
u/TraditionalGas1770 5d ago
Looks like you need a key vault solution
1
u/keto_brain 5d ago
Yes, you can use claude but don't use Cluade.ai or point your claude code at your Claude subscription, you can temporarily point your Claude Code CLI to AWS Bedrock, you will pay token spends and it's expensive but inference happens in memory in AWS Bedrock and there is no training on your data. So ONLY for the transmission of sensitive data would you want to point your claude code to AWS Bedrock and incur the costs.
1
u/kaijurules 5d ago
Another option is keeping the model from seeing the values at all. Our app runs a local detector over everything an agent sends to the cloud model and swaps names, emails, IBANs and similar for placeholders, then puts the real values back in what you read. It's a filter, so anything it misses still goes out in clear. For the directories you can't risk, a local model is the only setup where nothing leaves the machine.
1
u/Prestigious_Cod2793 4d ago
What I do is simpler. Claude never touches the prod server. It edits the code on my PC, I commit and push, and the server only pulls. Secrets live in a .env file that is not in git and that Claude never reads, so nothing sensitive goes through it. My web server config is in a repo too, so the server is just a checkout plus the .env. Is cPanel really needed for what you run, or could Django, nginx and postgres live outside it ?
1
u/David_UltraWeb 4d ago
CI/CD all day long. The IaC + staging approach people are pushing is the right call, so I'll just add the cPanel-specific wrinkle since that's your real complication. The reason blacklisting directories feels awkward is that with cPanel/WHM a lot of config lives in generated files and the panel's own data stores, so Claude reasoning about your setup often doesn't need to touch /home/*/mail or your db contents at all. It needs the nginx/Apache includes, the Django service config, and the postgres settings, none of which contain your sensitive rows or mailboxes. Keep those dirs out of whatever directory you point the agent at and you lose basically nothing on the config side
1
u/0DayMaker 4d ago
Tarball ran through aes-256 via gpg or something then transferred via host to host vpn seems like the super cautious way. Maybe with strongswan? It's an easy setup.
1
u/JustMaoCom 4d ago
If Claude Code ends up running on that box, /sandbox alone won't get you there. By default sandboxed commands can still read most of the machine and they inherit the environment, so a DATABASE_URL or Django secret in env goes right along. When I tested it on 2.1.323 with just the sandbox on, a fake secret file and a fake token were both still readable until I listed them under sandbox.credentials, and Claude's own Read tool still opened the file until I added a Read(...) deny rule.
1
u/markera_ 3d ago
Yes, and the trick is to structure the access so the agent cannot reach the sensitive stuff in the first place, instead of relying on a blacklist to keep it out. A blacklist is a weak control. You will miss a path, a log line will contain a secret, and the agent will read it because it was trying to be helpful. Allowlist instead: decide exactly what the agent is allowed to see, and give it nothing else. The setup that works for me: Claude edits code and config in a repo on my machine, I deploy through git. Claude never touches prod directly. For debugging prod I give it read-only access to logs only, not the database, not env files, not the data directories. Logs are where the answers usually are anyway. I built my own log tooling around exactly this rule, read-only by design, because once an agent can write to prod it will eventually do something you did not ask for. Secrets stay in env files or a vault and never go in the repo or the chat. If a config value has to reach the model, redact it first. Do not expose an MCP server from the prod box to the internet. That is a remote code execution hole with a friendly name. If you need remote tools, put them behind a VPN like Tailscale and a locked-down OS user with the minimum permissions. Short version: keep Claude off prod, give it read-only logs, and treat the blacklist as a backup, not the plan.
1
u/smermetfr 2d ago
blacklisting paths helps a little, but the real boundary is what the agent process can read at all. run Claude as a separate user (or over ssh) with no permissions on those directories, and keep creds in something it references rather than reads. that second part is what I'm building Fileaify for (https://fileaify.com): keys sit in a vault, the agent writes a vault:// reference, and the value gets used server-side and masked in output, with scoped permissions you can revoke.
Explanation video of the vault at minute 2: https://fileaify.com/static/videos/onboarding-en.mp4?v=161