-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[build_templates] [hostcfgd] Keep containers hostname up to date #2924
[build_templates] [hostcfgd] Keep containers hostname up to date #2924
Conversation
@@ -153,6 +180,7 @@ start() { | |||
{%- endif %} | |||
--tmpfs /tmp \ | |||
--tmpfs /var/tmp \ | |||
--hostname $HOSTNAME \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$HOSTNAME [](start = 19, length = 9)
Possible input injection #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still possible. For example:
sonichost"; rm -rf /; echo "
In reply to: 286279985 [](ancestors = 286279985)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash did not process metacharacters from variables only metacharacters directly present in a script or interpreter line.
It is easy to check by the next commands:
print_args() {
while (( "$#" )); do
echo $1
shift
done
}
X="hostName"
Y='sonic"; echo injection; echo "'
print_args --hostname "$X" --name cname
#output
>>> --hostname
hostName
--name
cname
print_args --hostname "$Y" --name cname
#output
>>> --hostname
sonic"; echo injection; echo "
--name
cname
I thought that CVE-2016-0634 can be exploited there. But sonic use bash 4.4
So, for any case added validation for allowed characters in a hostname. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft Could we close this conversation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice comments! Really appreciate the clarification and reference.
In reply to: 286898693 [](ancestors = 286898693)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
a1ac6f2
to
07ddbb8
Compare
Review comments fixed |
8778f17
to
95dcf85
Compare
Please use a standard commit message format:
e.g. [image config] Keep containers hostname up to date |
95dcf85
to
1856544
Compare
* Add updateHostName function to docker_image_ctl.j2 * Add hostname specification on container creating step * Add listener for hostname changes in hostcfgd Signed-off-by: Myron Sosyak <msosyak@barefootnetworks.com>
1856544
to
5ff6ca3
Compare
5ff6ca3
to
fbbe144
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix typo in log message per comment above.
Signed-off-by: Myron Sosyak <msosyak@barefootnetworks.com>
fbbe144
to
574f237
Compare
Retest this please |
…lly (#16785) #### Why I did it src/sonic-swss ``` * b9313df0 - (HEAD -> master, origin/master, origin/HEAD) Reducing the severity of oper fec attribute get failure (#2924) (89 minutes ago) [Sudharsan Dhamal Gopalarathnam] * cb98893f - Add support for SEND_TO_INGRESS port table. (#2816) (19 hours ago) [Yilan Ji] * 966c5bb0 - [Dash] Fix wrong table name for acl_out_table (#2911) (2 days ago) [Ze Gan] * 35996350 - [FEC]Auto FEC initial changes (#2893) (8 days ago) [Sudharsan Dhamal Gopalarathnam] ``` #### How I did it #### How to verify it #### Description for the changelog
- What I did
Implemented logic to keep containers hostname up to date
- How I did it
- How to verify it
Change hostname in config_db.json
Load new configuration
Check hostname in containers
- Description for the changelog
Added logic to keep containers hostname up to date
@akokhan @pyadvichuk @vsenchyshyn @qiluo-msft @jleveque @lguohan