[scponly] Unison in chroot environment
Martin Werthmoeller
mw at lw-systems.de
Sat Jan 7 12:05:58 EST 2006
Hi *,
I found a little bug at scponly-4.3. A setup with unison in a chroot
environment will fail.
Unison needs the $HOME environment variable be set to the directory where
the .unison directory resides. At the jail this directory must be
accessible from the current root dir.
I've attached a patch where the $HOME variable will be set to '/' if it is
called with chroot.
The patch was tested at a current debian system (Kernel 2.6.8, glibc
2.3.2).
It contains only the changes at scponly.c. The setup_chroot.sh shell
script should probably changed to create a .unison directory with write
permissions for the chrooted user at the root directory of the chroot
environment.
Best regards,
Martin Werthmoeller
--
LWsystems - IT-Service and Consulting
mw at lw-systems.de * http://www.lw-systems.de
-------------- next part --------------
--- scponly.c 2005-12-27 22:55:52.000000000 +0100
+++ scponly.c_mw 2006-01-07 17:53:49.513141746 +0100
@@ -579,6 +579,23 @@
if (valid_arg_vector(av))
{
+/**
+ * Unison needs the HOME environment variable be set to the directory
+ * where the .unison directory resides.
+ */
+#ifdef UNISON_COMPAT
+ if (chrooted)
+ {
+ if (setenv("HOME","/",1))
+ {
+ syslog(LOG_ERR, "could not set HOME environment variable(%s))", logstamp());
+ exit(EXIT_FAILURE);
+ }
+ if (debuglevel)
+ syslog(LOG_DEBUG, "set HOME environment variable to /", homedir, logstamp());
+ }
+#endif
+
#ifdef USE_SAFE_ENVIRONMENT
safeenv[0] = NULL;
filter_allowed_env_vars();
More information about the scponly
mailing list