I currently have a proxified web host setup for local development, yet I'm trying to make it a proper (documented) setup so I can deploy it on practically any VPS hosting.
Currently everything else but the chrooted user setup is working.
Apache proxies, and SSH bounce is working.
If I disable the chrooting of dev (for developer) user, LocalForwarding works even for the dev user, and I can succesfully access the bounced SSH host and succesfully use SFTP on the forwarded setup using dev user on localhost:5000 which redirects to port 22 on the Development server.
But after I enable chrooting in sshd_config for user dev, I found out I'm missing some files which make it possible to SFTP to this LocalForwarded setup.
channel 5: open failed: connect failed: Device or resource busy
I then tried to mount different areas of the Development container using mount -o bind
sudo mount -o bind /bin /home/remoteusers/bin;
sudo mount -o bind /dev /home/remoteusers/dev;
sudo mount -o bind /etc /home/remoteusers/etc;
sudo mount -o bind /lib64 /home/remoteusers/lib64;
sudo mount -o bind /opt /home/remoteusers/opt;
sudo mount -o bind /proc /home/remoteusers/proc;
sudo mount -o bind /run /home/remoteusers/run;
sudo mount -o bind /sbin /home/remoteusers/sbin;
sudo mount -o bind /srv /home/remoteusers/srv;
sudo mount -o bind /sys /home/remoteusers/sys;
sudo mount -o bind /tmp /home/remoteusers/tmp;
sudo mount -o bind /usr /home/remoteusers/usr;
sudo mount -o bind /var /home/remoteusers/var;
No use so far. I then got to /lib by running the following.
sudo mount -o bind /lib /home/remoteusers/lib
The error message then changed from the previous resource busy, to
channel 5: open failed: connect failed: Temporary failure in name resolution
When mounting both, /lib and /etc using
sudo mount -o bind /etc /home/remoteusers/etc
sudo mount -o bind /lib /home/remoteusers/lib
ssh -v
returns
debug1: channel 5: free: direct-tcpip: listening port 5000 for localhost port 22, connect from 127.0.0.1 port 38519 to 127.0.0.1 port 5000, nchannels 6
So it's more fixed by having something in the /etc folder in the chrooted location. Still, my SFTP client says
Error: Received unexpected end-of-file from SFTP server
Error: Could not connect to server
I'm now wondering, as everything else but the chroot(ed setup) works, what am I missing? I now should find out how to make the chroot include the missing piece so I don't have to make the whole filesystem of Development container vulnerable instead of revealing only the chroot.
Did I miss something?
Hosts map:
MAINHOST (running all the containers) {
Logins {
admin
bounce
}
PROXY-CONTAINER ("Proxy") { }
DEVELOPMENT-CONTAINER ("Development") {
Logins {
admin
dev
}
}
}
I can publish the documentation on Google Drive if anyone's interested.
(I'm running the setup in a VirtualBox on the same desktop client).