Question 340
A Linux gateway runs a local transparent HTTP proxy on port 3128. Incoming TCP requests addressed to port 80 should be intercepted by that gateway itself, without a separate destination server address. Which nftables NAT statement fits?
- redirect to :3128
- masquerade
- snat to 198.51.100.10
- ct state established
- drop
Explanation
Correct Answer
A:The nftables redirect statement changes the destination to a local socket on the gateway. In an appropriate NAT chain matching TCP port 80, it can deliver traffic to the local proxy on port 3128.
Incorrect Answers
B:Masquerading changes the source address for outbound NAT traffic. It does not move inbound HTTP traffic to a different local listener port.
C:Static source NAT changes where a packet appears to originate. It leaves the requested local destination-port interception unimplemented.
D:Connection-state matching classifies an existing flow but does not perform destination translation. It cannot redirect new inbound requests to the local proxy.
E:A drop verdict silently discards matching packets. The request is to deliver HTTP requests to the proxy, not block them.
Question 341
A firewalld administrator has tested several runtime-only rules, confirmed they are correct, and now wants to copy the active runtime configuration into the permanent configuration without re-entering each rule. Which command does that?
- firewall-cmd --runtime-to-permanent
- firewall-cmd --reload
- firewall-cmd --get-active-zones
- firewall-cmd --add-service=https
- ufw reload
Explanation
Correct Answer
A:The runtime-to-permanent operation saves the active runtime firewalld configuration as its persistent configuration. Those rules can then survive a daemon reload or host reboot.
Incorrect Answers
B:Reloading firewalld applies the already-saved permanent configuration and can discard unsaved runtime changes. It does not persist the tested runtime rules.
C:This read-only command reports which zones are active and which interfaces or sources use them. It does not copy rule definitions into permanent storage.
D:Without the permanent flag, add-service modifies the runtime allowance for one service. It neither copies the full runtime configuration nor commits prior changes.
E:UFW is a different firewall configuration frontend. Reloading its rules cannot persist the active firewalld runtime configuration.
Question 342
An existing legacy script manages filter-chain rules with iptables commands. Which interface does it use?
- nftables
- ipset or nftables set
- iptables -A INPUT ...
- Conntrack state match
Explanation
Correct Answer
C:iptables manipulates the traditional chain/rule abstraction, possibly through an nft backend on modern distributions. It is different from direct native nft syntax.
Incorrect Answers
A:nftables is a modern Netfilter ruleset framework supporting tables, chains, sets and state matching; the evidence calls for appending a legacy-style INPUT filter rule, not merely this separate operation.
B:Address sets allow a rule to test membership in many IP values efficiently; the task involves appending a legacy-style INPUT filter rule, whereas this addresses another subsystem.
D:Netfilter connection tracking recognizes flows such as established and related traffic; that is not equivalent to appending a legacy-style INPUT filter rule.
Question 343
A Debian server has UFW enabled and must permit incoming TCP port 443. Which command is suitable?
- ufw allow 443/tcp
- iptables -A INPUT ...
- ipset or nftables set
- ufw status numbered
- nftables
Explanation
Correct Answer
A:UFW provides a simplified frontend to host firewall rules. Allowing TCP 443 still requires the web service to listen on that port.
Incorrect Answers
B:iptables manipulates the traditional chain/rule abstraction, possibly through an nft backend on modern distributions; that changes a different part of the system; the requested outcome is permitting inbound HTTPS with UFW.
C:Address sets allow a rule to test membership in many IP values efficiently; this does not achieve permitting inbound HTTPS with UFW on the system described.
D:UFW can list configured rules with stable display numbers for the current listing; it will not provide permitting inbound HTTPS with UFW under these conditions.
E:nftables is a modern Netfilter ruleset framework supporting tables, chains, sets and state matching; using it would leave permitting inbound HTTPS with UFW unresolved.
Question 344
A shared directory should cause newly created files to inherit its group ownership under normal conditions. Which special directory bit helps?
- umask 027
- getfacl project/
- chmod 640 secrets.txt
- setgid bit on the directory
Explanation
Correct Answer
D:A directory's setgid bit causes created entries to inherit the directory group on standard Linux filesystems. This is useful for collaboration areas.
Incorrect Answers
A:Applying umask 027 to default file permissions 666 yields 640; the requirement is inheriting a directory's group ownership, outside the effect of this choice.
B:getfacl displays ACL entries, including defaults when present; it does not deliver inheriting a directory's group ownership, which is decisive in this scenario.
C:Octal 640 maps to owner rw, group r and no permission for others; the evidence calls for inheriting a directory's group ownership, not merely this separate operation.
Question 345
A support workflow requires switching to another user's login environment with that identity's password or root authorization. Which command fits?
- NOEXEC sudoers tag
- Command-specific sudoers grant
- su - targetuser
- NOPASSWD sudoers tag
Explanation
Correct Answer
C:su - starts a login shell for the target identity and resets relevant environment values. Authentication and permissions differ from sudo delegation.
Incorrect Answers
A:NOEXEC can prevent some dynamically linked child-process execution paths under supported conditions; that is not equivalent to changing to another user's login session context.
B:Restricting the allowed executable and argument scope helps implement least privilege; the administrator instead needs changing to another user's login session context; this option serves a different purpose.
D:NOPASSWD suppresses the password challenge for matched sudo commands; that changes a different part of the system; the requested outcome is changing to another user's login session context.
Question 346
An administrator wants to examine both access and default ACLs on a directory. Which command lists them?
- getfacl project/
- chattr +i settings.conf
- chown serviceuser:web file
- setuid bit on an executable
Explanation
Correct Answer
A:getfacl displays ACL entries, including defaults when present. It helps diagnose access that ordinary ls permission bits do not fully express.
Incorrect Answers
B:The immutable attribute blocks common changes, renames and deletion until removed by a sufficiently privileged actor; using it would leave inspecting extended file access-control entries unresolved.
C:chown can update both user and group ownership for a file; the requirement is inspecting extended file access-control entries, outside the effect of this choice.
D:setuid changes the effective user ID of an executed program to its file owner's ID on supported filesystems; it does not deliver inspecting extended file access-control entries, which is decisive in this scenario.
Question 347
During diagnosis, the host should log SELinux denials without actively blocking them, temporarily. Which mode fits?
- semanage fcontext -a -t httpd_sys_content_t '/srv/site(/.*)?'
- SELinux permissive mode
- restorecon -Rv /srv/site
- sealert
Explanation
Correct Answer
B:Permissive mode records would-be access denials but generally does not enforce blocking for them. It should not be mistaken for permanent policy repair.
Incorrect Answers
A:semanage fcontext records persistent path-to-context mappings; the task involves observing denials without enforcing SELinux policy, whereas this addresses another subsystem.
C:restorecon applies the previously configured path-based SELinux contexts to existing files; that is not equivalent to observing denials without enforcing SELinux policy.
D:sealert analyzes SELinux denial events and suggests possible causes or remediation paths; the administrator instead needs observing denials without enforcing SELinux policy; this option serves a different purpose.
Question 348
A new file should default to no permissions for others, while allowing owner rw and group r with a usual 666 base. Which umask works?
- chattr +i settings.conf
- chmod 640 secrets.txt
- umask 027
- chown serviceuser:web file
Explanation
Correct Answer
C:Applying umask 027 to default file permissions 666 yields 640. Directory defaults derive from 777 and become 750.
Incorrect Answers
A:The immutable attribute blocks common changes, renames and deletion until removed by a sufficiently privileged actor; that changes a different part of the system; the requested outcome is producing secure default file permission masks.
B:Octal 640 maps to owner rw, group r and no permission for others; this does not achieve producing secure default file permission masks on the system described.
D:chown can update both user and group ownership for a file; using it would leave producing secure default file permission masks unresolved.
Question 349
A file currently owned by alice must become owned by serviceuser and group web. Which operation performs both?
- chown serviceuser:web file
- setgid bit on the directory
- getfacl project/
- chattr +i settings.conf
- setfacl -m u:bob:r-x project/
Explanation
Correct Answer
A:chown can update both user and group ownership for a file. Membership and discretionary permissions still determine who may access it.
Incorrect Answers
B:A directory's setgid bit causes created entries to inherit the directory group on standard Linux filesystems; the evidence calls for changing file owner and group atomically, not merely this separate operation.
C:getfacl displays ACL entries, including defaults when present; the task involves changing file owner and group atomically, whereas this addresses another subsystem.
D:The immutable attribute blocks common changes, renames and deletion until removed by a sufficiently privileged actor; its scope differs from changing file owner and group atomically, so it cannot meet the stated requirement.
E:setfacl adds or modifies named access-control-list entries beyond classic owner/group/other permissions; that is not equivalent to changing file owner and group atomically.
Question 350
A service account requires a narrow sudo policy stored separately from the global file. Which directory supports include-style policy fragments?
- /etc/sudoers.d
- Command-specific sudoers grant
- sudo -i
- NOEXEC sudoers tag
Explanation
Correct Answer
A:sudo can read controlled policy fragments from sudoers.d where configured. Ownership, permissions and validation are essential for safe delegation.
Incorrect Answers
B:Restricting the allowed executable and argument scope helps implement least privilege; it answers a neighboring question rather than storing modular sudo authorization rules.
C:sudo -i starts a login-style shell as the target user, commonly root, after sudo authorization; that changes a different part of the system; the requested outcome is storing modular sudo authorization rules.
D:NOEXEC can prevent some dynamically linked child-process execution paths under supported conditions; this does not achieve storing modular sudo authorization rules on the system described.