Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(customize) sets permissions in line with Kong install #526

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions customize/packer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,14 @@ fi
%s
%s

# set ownership to kong user/group
find /usr/local/share/lua/5.1/ -type f -exec chown 1000:1000 "{}" +
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gszr maybe this can be changed to chown kong:kong. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about s/1000/id -u/g

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hutchic sorry, didn't get that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of assuming 1000:1000 can we get the uid:gid with the id command?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I tried this:

KUSR=$(id -u kong)
KGRP=$(id -g kong)
find /usr/local/share/lua/5.1/          -type f -exec chown $KUSR:$KGRP "{}" +
find /usr/local/share/lua/5.1/          -type d -exec chown $KUSR:$KGRP "{}" +

But the result is

/usr/local/share/lua/5.1 $ ls -l
total 344
-rw-r--r--    1 kong     nogroup      29426 Dec 15 18:19 MessagePack.lua
-rw-r--r--    1 kong     nogroup       2788 Dec 15 18:19 ansicolors.lua
-rw-r--r--    1 kong     nogroup      12069 Dec 15 18:19 binaryheap.lua
drwxr-xr-x    1 kong     nogroup       4096 Dec 17 19:24 cassandra
-rw-r--r--    1 kong     nogroup      32158 Dec 15 18:19 date.lua
-rw-r--r--    1 kong     nogroup      10591 Dec 15 18:19 etlua.lua
-rw-r--r--    1 kong     nogroup      10167 Dec 15 18:19 ffi-zlib.lua
-rw-r--r--    1 kong     nogroup       9543 Dec 15 18:19 inspect.lua

Which I find weird, originally it was;

/usr/local/share/lua/5.1 $ ls -l
total 296
-rw-r--r--    1 1000     1000         29426 Dec 15 18:19 MessagePack.lua
-rw-r--r--    1 1000     1000          2788 Dec 15 18:19 ansicolors.lua
-rw-r--r--    1 1000     1000         12069 Dec 15 18:19 binaryheap.lua
drwxr-xr-x    2 1000     1000          4096 Dec 17 19:24 cassandra
-rw-r--r--    1 1000     1000         32158 Dec 15 18:19 date.lua
-rw-r--r--    1 1000     1000         10591 Dec 15 18:19 etlua.lua
-rw-r--r--    1 1000     1000         10167 Dec 15 18:19 ffi-zlib.lua
-rw-r--r--    1 1000     1000          9543 Dec 15 18:19 inspect.lua

Using the id command on alpine gives me this:

/usr/local/share/lua/5.1 $ id -u kong
100
/usr/local/share/lua/5.1 $ id -g kong
65533

Not sure where we do it, but seems we set the ownership to 1000:1000, and not to kong:kong in the original docker builds.

So how should this customize behave?

find /usr/local/share/lua/5.1/ -type d -exec chown 1000:1000 "{}" +
find /usr/local/lib/lua/5.1/ -type f -exec chown 1000:1000 "{}" +
find /usr/local/lib/lua/5.1/ -type d -exec chown 1000:1000 "{}" +
find /usr/local/lib/luarocks/rocks-5.1/ -type f -exec chown 1000:1000 "{}" +
find /usr/local/lib/luarocks/rocks-5.1/ -type d -exec chown 1000:1000 "{}" +

# clean up by deleting all the temporary stuff
rm -rf /plugins
]=]
Expand Down