[syslog-ng] Directory/file create ownership

Szemere, László laszlo.szemere at balabit.com
Fri Mar 2 12:25:28 UTC 2018


Hello Marco,
 I tested the settings with docker, and the following configuration worked
for me.

 Created a test user/group on my *host* machine:

$useradd -M -u 1500 marco


 Started a docker container:

$docker run -it --network=host -v /tmp/marco:/tmp/marco
balabit/syslog-ng-xenial bash



Input:

$cat marco_in.txt
Hello World!


 Configuration:

$cat marco.conf
@version: 3.14

@include "scl.conf"

source s_local {
file(
"/tmp/marco/marco_in.txt"
flags(no-parse)
);
};


destination d_logs {
file(
"/tmp/marco/marco_out.txt"
owner(1500)
group(1500)
perm(0200)
);
};


log {
source(s_local);
destination(d_logs);
};


Running syslog-ng:

root at tp:/tmp/marco# syslog-ng -Fdev -f marco.conf


ls -hal on the host machine:

--w-------  1 marco marco   32 márc   2 13:15 marco_out.txt


Output on the *host*:

$cat marco_out.txt
cat: marco_out.txt: Permission denied


Output on the *host*:

$ sudo cat marco_out.txt
Mar  2 12:15:01 tp Hello World!




Note:
 I used the UID and the GID in the syslog-ng configuration file since there
is no such user/group inside my
 docker container. I also tested a scenario where I use the
username/groupname of the external user, but
 of course in this case I have to create them with the same ID inside my
container. (If I remember correctly
 docker provides some basic mapping between external/internal users, but I
am not sure about it.)


Br,
Laci



On Thu, Mar 1, 2018 at 7:16 PM, Marco Mignone <info at marcomignone.com> wrote:

> Hi all,
> Just to add on this topic, I noticed that when using the docker container
> all the files and folders gets a permission of root:root despite of what's
> in the global config options (I guess because the container by default
> starts with the root user).
>
> Did you have any experience with this and do you know how to allow
> syslog-ng to set the users/groups as per the config options specified?
>
> Thanks and sorry if this is slightly off topic... but not that much in
> effect.
>
> Thanks,
> Marco
>
> ____________________________________________________________
> __________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?
> product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20180302/09308ed5/attachment.html>


More information about the syslog-ng mailing list