I've been tinkering with a backup solution in my spare time, made to simplify doing backups as much as possible. It's written in bash.
The solution consists of 2 files, one placed on a backup server, the other one placed on the machine that wants to back up stuff.
The first file creates a chrooted user and modifies the server sshd configuration so that the user is only given access to an SFTP process in order to only upload files.
The second file simply sends the backup files to the server based on IP and username using SFTP.
The controversial part is the fact that the backup user is only authenticated using its IP address and username.
So, the only way an intruder could gain access is when 2 criteria is met:
Intruder somehow figures out that backup user does not authenticate using password and/or SSH key when connecting to the backup server.
Intruder successfully spoofs its own IP address to match the backup user and also somehow figures out the backup user's username.
At this point though, the intruder can only upload files as the sshd config file (on the backup server) has locked down the SFTP in order to minimize functionality as much as possible.
The full source code can be found here for your scrutiny.
So my question is pretty simple: Would this be considered safe?
Any and all suggestions/comments are welcome.