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

Add mariner 1.0 to DCR v2 #2517

Merged
merged 5 commits into from
Feb 24, 2022

Conversation

kevinclark19a
Copy link
Contributor

Description

This PR adds end-to-end testing for the mariner 1.0 image on the marketplace.


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made

Quality of Code and Contribution Guidelines

# The firewall is enabled by default.
return True
# The firewall is disabled by default.
return False
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As seen with mariner 1.0, when there is no entry in the config file, the agent disables the firewall.

@@ -48,7 +48,7 @@ def check_root_login():
print(root_passwd_line)
root_passwd = root_passwd_line.split(":")[1]

if "!" in root_passwd or "*" in root_passwd:
if any(val in root_passwd for val in ("!", "*", "x")):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mariner 1.0 uses a different syntax to mean the same thing; x is not the result of a hash and therefore root password is disabled. Maybe we want to have a less explicit check here, so that we don't need to keep updating this code? Something to the effect of checking the length of the entry might work (i.e. anything a single character long is not a hash), but I'm not sure. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

why do we need this test at all? what is its equivalent in DCR v1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

My first impression is that we can drop this test. Before doing so, though, could you check if the agent disables root login (maybe during provisioning)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #2517 (9eb4e01) into develop (899a38e) will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2517      +/-   ##
===========================================
+ Coverage    71.91%   71.94%   +0.03%     
===========================================
  Files          101      101              
  Lines        15147    15147              
  Branches      2401     2401              
===========================================
+ Hits         10893    10898       +5     
+ Misses        3773     3771       -2     
+ Partials       481      478       -3     
Impacted Files Coverage Δ
azurelinuxagent/ga/collect_telemetry_events.py 91.43% <0.00%> (+1.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 899a38e...9eb4e01. Read the comment docs.

@@ -234,7 +234,8 @@
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "[variables('osDiskType')]"
}
},
"diskSizeGB": 32
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mariner 1.0 specifies a minimum OS disk as 1GB, which causes our testing to crash with "no space left on disk" if we leave this property blank. This approach does lock in all other distros to the same size; i.e., I believe ubuntu lets you create an 16GB OS disk, so we'd be doubling that size with this. 32GB is the largest minimum of the distros we test, so I went with that.

@@ -11,6 +11,8 @@
set -euxo pipefail

ssh -o "StrictHostKeyChecking no" "$1"@"$2" "sudo tar --exclude='journal/*' --exclude='omsbundle' --exclude='omsagent' --exclude='mdsd' --exclude='scx*' --exclude='*.so' --exclude='*__LinuxDiagnostic__*' --exclude='*.zip' --exclude='*.deb' --exclude='*.rpm' -czf logs-$2.tgz /var/log /var/lib/waagent/ /etc/waagent.conf"
# Some distros do not have "other" permissions (e.g., mariner1.0), add them here.
ssh -o "StrictHostKeyChecking no" "$1"@"$2" "sudo chmod o+rwx logs-$2.tgz"
Copy link
Member

@narrieta narrieta Feb 23, 2022

Choose a reason for hiding this comment

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

why do we need the "other" permission?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The harvest scripts fail without them on mariner; I assume we're using a different user for harvest, but I'm not sure; I'll check and update here.

Copy link
Member

@narrieta narrieta Feb 23, 2022

Choose a reason for hiding this comment

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

we are creating the file using sudo, so the owner would be root... what user is harvest running under? "edp"?

if that is the case, i would just update the comment on line 14 to mention that (or, maybe better, chown the file)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I think you're right; the difference is that mariner defaults new files to more restrictive permissions than other distros. (The call to copy the tar over is the last line of this file).

The equivalent of adding sudo to the harvest command would be using root as the user instead of dcr in the scp command. I think using the root user directly would be less ideal than this chmod, though.

Copy link
Member

Choose a reason for hiding this comment

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

ah, ok, then $1 is the user... yes, probably the chown would be slightly better than a blanket all permissions to all users

@narrieta
Copy link
Member

@kevinclark19a can you post a link to a sample run?

@kevinclark19a
Copy link
Contributor Author

@narrieta, here's the sample run. It has the ETP failures that are on develop.

@narrieta
Copy link
Member

@kevinclark19a run looks good, thanks

nagworld9
nagworld9 previously approved these changes Feb 23, 2022
@@ -12,7 +12,7 @@ set -euxo pipefail

ssh -o "StrictHostKeyChecking no" "$1"@"$2" "sudo tar --exclude='journal/*' --exclude='omsbundle' --exclude='omsagent' --exclude='mdsd' --exclude='scx*' --exclude='*.so' --exclude='*__LinuxDiagnostic__*' --exclude='*.zip' --exclude='*.deb' --exclude='*.rpm' -czf logs-$2.tgz /var/log /var/lib/waagent/ /etc/waagent.conf"
# Some distros do not have "other" permissions (e.g., mariner1.0), add them here.
ssh -o "StrictHostKeyChecking no" "$1"@"$2" "sudo chmod o+rwx logs-$2.tgz"
ssh -o "StrictHostKeyChecking no" "$1"@"$2" "sudo chown $1 logs-$2.tgz"
Copy link
Member

Choose a reason for hiding this comment

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

comment on previous line needs updating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch!

@kevinclark19a kevinclark19a merged commit 3036ae5 into Azure:develop Feb 24, 2022
@kevinclark19a kevinclark19a deleted the add_mariner_dcr_v2 branch March 9, 2022 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants