X7ROOT File Manager
Current Path:
/usr/lib/python3.6/site-packages/sos/report/plugins
usr
/
lib
/
python3.6
/
site-packages
/
sos
/
report
/
plugins
/
📁
..
📄
__init__.py
(138.51 KB)
📁
__pycache__
📄
aap_containerized.py
(5.04 KB)
📄
aap_controller.py
(3.15 KB)
📄
aap_eda.py
(2.16 KB)
📄
aap_gateway.py
(1.71 KB)
📄
aap_hub.py
(1.31 KB)
📄
aap_receptor.py
(1.85 KB)
📄
abrt.py
(1.51 KB)
📄
acpid.py
(917 B)
📄
activemq.py
(1.65 KB)
📄
aide.py
(1.41 KB)
📄
alternatives.py
(2.27 KB)
📄
anaconda.py
(1.46 KB)
📄
anacron.py
(782 B)
📄
ansible.py
(1.08 KB)
📄
apache.py
(6 KB)
📄
apparmor.py
(1.05 KB)
📄
apport.py
(1.37 KB)
📄
apt.py
(1.73 KB)
📄
arcconf.py
(2.17 KB)
📄
ata.py
(1016 B)
📄
auditd.py
(1.83 KB)
📄
authd.py
(2.2 KB)
📄
autofs.py
(2.77 KB)
📄
azure.py
(2.37 KB)
📄
bcache.py
(2.2 KB)
📄
bird.py
(2.41 KB)
📄
block.py
(2.44 KB)
📄
boom.py
(1.05 KB)
📄
boot.py
(1.99 KB)
📄
bootc.py
(940 B)
📄
btrfs.py
(739 B)
📄
buildah.py
(1.82 KB)
📄
candlepin.py
(5.84 KB)
📄
canonical_livepatch.py
(1.04 KB)
📄
canonical_livepatch_onprem.py
(1.22 KB)
📄
ceph_ansible.py
(956 B)
📄
ceph_common.py
(6.83 KB)
📄
ceph_iscsi.py
(1.55 KB)
📄
ceph_mds.py
(4.15 KB)
📄
ceph_mgr.py
(5.92 KB)
📄
ceph_mon.py
(9.82 KB)
📄
ceph_osd.py
(5.27 KB)
📄
ceph_rgw.py
(4.51 KB)
📄
cgroups.py
(1.39 KB)
📄
charmed_mysql.py
(5.23 KB)
📄
charmed_postgresql.py
(6.05 KB)
📄
chrony.py
(1.84 KB)
📄
cifs.py
(962 B)
📄
clear_containers.py
(2.58 KB)
📄
cloud_init.py
(1.07 KB)
📄
cman.py
(1.78 KB)
📄
cobbler.py
(1.29 KB)
📄
cockpit.py
(968 B)
📄
collectd.py
(2.24 KB)
📄
collectl.py
(752 B)
📄
composer.py
(2.11 KB)
📄
conntrack.py
(2.37 KB)
📄
console.py
(869 B)
📄
container_log.py
(1.54 KB)
📄
containerd.py
(1.37 KB)
📄
containers_common.py
(2.64 KB)
📄
convert2rhel.py
(1.04 KB)
📄
coredump.py
(5.14 KB)
📄
corosync.py
(2.41 KB)
📄
crio.py
(3.38 KB)
📄
cron.py
(1.01 KB)
📄
crypto.py
(1.38 KB)
📄
cs.py
(4.5 KB)
📄
ctdb.py
(1.42 KB)
📄
cups.py
(3.08 KB)
📄
curtin.py
(1.74 KB)
📄
cxl.py
(1.32 KB)
📄
date.py
(867 B)
📄
dbus.py
(877 B)
📄
dellrac.py
(1.69 KB)
📄
devicemapper.py
(1.13 KB)
📄
devices.py
(740 B)
📄
dhcp.py
(1.03 KB)
📄
discovery.py
(1.15 KB)
📄
distupgrade.py
(1.51 KB)
📄
dlm.py
(1.52 KB)
📄
dmraid.py
(1.29 KB)
📄
dnf.py
(5.42 KB)
📄
docker.py
(5.08 KB)
📄
docker_distribution.py
(1.3 KB)
📄
dovecot.py
(1007 B)
📄
dpkg.py
(1.16 KB)
📄
dracut.py
(942 B)
📄
drbd.py
(955 B)
📄
ds.py
(3.6 KB)
📄
ebpf.py
(3.11 KB)
📄
elastic.py
(2.5 KB)
📄
etcd.py
(2.14 KB)
📄
fail2ban.py
(830 B)
📄
fapolicyd.py
(1.34 KB)
📄
fcoe.py
(1018 B)
📄
fibrechannel.py
(1.77 KB)
📄
filesys.py
(3.81 KB)
📄
firewall_tables.py
(5.07 KB)
📄
firewalld.py
(1.95 KB)
📄
flatpak.py
(1.29 KB)
📄
foreman.py
(15.24 KB)
📄
foreman_installer.py
(3.86 KB)
📄
foreman_openscap.py
(830 B)
📄
foreman_proxy.py
(2.19 KB)
📄
freeipmi.py
(896 B)
📄
frr.py
(1.79 KB)
📄
fwupd.py
(1.41 KB)
📄
gcp.py
(5.38 KB)
📄
gdm.py
(735 B)
📄
gfs2.py
(1.36 KB)
📄
gluster.py
(4.34 KB)
📄
gluster_block.py
(1.07 KB)
📄
grafana.py
(2.01 KB)
📄
greenboot.py
(905 B)
📄
grub.py
(988 B)
📄
grub2.py
(2.81 KB)
📄
gssproxy.py
(823 B)
📄
haproxy.py
(2.41 KB)
📄
hardware.py
(1.13 KB)
📄
helm.py
(1.14 KB)
📄
host.py
(1.74 KB)
📄
hpasm.py
(898 B)
📄
hpssm.py
(2.65 KB)
📄
hts.py
(700 B)
📄
hyperv.py
(886 B)
📄
i18n.py
(774 B)
📄
infiniband.py
(2.66 KB)
📄
infinidat.py
(1.38 KB)
📄
insights.py
(2.49 KB)
📄
instructlab.py
(5.45 KB)
📄
ipa.py
(7.36 KB)
📄
ipmitool.py
(1.53 KB)
📄
iprconfig.py
(4.53 KB)
📄
ipvs.py
(1.04 KB)
📄
iscsi.py
(2.15 KB)
📄
iscsitarget.py
(1.25 KB)
📄
jars.py
(5.39 KB)
📄
java.py
(978 B)
📄
juju.py
(8.03 KB)
📄
kafka.py
(2.07 KB)
📄
kata_containers.py
(1.34 KB)
📄
kdump.py
(5.63 KB)
📄
kea.py
(1.37 KB)
📄
keepalived.py
(855 B)
📄
kernel.py
(5.85 KB)
📄
kernelrt.py
(1.66 KB)
📄
keyutils.py
(894 B)
📄
kimchi.py
(1009 B)
📄
kpatch.py
(1.02 KB)
📄
krb5.py
(2.88 KB)
📄
kubernetes.py
(12.45 KB)
📄
kvm.py
(954 B)
📄
landscape.py
(3.17 KB)
📄
ldap.py
(2.99 KB)
📄
leapp.py
(1.49 KB)
📄
libraries.py
(1.56 KB)
📄
libreswan.py
(2.47 KB)
📄
libvirt.py
(3.76 KB)
📄
lightdm.py
(1.11 KB)
📄
lilo.py
(716 B)
📄
login.py
(1.06 KB)
📄
logrotate.py
(1.24 KB)
📄
logs.py
(3.92 KB)
📄
lstopo.py
(1.2 KB)
📄
lustre.py
(2.86 KB)
📄
lvm2.py
(4.6 KB)
📄
lxd.py
(4.31 KB)
📄
maas.py
(5.07 KB)
📄
manageiq.py
(2.86 KB)
📄
md.py
(1.22 KB)
📄
megacli.py
(1.01 KB)
📄
mellanox_firmware.py
(4.7 KB)
📄
memcached.py
(1.58 KB)
📄
memory.py
(1.44 KB)
📄
microcloud.py
(2.72 KB)
📄
microk8s.py
(4.38 KB)
📄
microovn.py
(3.23 KB)
📄
microshift.py
(6.96 KB)
📄
microshift_ovn.py
(1.69 KB)
📄
migration_results.py
(637 B)
📄
mongodb.py
(4.14 KB)
📄
monit.py
(1.68 KB)
📄
mpt.py
(732 B)
📄
mssql.py
(3.29 KB)
📄
multipath.py
(1011 B)
📄
mvcli.py
(1003 B)
📄
mysql.py
(4.44 KB)
📄
named.py
(2.5 KB)
📄
navicli.py
(2.47 KB)
📄
networking.py
(14.36 KB)
📄
networkmanager.py
(5.04 KB)
📄
nfs.py
(1.32 KB)
📄
nfsganesha.py
(1.2 KB)
📄
nginx.py
(1.53 KB)
📄
nis.py
(812 B)
📄
nodejs.py
(1.18 KB)
📄
npm.py
(2.06 KB)
📄
nscd.py
(989 B)
📄
nss.py
(885 B)
📄
ntb.py
(937 B)
📄
ntp.py
(1.41 KB)
📄
numa.py
(1.46 KB)
📄
nvidia.py
(1.82 KB)
📄
nvme.py
(1.71 KB)
📄
nvmetcli.py
(977 B)
📄
oddjob.py
(871 B)
📄
omnipath_client.py
(1.92 KB)
📄
omnipath_manager.py
(2.38 KB)
📄
omsa.py
(1.64 KB)
📄
opencl.py
(692 B)
📄
opencontrail.py
(1.35 KB)
📄
opendaylight.py
(1.38 KB)
📄
opengl.py
(694 B)
📄
openhpi.py
(878 B)
📄
openshift.py
(16.88 KB)
📄
openshift_ovn.py
(2.61 KB)
📄
openssl.py
(1.4 KB)
📄
openstack_ansible.py
(1.31 KB)
📄
openstack_aodh.py
(3.93 KB)
📄
openstack_barbican.py
(1.76 KB)
📄
openstack_ceilometer.py
(3.24 KB)
📄
openstack_cinder.py
(6.84 KB)
📄
openstack_database.py
(2.47 KB)
📄
openstack_designate.py
(3.58 KB)
📄
openstack_edpm.py
(1.45 KB)
📄
openstack_glance.py
(4.67 KB)
📄
openstack_gnocchi.py
(4.27 KB)
📄
openstack_heat.py
(5.34 KB)
📄
openstack_horizon.py
(3.37 KB)
📄
openstack_instack.py
(5.98 KB)
📄
openstack_ironic.py
(8.28 KB)
📄
openstack_keystone.py
(4.9 KB)
📄
openstack_manila.py
(3.68 KB)
📄
openstack_masakari.py
(2.08 KB)
📄
openstack_masakarimonitors.py
(1.5 KB)
📄
openstack_mistral.py
(1.6 KB)
📄
openstack_neutron.py
(6.29 KB)
📄
openstack_nova.py
(8.75 KB)
📄
openstack_novajoin.py
(1.15 KB)
📄
openstack_octavia.py
(5.16 KB)
📄
openstack_placement.py
(5.01 KB)
📄
openstack_sahara.py
(2.67 KB)
📄
openstack_swift.py
(2.95 KB)
📄
openstack_tripleo.py
(1.62 KB)
📄
openstack_trove.py
(2.26 KB)
📄
opensvc.py
(3.39 KB)
📄
openvswitch.py
(17.47 KB)
📄
oratab.py
(1.92 KB)
📄
origin.py
(8.57 KB)
📄
os_net_config.py
(800 B)
📄
ostree.py
(1.05 KB)
📄
ovirt.py
(9.44 KB)
📄
ovirt_engine_backup.py
(1.72 KB)
📄
ovirt_hosted_engine.py
(2.16 KB)
📄
ovirt_imageio.py
(1.56 KB)
📄
ovirt_node.py
(1.62 KB)
📄
ovirt_provider_ovn.py
(1.16 KB)
📄
ovn_central.py
(9.86 KB)
📄
ovn_host.py
(3.32 KB)
📄
pacemaker.py
(5.81 KB)
📄
pam.py
(1.37 KB)
📄
pci.py
(1.35 KB)
📄
pcp.py
(6.05 KB)
📄
perccli.py
(1.81 KB)
📄
perccli2.py
(1.82 KB)
📄
peripety.py
(1.19 KB)
📄
perl.py
(662 B)
📄
pmem.py
(3.34 KB)
📄
podman.py
(5.49 KB)
📄
postfix.py
(4.32 KB)
📄
postgresql.py
(4.36 KB)
📄
powerpath.py
(1.82 KB)
📄
powerpc.py
(4.22 KB)
📄
ppp.py
(848 B)
📄
procenv.py
(710 B)
📄
process.py
(4.29 KB)
📄
processor.py
(2.56 KB)
📄
proxmox.py
(2.98 KB)
📄
psacct.py
(1.29 KB)
📄
ptp.py
(892 B)
📄
pulp.py
(7.66 KB)
📄
pulpcore.py
(7.8 KB)
📄
pulseaudio.py
(1.56 KB)
📄
puppet.py
(2.26 KB)
📄
pxe.py
(1.39 KB)
📄
python.py
(3.79 KB)
📄
qaucli.py
(1.35 KB)
📄
qpid.py
(3.53 KB)
📄
qpid_dispatch.py
(2.19 KB)
📄
qt.py
(809 B)
📄
quagga.py
(755 B)
📄
rabbitmq.py
(2.73 KB)
📄
radius.py
(1.34 KB)
📄
rasdaemon.py
(994 B)
📄
rear.py
(1.31 KB)
📄
redis.py
(1.6 KB)
📄
release.py
(1.2 KB)
📄
rhc.py
(2.02 KB)
📄
rhcos.py
(1.36 KB)
📄
rhui.py
(2.27 KB)
📄
rhv_analyzer.py
(941 B)
📄
rpm.py
(2.34 KB)
📄
rpmostree.py
(1.12 KB)
📄
ruby.py
(813 B)
📄
s390.py
(2.38 KB)
📄
salt.py
(2.14 KB)
📄
saltmaster.py
(2.26 KB)
📄
samba.py
(1.79 KB)
📄
sanlock.py
(1000 B)
📄
saphana.py
(2.52 KB)
📄
sapnw.py
(5.03 KB)
📄
sar.py
(3.95 KB)
📄
sas3ircu.py
(1.3 KB)
📄
scsi.py
(2.4 KB)
📄
seagate_ses.py
(2.1 KB)
📄
sedutil.py
(1.7 KB)
📄
selinux.py
(2.02 KB)
📄
sendmail.py
(1.18 KB)
📄
services.py
(1.43 KB)
📄
shmcli.py
(4.21 KB)
📄
skydive.py
(2.28 KB)
📄
slurm.py
(3.75 KB)
📄
smartcard.py
(1.49 KB)
📄
smclient.py
(1.89 KB)
📄
snap.py
(2.99 KB)
📄
snapper.py
(741 B)
📄
snmp.py
(903 B)
📄
sos_extras.py
(3.74 KB)
📄
soundcard.py
(980 B)
📄
squid.py
(1.25 KB)
📄
ssh.py
(3.73 KB)
📄
ssmtp.py
(976 B)
📄
sssd.py
(2.33 KB)
📄
storageconsole.py
(1.66 KB)
📄
storcli.py
(1.8 KB)
📄
stratis.py
(1.12 KB)
📄
subscription_manager.py
(5.55 KB)
📄
sudo.py
(1.48 KB)
📄
sunbeam.py
(6.89 KB)
📄
sunbeam_hypervisor.py
(3.73 KB)
📄
sunrpc.py
(818 B)
📄
symcli.py
(3.46 KB)
📄
system.py
(1.67 KB)
📄
systemd.py
(3.68 KB)
📄
systemtap.py
(881 B)
📄
sysvipc.py
(886 B)
📄
targetcli.py
(1.12 KB)
📄
teamd.py
(1.24 KB)
📄
telegraf.py
(1.68 KB)
📄
tftpserver.py
(879 B)
📄
tigervnc.py
(1.67 KB)
📄
tomcat.py
(2.08 KB)
📄
tpm2.py
(989 B)
📄
tuned.py
(1.17 KB)
📄
ubuntu.py
(2.23 KB)
📄
udev.py
(900 B)
📄
udisks.py
(804 B)
📄
ufw.py
(987 B)
📄
ultrapath.py
(1.3 KB)
📄
unbound.py
(899 B)
📄
unity.py
(703 B)
📄
unpackaged.py
(3.48 KB)
📄
usb.py
(731 B)
📄
usbguard.py
(813 B)
📄
validation_framework.py
(1.5 KB)
📄
valkey.py
(1.72 KB)
📄
vault.py
(1.74 KB)
📄
vdo.py
(2.27 KB)
📄
vdsm.py
(5.05 KB)
📄
vectordev.py
(1.2 KB)
📄
veritas.py
(1.33 KB)
📄
vhostmd.py
(1.71 KB)
📄
virsh.py
(4.42 KB)
📄
virtwho.py
(985 B)
📄
vmware.py
(1.74 KB)
📄
vsftpd.py
(724 B)
📄
vulkan.py
(700 B)
📄
watchdog.py
(2.89 KB)
📄
wireless.py
(886 B)
📄
x11.py
(1.38 KB)
📄
xdp.py
(659 B)
📄
xen.py
(3.32 KB)
📄
xfs.py
(1.34 KB)
📄
xinetd.py
(837 B)
📄
zfs.py
(1.91 KB)
📄
zvm.py
(2.76 KB)
Editing: networking.py
# This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU General Public License. # # See the LICENSE file in the source distribution for further information. from sos.report.plugins import (Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin, SoSPredicate, PluginOpt) from sos.policies.distros.ubuntu import UbuntuPolicy from sos.policies.distros.debian import DebianPolicy class Networking(Plugin): short_desc = 'Network and networking devices configuration' plugin_name = "networking" profiles = ('network', 'hardware', 'system') trace_host = "www.example.com" option_list = [ PluginOpt("traceroute", default=False, desc=f"collect a traceroute to {trace_host}"), PluginOpt("namespace-pattern", default="", val_type=str, desc=("Specific namespace names or patterns to collect, " "whitespace delimited.")), PluginOpt("namespaces", default=None, val_type=int, desc="Number of namespaces to collect, 0 for unlimited"), PluginOpt("ethtool-namespaces", default=True, desc=("Toggle if ethtool commands should be run for each " "namespace")), PluginOpt("eepromdump", default=False, desc="Toggle collection of 'ethtool -e' for NICs") ] # switch to enable netstat "wide" (non-truncated) output mode ns_wide = "-W" # list of kernel modules needed by ss_cmd, this may vary by distro version ss_kmods = ['tcp_diag', 'udp_diag', 'inet_diag', 'unix_diag', 'netlink_diag', 'af_packet_diag', 'xsk_diag'] # list of ethtool short options, used in add_copy_spec and add_cmd_tags # do NOT add there "e" (see eepromdump plugopt) ethtool_shortopts = "acdgiklmPST" def setup(self): super().setup() self.add_file_tags({ '/proc/net/bonding/bond.*': 'bond', '/etc/hosts': 'hosts' }) self.add_copy_spec([ "/etc/dnsmasq*", "/etc/host*", "/etc/inetd.conf", "/etc/iproute2", "/etc/network*", "/etc/nsswitch.conf", "/etc/resolv.conf", "/etc/xinetd.conf", "/etc/xinetd.d", "/etc/yp.conf", "/proc/net/", "/sys/class/net/*/device/numa_node", "/sys/class/net/*/flags", "/sys/class/net/*/statistics/", "/etc/nmstate/", "/var/lib/lldpad/", ]) self.add_forbidden_path([ "/proc/net/rpc/use-gss-proxy", "/proc/net/rpc/*/channel", "/proc/net/rpc/*/flush", # Cisco CDP "/proc/net/cdp", "/sys/net/cdp", # Dialogic Diva "/proc/net/eicon" ]) self.add_cmd_output("ip -o addr", root_symlink="ip_addr", tags='ip_addr') self.add_cmd_output("ip route show table all", root_symlink="ip_route", tags=['ip_route', 'iproute_show_table_all']) self.add_cmd_output("plotnetcfg") self.add_cmd_output(f"netstat {self.ns_wide} -neopa", root_symlink="netstat") self.add_cmd_output([ "nstat -zas", "netstat -s", "netstat -s -6", f"netstat {self.ns_wide} -agn", "networkctl status -a", "ip -6 route show table all", "ip -d route show cache", "ip -d -6 route show cache", "ip -4 rule list", "ip -6 rule list", "ip vrf show", "ip -s -d link", "ip -d address", "ifenslave -a", "ip mroute show", "ip maddr show", "ip -s -s neigh show", "ip neigh show nud noarp", "biosdevname -d", "tc -s qdisc show", "nmstatectl show", "nmstatectl show --running-config", ]) if self.path_isdir('/sys/class/devlink'): self.add_cmd_output([ "devlink dev param show", "devlink dev info", "devlink port show", "devlink sb show", "devlink sb pool show", "devlink sb port pool show", "devlink sb tc bind show", "devlink -s -v trap show", ]) devlinks = self.collect_cmd_output("devlink dev") if devlinks['status'] == 0: devlinks_list = devlinks['output'].splitlines() for devlink in devlinks_list: self.add_cmd_output([ f"devlink dev eswitch show {devlink}", f"devlink sb occupancy snapshot {devlink}", f"devlink sb occupancy show {devlink}", f"devlink -v resource show {devlink}" ]) dev_tables = [] dpipe = self.collect_cmd_output( f"devlink dpipe table show {devlink}" ) if dpipe['status'] == 0: for tableln in dpipe['output'].splitlines(): if tableln.startswith('name'): dev_tables.append(tableln.split()[1]) self.add_cmd_output([ f"devlink dpipe table show {devlink} name {dname}" for dname in dev_tables ]) # below commands require some kernel module(s) to be loaded # run them only if the modules are loaded, or if explicitly requested # via --allow-system-changes option ip_macsec_show_cmd = "ip -s macsec show" macsec_pred = SoSPredicate(self, kmods=['macsec']) self.add_cmd_output(ip_macsec_show_cmd, pred=macsec_pred, changes=True) self.collect_ss_ip_ethtool_info() self.collect_bridge_info() def add_command_tags(self): """ Command tags for ip/ethtool/netstat """ for opt in self.ethtool_shortopts: self.add_cmd_tags({ f'ethtool -{opt} .*': f'ethool_{opt}' }) self.add_cmd_tags({ "ethtool [^-].*": "ethtool", "ip -d address": "ip_addr", "ip -s -s neigh show": "ip_neigh_show", "ip -s -d link": "ip_s_link", "netstat.*-neopa": "netstat", "netstat.*-agn": "netstat_agn", "netstat -s": "netstat_s" }) def collect_bridge_info(self): """ Collect information about bridges (some data already collected via "ip .." commands) """ self.add_cmd_output([ "bridge -s -s -d link show", "bridge -s -s -d -t fdb show", "bridge -s -s -d -t mdb show", "bridge -d vlan show" ]) def collect_ss_ip_ethtool_info(self): """ Collect ss, ip and ethtool cmd outputs """ ss_cmd = "ss -peaonmi" ss_pred = SoSPredicate(self, kmods=self.ss_kmods, required={'kmods': 'all'}) self.add_cmd_output(ss_cmd, pred=ss_pred, changes=True) self.add_cmd_output("ss -s") # Get ethtool output for every device that does not exist in a # namespace. _ecmds = [f"ethtool -{opt}" for opt in self.ethtool_shortopts] self.add_device_cmd([ _cmd + " %(dev)s" for _cmd in _ecmds ], devices='ethernet') self.add_device_cmd([ "ethtool %(dev)s", "ethtool --phy-statistics %(dev)s", "ethtool --show-priv-flags %(dev)s", "ethtool --show-eee %(dev)s", "ethtool --show-fec %(dev)s", "ethtool --show-ntuple %(dev)s", "tc -s filter show dev %(dev)s", "tc -s filter show dev %(dev)s ingress", ], devices="ethernet") # skip EEPROM collection by default, as it might hang or # negatively impact the system on some device types if self.get_option("eepromdump"): cmd = "ethtool -e %(dev)s" self._log_warn("WARNING: collecting an eeprom dump is known to " "cause certain NIC drivers (e.g. bnx2x/tg3) to " "interrupt device operation") self.add_device_cmd(cmd, devices="ethernet") if self.get_option("traceroute"): self.add_cmd_output(f"/bin/traceroute -n {self.trace_host}", priority=100) # Capture additional data from namespaces; each command is run # per-namespace. self.add_cmd_output("ip netns") cmd_prefix = "ip netns exec " namespaces = self.get_network_namespaces( self.get_option("namespace-pattern"), self.get_option("namespaces")) if namespaces: # 'ip netns exec <foo> iptables-save' must be guarded by nf_tables # kmod, if 'iptables -V' output contains 'nf_tables' # analogously for ip6tables cout = {'cmd': 'iptables -V', 'output': 'nf_tables'} co6 = {'cmd': 'ip6tables -V', 'output': 'nf_tables'} iptables_with_nft = (SoSPredicate(self, kmods=['nf_tables']) if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=cout)) else None) ip6tables_with_nft = (SoSPredicate(self, kmods=['nf_tables']) if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=co6)) else None) for namespace in namespaces: _devs = self.devices['namespaced_network'][namespace] _subdir = f"namespaces/{namespace}" ns_cmd_prefix = cmd_prefix + namespace + " " self.add_cmd_output([ f"{ns_cmd_prefix} ip -d address show", f"{ns_cmd_prefix} ip route show table all", f"{ns_cmd_prefix} ip -s -s neigh show", f"{ns_cmd_prefix} ip -4 rule list", f"{ns_cmd_prefix} ip -6 rule list", f"{ns_cmd_prefix} ip vrf show", f"{ns_cmd_prefix} sysctl -a", f"{ns_cmd_prefix} netstat {self.ns_wide} -neopa", f"{ns_cmd_prefix} netstat -s", f"{ns_cmd_prefix} netstat {self.ns_wide} -agn", f"{ns_cmd_prefix} nstat -zas", ], priority=50, subdir=_subdir) self.add_cmd_output([ns_cmd_prefix + "iptables-save"], pred=iptables_with_nft, subdir=_subdir, priority=50) self.add_cmd_output([ns_cmd_prefix + "ip6tables-save"], pred=ip6tables_with_nft, subdir=_subdir, priority=50) ss_cmd = ns_cmd_prefix + "ss -peaonmi" # --allow-system-changes is handled directly in predicate # evaluation, so plugin code does not need to separately # check for it self.add_cmd_output(ss_cmd, pred=ss_pred, subdir=_subdir) # Collect ethtool commands only when ethtool_namespaces # is set to true. if self.get_option("ethtool-namespaces"): # Devices that exist in a namespace use less ethtool # parameters. Run this per namespace. self.add_device_cmd([ f"{ns_cmd_prefix} ethtool %(dev)s", f"{ns_cmd_prefix} ethtool -i %(dev)s", f"{ns_cmd_prefix} ethtool -k %(dev)s", f"{ns_cmd_prefix} ethtool -S %(dev)s", f"{ns_cmd_prefix} ethtool -m %(dev)s" ], devices=_devs['ethernet'], priority=50, subdir=_subdir) self.add_command_tags() class RedHatNetworking(Networking, RedHatPlugin): trace_host = "rhn.redhat.com" def setup(self): # Handle change from -T to -W in Red Hat netstat 2.0 and greater. try: netstat_pkg = self.policy.package_manager.pkg_by_name('net-tools') # major version if int(netstat_pkg['version'][0]) < 2: self.ns_wide = "-T" except Exception: # pylint: disable=broad-except # default to upstream option pass super().setup() def postproc(self): self.do_path_regex_sub( "/etc/nmstate", r"(\s+(mka-cak|private-key-password|psk|password):).*", r"\1 ******" ) class UbuntuNetworking(Networking, UbuntuPlugin, DebianPlugin): trace_host = "archive.ubuntu.com" def setup(self): common_ss_kmods = ['af_packet_diag', 'inet_diag', 'mptcp_diag', 'netlink_diag', 'raw_diag', 'tcp_diag', 'udp_diag', 'unix_diag'] if (isinstance(self.policy, UbuntuPolicy) and self.policy.dist_version() >= 22.04): self.ss_kmods = common_ss_kmods + ['xsk_diag'] elif (isinstance(self.policy, DebianPolicy) and self.policy.dist_version() >= 13): self.ss_kmods = common_ss_kmods + ['vsock_diag'] super().setup() self.add_copy_spec([ "/etc/netplan/*.yaml", "/etc/network/interfaces", "/etc/network/interfaces.d", "/etc/resolv.conf", "/etc/resolvconf", "/lib/netplan/*.yaml", "/run/netplan/*.yaml", "/run/systemd/network" ]) # Netplan only consumes files with the `.yaml` extension (LP#1815734), # so give visibility on other files that might be present. self.add_dir_listing([ "/etc/netplan", "/lib/netplan", "/run/netplan", ]) def postproc(self): self.do_path_regex_sub( "/etc/netplan", r"(\s+password:).*", r"\1 ******" ) # vim: set et ts=4 sw=4 :
Upload File
Create Folder