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

t3c will ensure config files are owned by ats #6880

Merged
merged 14 commits into from
Jun 10, 2022

Conversation

jpappa200
Copy link
Contributor

Closes: #6879


Which Traffic Control components are affected by this PR?

  • Traffic Control Cache Config (t3c, formerly ORT)

What is the best way to verify this PR?

Build and install rpm, change file owner and group on some config files, queue updates on the cache, run t3c apply in syncds or badass, and verify owner and group have been set back to ats.

PR submission checklist

@ocket8888 ocket8888 changed the title t3c will insure config files are owned by ats t3c will ensure config files are owned by ats Jun 4, 2022
@ocket8888 ocket8888 added low impact affects only a small portion of a CDN, and cannot itself break one cache-config Cache config generation improvement The functionality exists but it could be improved in some way. labels Jun 4, 2022
@ocket8888
Copy link
Contributor

To test this I made a copy of t3c-diff's README, but it doesn't seem to detect that it doesn't have the right owner:

$ stat ./README.md 
  File: ./README.md
  Size: 3471      	Blocks: 8          IO Block: 4096   regular file
Device: 10303h/66307d	Inode: 17697181    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ocket8888)   Gid: ( 1000/ocket8888)
Access: 2022-06-08 12:55:22.414520586 -0600
Modify: 2022-06-08 12:55:22.414520586 -0600
Change: 2022-06-08 12:55:22.414520586 -0600
 Birth: 2022-06-08 12:55:22.414520586 -0600
$ ./t3c-diff -l '<!--' -m 0664 -u 0 -g 0 -a ./README.md -b ./README.new.md
$ echo $?
0

@jpappa200
Copy link
Contributor Author

the default value if left blank is 0
uid := getopt.IntLong("file-uid", 'u', 0, "User id the file being checked should have, default is running process's uid")
gid := getopt.IntLong("file-gid", 'g', 0, "Group id the file being checked should have, default is running process's gid")

if the value is 0 it will use the running process's uid/gid
if *uid == 0 { *uid = os.Geteuid() }
if *gid == 0 { *gid = os.Getgid() }
If you ran it as root it would find the difference. I could change the default value but it seemed logical to say that only the root user could say it should be owned by root.

@ocket8888 ocket8888 merged commit b1d5b73 into apache:master Jun 10, 2022
zrhoffman pushed a commit to zrhoffman/trafficcontrol that referenced this pull request Oct 2, 2022
* Added option for uid and gid values and checks

* added uid/gid to command and diff func

* added gid/uid to diff func

* added func for ownership check

* added change log entry for t3c diff

* should not be part of this branch

* added uid and gid to usage string

* fixed typo

* fixed formatting error

* added missing variables and flags

* running process's uid/gid will be used by defalut

* fixed formatting error.

* made changes to the help text and removed extraneous space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache-config Cache config generation improvement The functionality exists but it could be improved in some way. low impact affects only a small portion of a CDN, and cannot itself break one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

t3c should maintain onwer/group settings on config files
3 participants