You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/06/02 17:10:34 UTC
[GitHub] [trafficcontrol] jpappa200 opened a new pull request, #6880: t3c will insure config files are owned by ats
jpappa200 opened a new pull request, #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880
<!--
Thank you for contributing! Please be sure to read our contribution guidelines: https://github.com/apache/trafficcontrol/blob/master/CONTRIBUTING.md
If this closes or relates to an existing issue, please reference it using one of the following:
Closes: #ISSUE
Related: #ISSUE
If this PR fixes a security vulnerability, DO NOT submit! Instead, contact
the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
guidelines at https://apache.org/security regarding vulnerability disclosure.
-->
Closes: #6879
<!-- **^ Add meaningful description above** --><hr/>
## Which Traffic Control components are affected by this PR?
<!-- Please delete all components from this list that are NOT affected by this PR.
Feel free to add the name of a tool or script that is affected but not on the list.
-->
- Traffic Control Cache Config (`t3c`, formerly ORT)
## What is the best way to verify this PR?
<!-- Please include here ALL the steps necessary to test your PR.
If your PR has tests (and most should), provide the steps needed to run the tests.
If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
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
- [ ] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
- [ ] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
- [x] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] rob05c commented on a diff in pull request #6880: t3c will insure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
rob05c commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r889040461
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
The new flags also need added to t3c-diff/README.md (which also gets transformed into the man page)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#issuecomment-1150285050
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:
```console
$ 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
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r892707353
##########
cache-config/t3c-diff/README.md:
##########
@@ -38,7 +38,7 @@ t3c-diff - Traffic Control Cache Configuration contextual diff tool
# SYNOPSIS
-t3c-diff \<file-a\> \<file-a\>
+t3c-diff \-a \<file-a\> \- b \<file-b\> \-l \<line_comment\> \-m \<file-mode\> \-u \<file-uid\> \-g \<file-gid\>
Review Comment:
There's an extraneous space here between `-` and `b`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] jpappa200 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
jpappa200 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r892734512
##########
cache-config/t3c-diff/README.md:
##########
@@ -58,12 +58,37 @@ If one file exists but the other doesn't, it will always be a diff.
Note this means there may be no diff text printed to stdout but still exit 1 indicating a diff
if the file being created or deleted is semantically empty.
+Mode is file permissions in octal format, default is 0644.
+Line comment is a character that signals the line is a comment, default is #
+
+Uid is the user id of the file's owner, default is running process's uid.
+Gid is the id of the group the file is a member of, default running process's gid.`
+
# OPTIONS
+-a, -\-file-a
+
+ Path to first diff file, can also be stdin.
+
+-b, -\-file-b
+ Path to second diff file, can also be stdin.
+
+-g, -\-file-gid
+ Group id the file being checked should have.
Review Comment:
Updated help text
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] jpappa200 commented on pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
jpappa200 commented on PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#issuecomment-1150323947
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] jpappa200 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
jpappa200 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r892735070
##########
cache-config/t3c-diff/README.md:
##########
@@ -38,7 +38,7 @@ t3c-diff - Traffic Control Cache Configuration contextual diff tool
# SYNOPSIS
-t3c-diff \<file-a\> \<file-a\>
+t3c-diff \-a \<file-a\> \- b \<file-b\> \-l \<line_comment\> \-m \<file-mode\> \-u \<file-uid\> \-g \<file-gid\>
Review Comment:
extraneous space removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r891850590
##########
cache-config/t3c-diff/README.md:
##########
@@ -58,12 +58,37 @@ If one file exists but the other doesn't, it will always be a diff.
Note this means there may be no diff text printed to stdout but still exit 1 indicating a diff
if the file being created or deleted is semantically empty.
+Mode is file permissions in octal format, default is 0644.
+Line comment is a character that signals the line is a comment, default is #
+
+Uid is the user id of the file's owner, default is running process's uid.
+Gid is the id of the group the file is a member of, default running process's gid.`
+
# OPTIONS
+-a, -\-file-a
+
+ Path to first diff file, can also be stdin.
+
+-b, -\-file-b
+ Path to second diff file, can also be stdin.
+
+-g, -\-file-gid
+ Group id the file being checked should have.
Review Comment:
This is a fine description - why not put it in the help text?
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
> default is 0
is no longer accurate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #6880: t3c will insure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r888453853
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
The help text that is the final argument to `getopt.IntLong` should be
> ... the usage message for the option
The default values for options are already automatically printed in the help text output, so the help text needn't include them at all.
Speaking of the default values, though, is `0` really the best default for this? That seems prone to permissions errors when `t3c` isn't running as the root user. Plus, when I run a command-line utility, I don't typically expect it to create anything owned by any user or group besides the user and group that the process running it uses. Maybe the default should be the running process's uid/gid?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] jpappa200 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
jpappa200 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r892734822
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
Updated help text here too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 merged pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
ocket8888 merged PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] rob05c commented on a diff in pull request #6880: t3c will insure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
rob05c commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r889040461
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
The new flag also needs added to t3c-diff/README.md (which also gets transformed into the man page)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] jpappa200 commented on a diff in pull request #6880: t3c will ensure config files are owned by ats
Posted by GitBox <gi...@apache.org>.
jpappa200 commented on code in PR #6880:
URL: https://github.com/apache/trafficcontrol/pull/6880#discussion_r890387927
##########
cache-config/t3c-diff/t3c-diff.go:
##########
@@ -49,6 +49,8 @@ func main() {
version := getopt.BoolLong("version", 'V', "Print version information and exit")
lineComment := getopt.StringLong("line_comment", 'l', "#", "Comment symbol")
mode := getopt.IntLong("file-mode", 'm', 0644, "file mode default is 644")
+ uid := getopt.IntLong("file-uid", 'u', 0, "file uid default is 0")
+ gid := getopt.IntLong("file-gid", 'g', 0, "file gid default is 0")
Review Comment:
README.md has been updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org