-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-44440: Collect config and logs in bugreport
- Loading branch information
Showing
8 changed files
with
248 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[common] | ||
enabled=yes | ||
debug_log=yes | ||
|
||
[snmpd] | ||
v2c=yes | ||
v3=yes | ||
|
||
[snmpd_v2c] | ||
community=snmpv2cpublic | ||
|
||
[snmpd_v3] | ||
security_name=test123 | ||
authentication_passphrase=******** | ||
authentication_protocol=SHA | ||
privacy_passphrase=******** | ||
privacy_protocol=AES | ||
|
||
engine_id=0x80001f88800fceda7f01824c6500000000 | ||
|
||
[snmpd_v3_internal] | ||
name_key="test123" | ||
security_name_key="test123" | ||
authentication_key=0xsnmpv3authenticationkey | ||
authentication_protocol_oid=.1.3.6.1.6.3.10.1.1.3 | ||
privacy_key=0xsnmpv3privacykey | ||
privacy_protocol_oid=.1.3.6.1.6.3.10.1.2.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
############################################################################### | ||
# Access Control | ||
############################################################################### | ||
|
||
# As shipped, the snmpd demon will only respond to queries on the | ||
# system mib group until this file is replaced or modified for | ||
# security purposes. | ||
|
||
#### | ||
# First, map the community name "public" into a "security name" | ||
|
||
#<user> sec.name source community | ||
rouser test123 authPriv | ||
com2sec notConfigUser default snmpv2community | ||
|
||
#### | ||
# Second, map the security name into a group name: | ||
|
||
#<group> groupName securityModel securityName | ||
group group2 usm test123 | ||
group group1 v2c notConfigUser | ||
|
||
#### | ||
# Third, create a view for us to let the group have rights to: | ||
|
||
# name incl/excl subtree mask(optional) | ||
view systemview included .1 | ||
view systemview included system | ||
view systemview included interfaces | ||
view systemview included at | ||
view systemview included ip | ||
view systemview included icmp | ||
view systemview included tcp | ||
view systemview included udp | ||
view systemview included snmp | ||
view systemview included xenserver | ||
|
||
#### | ||
# XenServer control domain does not support IPv6. | ||
# | ||
view systemview excluded ipv6InterfaceTableLastChange | ||
view systemview excluded icmpStatsInErrors.ipv6 | ||
view systemview excluded icmpStatsInMsgs.ipv6 | ||
view systemview excluded icmpStatsOutErrors.ipv6 | ||
view systemview excluded icmpStatsOutMsgs.ipv6 | ||
view systemview excluded icmpMsgStatsInPkts.ipv6 | ||
view systemview excluded icmpMsgStatsOutPkts.ipv6 | ||
|
||
#### | ||
# Finally, grant the group read-only access to the systemview view. | ||
|
||
#<access> group context sec.model sec.level prefix read write notif | ||
access group2 "" any priv exact systemview none none | ||
access group1 "" any noauth exact systemview none none | ||
|
||
############################################################################### | ||
# Extension of dynamically loadable object | ||
|
||
#<module> moduleName soPath | ||
dlmod xenserver /usr/lib64/xs_snmp_agent.so | ||
|
||
############################################################################### | ||
# System contact information | ||
# | ||
|
||
syslocation Unknown | ||
syscontact Root <root@localhost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# snmpd command line options | ||
# '-f' is implicitly added by snmpd systemd unit file | ||
# OPTIONS="-LS0-6d" | ||
OPTIONS="-c /etc/snmp/snmpd.xs.conf -m +XENSERVER-MIB -Dxenserver -LS0-7d" |
55 changes: 55 additions & 0 deletions
55
tests/integration/dom0-template/var/lib/net-snmp/snmpd.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# net-snmp (or ucd-snmp) persistent data file. | ||
# | ||
############################################################################ | ||
# STOP STOP STOP STOP STOP STOP STOP STOP STOP | ||
# | ||
# **** DO NOT EDIT THIS FILE **** | ||
# | ||
# STOP STOP STOP STOP STOP STOP STOP STOP STOP | ||
############################################################################ | ||
# | ||
# DO NOT STORE CONFIGURATION ENTRIES HERE. | ||
# Please save normal configuration tokens for snmpd in /etc/snmp/snmpd.conf. | ||
# Only "createUser" tokens should be placed here by snmpd administrators. | ||
# (Did I mention: do not edit this file?) | ||
# | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
usmUser 1 3 0x80001f88800fceda7f01824c6500000000 "test123" "test123" NULL .1.3.6.1.6.3.10.1.1.3 0xsnmpv3authenticationkey .1.3.6.1.6.3.10.1.2.4 0xsnmpv3privacykey "" | ||
############################################################## | ||
# | ||
# ifXTable persistent data | ||
# | ||
ifXTable .1 14:0 18:0x $ | ||
ifXTable .2 14:0 18:0x $ | ||
ifXTable .3 14:0 18:0x $ | ||
ifXTable .4 14:0 18:0x $ | ||
ifXTable .5 14:0 18:0x $ | ||
ifXTable .6 14:0 18:0x $ | ||
############################################################## | ||
|
||
|
||
setserialno 1853241089 | ||
############################################################## | ||
# | ||
# snmpNotifyFilterTable persistent data | ||
# | ||
############################################################## | ||
|
||
|
||
engineBoots 3 | ||
oldEngineID 0x80001f88800fceda7f01824c6500000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
# This test is expected to be run as root in a container(docker, podman, toolbox, apptainer, (s)chroot): | ||
# It is currently started from .github/workflows/alpine-python2.yml | ||
# Precondition: python with all dependencies from requirements.txt is installed | ||
# WARNING: This is running as user root in the container it runs in! | ||
# | ||
# A quick way to run it is: | ||
# act -W .github/workflows/alpine-python2.yml | ||
# | ||
# exit on any error | ||
set -o errexit | ||
set -o pipefail | ||
if [[ -n "$TRACE" ]]; then set -o xtrace; fi | ||
set -o nounset | ||
: ${PYTHON:=python2} | ||
|
||
# Prepare test container: Mock the files used by this test | ||
cp -a tests/integration/dom0-template/* / | ||
|
||
# Enter a clean test environment | ||
SRCDIR=$PWD | ||
rm -rf .tmp/tests/snmp | ||
mkdir -p .tmp/tests/snmp | ||
cd .tmp/tests/snmp | ||
export PYTHONPATH=~-/tests/mocks | ||
|
||
# Check that mocking xen.lowlevel.xc works for this test | ||
$PYTHON -c "from xen.lowlevel.xc import Error, xc;xc().domain_getinfo()" | ||
|
||
# Run xen-bugtool --entries=xenserver-config to capture the SNMP files | ||
export XENRT_BUGTOOL_BASENAME=zip | ||
$PYTHON ~-/xen-bugtool -y --entries=xenserver-config --output=zip | ||
unzip -o -d. /var/opt/xen/bug-report/zip.zip | ||
|
||
cd $XENRT_BUGTOOL_BASENAME | ||
|
||
# Check filename entries in inventory.xml (in case a tool expects them): | ||
grep -q \ | ||
-e "filename=\"$XENRT_BUGTOOL_BASENAME/snmp_xs_conf.out\"" \ | ||
-e "filename=\"$XENRT_BUGTOOL_BASENAME/snmpd_xs_conf.out\"" \ | ||
-e "filename=\"$XENRT_BUGTOOL_BASENAME/snmpd_conf.out\"" \ | ||
-e "filename=\"$XENRT_BUGTOOL_BASENAME/etc/sysconfig/snmpd\"" \ | ||
inventory.xml | ||
|
||
# Check that snmp_xs_conf.out should not contain community or keys | ||
snmp_xs_conf_filter_str=$(grep 'snmpv2cpublic\|0xsnmpv3authenticationkey\|0xsnmpv3privacykey' /code/status-report/.tmp/tests/snmp/tar/snmp_xs_conf.out || true) | ||
if [ "$snmp_xs_conf_filter_str" != "" ]; then | ||
exit 5 | ||
fi | ||
|
||
# Check that snmpd_xs_conf.out should not contain community | ||
snmpd_xs_conf_filter_str=$(grep snmpv2cpublic /code/status-report/.tmp/tests/snmp/tar/snmpd_xs_conf.out || true) | ||
if [ "$snmpd_xs_conf_filter_str" != "" ]; then | ||
exit 5 | ||
fi | ||
|
||
# Check that snmpd.conf.out should not contain keys | ||
snmpd_conf_filter_str=$(grep '0xsnmpv3authenticationkey\|0xsnmpv3privacykey' /code/status-report/.tmp/tests/snmp/tar/snmpd_conf.out || true) | ||
if [ "$snmpd_conf_filter_str" != "" ]; then | ||
exit 5 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters