CompTIA XK0-006 (CompTIA Linux+) Practice Test 33

Question 320

Log files must rotate by size or schedule and old generations should be compressed. Which tool is designed for this?

  1. journalctl --since '1 hour ago'
  2. logrotate
  3. aureport
  4. auditd

Explanation

Correct Answer

B:

logrotate applies per-log policies for rotation, retention and optional compression. Services may need reopen signals when file handles change.

Incorrect Answers

A:

journalctl queries stored systemd journal entries and supports time, unit and priority filters; the requirement is rotating and retaining service log files, outside the effect of this choice.

C:

aureport aggregates stored audit events into categories and counts; the evidence calls for rotating and retaining service log files, not merely this separate operation.

D:

auditd receives Linux audit-subsystem events according to configured rules; the task involves rotating and retaining service log files, whereas this addresses another subsystem.

Question 321

A team needs evidence of which administrator executed a privileged operation and when. Which security function does that represent?

  1. Kerberos authentication
  2. Accounting and audit logging
  3. Polkit
  4. SSSD

Explanation

Correct Answer

B:

Accounting records actions and associated identities for later review. Such records complement authentication and access enforcement but are not substitutes for them.

Incorrect Answers

A:

Kerberos uses tickets from a trusted key distribution center to authenticate principals to services; that is not equivalent to recording attributable user activity.

C:

Polkit mediates policy-based authorization for privileged actions requested by unprivileged processes; it answers a neighboring question rather than recording attributable user activity.

D:

The System Security Services Daemon integrates supported identity providers and can cache identity and credentials according to policy; that changes a different part of the system; the requested outcome is recording attributable user activity.

Question 322

The monthly report requires summarized counts of audited authentication-related activity. Which audit utility produces reports?

  1. rsyslog
  2. aureport
  3. ausearch
  4. logrotate

Explanation

Correct Answer

B:

aureport aggregates stored audit events into categories and counts. It relies on the quality and completeness of audit rules and retained logs.

Incorrect Answers

A:

rsyslog processes syslog messages, applies routing rules and can forward them across the network; it will not provide summarizing audit events for reporting under these conditions.

C:

ausearch queries audit records using identifiers and filters; the requirement is summarizing audit events for reporting, outside the effect of this choice.

D:

logrotate applies per-log policies for rotation, retention and optional compression; it does not deliver summarizing audit events for reporting, which is decisive in this scenario.

Question 323

A gateway should translate internal client source addresses to its own public address for outbound internet sessions. Which function is required?

  1. Destination NAT (DNAT)
  2. DNAT with destination-port rewrite
  3. Port Address Translation (PAT)
  4. Source NAT (SNAT)
  5. Stateless packet filtering

Explanation

Correct Answer

D:

SNAT rewrites packet source addresses for egress traffic and tracks return mappings. Masquerading is a common variant for changing external addresses.

Incorrect Answers

A:

DNAT rewrites the destination address or port before forwarding to the intended private service; the task involves rewriting private outbound source addresses, whereas this addresses another subsystem.

B:

Destination NAT can change both destination address and service port as packets enter the gateway; its scope differs from rewriting private outbound source addresses, so it cannot meet the stated requirement.

C:

PAT multiplexes connections through one public address by adjusting transport ports as needed; that is not equivalent to rewriting private outbound source addresses.

E:

Stateless filtering evaluates each packet against rules independently of flow history; it answers a neighboring question rather than rewriting private outbound source addresses.

Question 324

A Linux firewall configuration should use nftables' native rule language and sets rather than the iptables compatibility interface. Which engine is appropriate?

  1. nftables
  2. iptables -A INPUT ...
  3. ufw status numbered
  4. Conntrack state match

Explanation

Correct Answer

A:

nftables is a modern Netfilter ruleset framework supporting tables, chains, sets and state matching. It operates in the Linux networking stack.

Incorrect Answers

B:

iptables manipulates the traditional chain/rule abstraction, possibly through an nft backend on modern distributions; this does not achieve managing native nftables firewall objects on the system described.

C:

UFW can list configured rules with stable display numbers for the current listing; it will not provide managing native nftables firewall objects under these conditions.

D:

Netfilter connection tracking recognizes flows such as established and related traffic; using it would leave managing native nftables firewall objects unresolved.

Question 325

A UFW operator must see numbered active firewall rules before deleting one. Which command provides them?

  1. iptables -A INPUT ...
  2. nftables
  3. ipset or nftables set
  4. ufw status numbered
  5. ufw allow 443/tcp
  6. Conntrack state match

Explanation

Correct Answer

D:

UFW can list configured rules with stable display numbers for the current listing. Number references can shift after changes.

Incorrect Answers

A:

iptables manipulates the traditional chain/rule abstraction, possibly through an nft backend on modern distributions; it does not deliver enumerating UFW rules with deletion indices, which is decisive in this scenario.

B:

nftables is a modern Netfilter ruleset framework supporting tables, chains, sets and state matching; the evidence calls for enumerating UFW rules with deletion indices, not merely this separate operation.

C:

Address sets allow a rule to test membership in many IP values efficiently; the task involves enumerating UFW rules with deletion indices, whereas this addresses another subsystem.

E:

UFW provides a simplified frontend to host firewall rules; that is not equivalent to enumerating UFW rules with deletion indices.

F:

Netfilter connection tracking recognizes flows such as established and related traffic; the administrator instead needs enumerating UFW rules with deletion indices; this option serves a different purpose.

Question 326

A one-time test should allow a port in the current firewalld runtime but not after reload. Which approach fits?

  1. Firewalld zones
  2. firewall-cmd --add-port=8443/tcp
  3. firewall-cmd --permanent --add-service=ssh
  4. firewall-cmd --zone=public --list-all

Explanation

Correct Answer

B:

A runtime command modifies active rules without changing permanent configuration. Reloading firewalld discards runtime-only changes.

Incorrect Answers

A:

Zones associate interfaces or sources with collections of allowed services and ports; the administrator instead needs opening a temporary runtime firewall port; this option serves a different purpose.

C:

The permanent flag changes saved zone configuration rather than only the current runtime; that changes a different part of the system; the requested outcome is opening a temporary runtime firewall port.

D:

The list-all view reports the chosen zone's ports, services, interfaces and sources; this does not achieve opening a temporary runtime firewall port on the system described.

Question 327

A known service such as HTTPS must be allowed by its predefined firewalld definition. Which operation expresses that intent?

  1. firewall-cmd --add-service=https
  2. firewall-cmd --permanent --add-service=ssh
  3. firewall-cmd --zone=public --list-all
  4. Firewalld zones

Explanation

Correct Answer

A:

Adding a service uses firewalld's defined port/protocol mapping for that service. This can be clearer than manually maintaining its numeric port.

Incorrect Answers

B:

The permanent flag changes saved zone configuration rather than only the current runtime; the requirement is allowing a named service using firewalld definitions, outside the effect of this choice.

C:

The list-all view reports the chosen zone's ports, services, interfaces and sources; it does not deliver allowing a named service using firewalld definitions, which is decisive in this scenario.

D:

Zones associate interfaces or sources with collections of allowed services and ports; the evidence calls for allowing a named service using firewalld definitions, not merely this separate operation.

Question 328

A Linux gateway receives a dynamically assigned public IPv4 address from its ISP. Private LAN clients need source NAT, but the administrator must not hard-code a public IP that could change. Which nftables NAT statement is appropriate?

  1. masquerade
  2. snat to 198.51.100.10
  3. dnat to 10.0.0.5
  4. redirect to :3128
  5. ct state established

Explanation

Correct Answer

A:

The nftables masquerade statement performs source NAT using the address of the selected outgoing interface. It is suited to gateways whose external address can change.

Incorrect Answers

B:

A literal snat address fixes the translated source IP to a specific value. That becomes stale when the ISP changes the gateway address.

C:

dnat rewrites the packet destination, most commonly for inbound forwarding. The gateway instead needs a source-address rewrite for outbound clients.

D:

redirect rewrites the destination to a local address or port for transparent local interception; it does not substitute for outbound source masquerading.

E:

A connection-tracking state expression matches packets belonging to existing flows. The match alone never rewrites a source IP address.

Question 329

An interface is moved from a trusted LAN to an untrusted external segment. Which firewalld concept can apply a different policy set?

  1. Firewalld zones
  2. firewall-cmd --add-service=https
  3. Firewalld rich rule with source address
  4. firewall-cmd --add-port=8443/tcp

Explanation

Correct Answer

A:

Zones associate interfaces or sources with collections of allowed services and ports. Correct zone assignment is critical for effective policy.

Incorrect Answers

B:

Adding a service uses firewalld's defined port/protocol mapping for that service; it will not provide selecting rules according to interface trust level under these conditions.

C:

Rich rules combine conditions such as source address and service with actions; using it would leave selecting rules according to interface trust level unresolved.

D:

A runtime command modifies active rules without changing permanent configuration; the requirement is selecting rules according to interface trust level, outside the effect of this choice.

Question 330

A firewall should allow packets based solely on addresses and port fields, without remembering previous connections. Which model describes it?

  1. Stateless packet filtering
  2. Destination NAT (DNAT)
  3. SNAT on egress
  4. DNAT with destination-port rewrite
  5. Source NAT (SNAT)

Explanation

Correct Answer

A:

Stateless filtering evaluates each packet against rules independently of flow history. Stateful policy uses connection-tracking context to recognize return traffic.

Incorrect Answers

B:

DNAT rewrites the destination address or port before forwarding to the intended private service; the task involves evaluating packets without connection history, whereas this addresses another subsystem.

C:

Egress SNAT changes the source information so replies can be routed back through the translating gateway; its scope differs from evaluating packets without connection history, so it cannot meet the stated requirement.

D:

Destination NAT can change both destination address and service port as packets enter the gateway; that is not equivalent to evaluating packets without connection history.

E:

SNAT rewrites packet source addresses for egress traffic and tracks return mappings; the administrator instead needs evaluating packets without connection history; this option serves a different purpose.

CompTIA Linux+ (XK0-006) Practice Tests