| Summary: | /etc/rc deletes /var/run/log by mistake, problem for syslogd running outside of chroot jails | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | zenin <zenin> | ||||
| Component: | conf | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | CC: | zenin | ||||
| Priority: | Normal | ||||||
| Version: | 4.10-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
State Changed From-To: open->closed I fixed this issue in revision 1.8 of src/etc/rc.d/cleanvar: revision 1.8 date: 2005/04/14 03:56:06; author: csjp; state: Exp; lines: +2 -0 Do not remove logging sockets. This fixes an issue where logging sockets placed into prisons from the host environment get clobbered by the prison's instance of cleanvar. (assuming /etc/rc is run in the prison). Discussed with: pjd, green, cperciva MFC after: 1 week |
While special care was taken in the syslogd initialization section of /etc/rc to refrain from deleting the log socket /var/run/log unless "syslogd_enable" was set to YES, this effort is for not as /etc/rc then goes on to run "clean_var" which deletes everything without consideration including this log socket. In a standard configuration this doesn't really matter, however when /etc/rc is started as a jailed virtual system it can be a problem. The FreeBSD syslogd has a -l option to create additional log socket files explicitly so they may be placed inside of chroot jail environments. When one attempts to use this feature of syslogd this minor bug then becomes critical. Attached is a patch of the changes I made to /etc/rc. It's an ugly kludge, but it does go the extra mile to do the right thing. Namely it modifies the "pergedir" function to handle /var/run/log as a special case, IFF two other conditions are met: syslogd_enable is not YES and we are inside a jailed environment. I'm possitive a better solution could be found, but it would likely involve far more structural changes to /etc/rc. Consider this patch an example; a cleaner solution should probably be sought for general consumption. How-To-Repeat: Create a standard full jail environment following the directions outlined in jail(8). Configure the jail's /etc/rc.conf so that syslogd_enable is set to NO. Restart the host syslogd with the additional option: -l /path_to_my_jail/var/run/log Confirm /path_to_my_jail/var/run/log has been created. Start the jail as jail(8) describes, eg: jail /path_to_my_jail/var/run/log testhostname 192.168.11.100 /bin/sh /etc/rc Note that /path_to_my_jail/var/run/log has been deleted.