SSH (Secure Shell) is a method Jenkins uses to connect to an agent by securely logging into the agent machine over the network using a username and password or SSH keys.
Click to reveal answer
beginner
What does JNLP stand for and how does it work in Jenkins?
JNLP stands for Java Network Launch Protocol. Jenkins agents use JNLP to connect by running a Java program on the agent machine that connects back to the Jenkins controller.
Click to reveal answer
intermediate
Which Jenkins agent connection method requires the agent to initiate the connection?
JNLP requires the agent to initiate the connection to the Jenkins controller, which is useful when the agent is behind a firewall or NAT.
Click to reveal answer
intermediate
What are the security benefits of using SSH for Jenkins agents?
SSH provides encrypted communication and strong authentication using keys or passwords, reducing the risk of unauthorized access to the agent machine.
Click to reveal answer
intermediate
When might you prefer JNLP over SSH for Jenkins agent connection?
You might prefer JNLP when the agent cannot accept incoming connections due to firewall restrictions or when you want the agent to connect to the controller on its own schedule.
Click to reveal answer
Which Jenkins agent connection method requires the master to connect to the agent?
ANeither SSH nor JNLP
BJNLP
CBoth SSH and JNLP
DSSH
✗ Incorrect
SSH requires the Jenkins controller to connect to the agent machine, while JNLP agents connect back to the controller.
What protocol does JNLP use to launch the Jenkins agent?
AJava Network Launch Protocol
BFTP
CHTTP
DSSH
✗ Incorrect
JNLP stands for Java Network Launch Protocol, which is used to start the Jenkins agent as a Java application.
Which method is better if the agent is behind a strict firewall blocking incoming connections?
ABoth are equally good
BSSH
CJNLP
DNeither works
✗ Incorrect
JNLP agents initiate the connection to the controller, so they work better behind firewalls blocking incoming connections.
What is a common authentication method used by SSH for Jenkins agents?
AUsername and password
BBoth A and C
CSSH keys
DNo authentication
✗ Incorrect
SSH supports both username/password and SSH key authentication for secure access.
Which Jenkins agent connection method requires Java to be installed on the agent machine?
AJNLP
BSSH
CBoth SSH and JNLP
DNeither
✗ Incorrect
JNLP agents run a Java program on the agent machine, so Java must be installed.
Explain the differences between SSH and JNLP agent connection methods in Jenkins.
Think about who initiates the connection and what protocols are used.
You got /5 concepts.
Describe scenarios where you would choose JNLP over SSH for Jenkins agent connection.
Consider network restrictions and agent environment.
You got /4 concepts.
Practice
(1/5)
1. Which statement correctly describes the difference between SSH and JNLP agent connection methods in Jenkins?
easy
A. SSH agents connect by Jenkins initiating the connection; JNLP agents connect by the agent initiating the connection.
B. JNLP agents connect by Jenkins initiating the connection; SSH agents connect by the agent initiating the connection.
C. Both SSH and JNLP agents require Jenkins to initiate the connection.
D. Both SSH and JNLP agents require the agent to initiate the connection.
Solution
Step 1: Understand SSH agent connection
SSH agents connect by Jenkins server initiating an SSH connection to the agent machine.
Step 2: Understand JNLP agent connection
JNLP agents connect by the agent itself initiating a connection back to the Jenkins server.
Final Answer:
SSH agents connect by Jenkins initiating the connection; JNLP agents connect by the agent initiating the connection. -> Option A
Hint: SSH agent setup needs hostname, credentials, and directory [OK]
Common Mistakes:
Skipping SSH credentials in configuration
Confusing JNLP secret with SSH setup
Providing incomplete connection details
3. Given a Jenkins agent configured with JNLP, what will happen if the agent machine cannot reach the Jenkins server URL?
medium
A. The agent will connect using SSH fallback automatically.
B. The agent will connect successfully because Jenkins initiates the connection.
C. The agent will fail to connect because it initiates the connection to Jenkins.
D. The Jenkins server will push jobs to the agent regardless.
Solution
Step 1: Understand JNLP connection direction
JNLP agents initiate the connection to the Jenkins server URL, so the agent must reach the server.
Step 2: Analyze network failure impact
If the agent cannot reach the Jenkins server URL, the connection attempt fails and the agent cannot connect.
Final Answer:
The agent will fail to connect because it initiates the connection to Jenkins. -> Option C
Quick Check:
JNLP agent needs network access to Jenkins [OK]
Hint: JNLP agent must reach Jenkins URL to connect [OK]
Common Mistakes:
Assuming Jenkins initiates JNLP connection
Thinking SSH fallback is automatic
Believing Jenkins can push jobs without agent connection
4. You configured an SSH agent in Jenkins but the connection keeps failing with authentication errors. What is the most likely cause?
medium
A. Agent machine cannot reach Jenkins server URL.
B. Incorrect SSH credentials or missing SSH key on the agent machine.
C. JNLP agent secret key is invalid.
D. Jenkins server firewall blocks outgoing SSH connections.
Solution
Step 1: Identify cause of SSH authentication failure
Authentication errors usually mean wrong username/password or missing SSH key on the agent side.
Step 2: Eliminate other options
Agent machine cannot reach Jenkins server URL. relates to JNLP, not SSH. JNLP agent secret key is invalid. is about JNLP secret. Jenkins server firewall blocks outgoing SSH connections. is unlikely as Jenkins initiates SSH outbound.
Final Answer:
Incorrect SSH credentials or missing SSH key on the agent machine. -> Option B
Quick Check:
SSH auth errors = bad credentials or missing key [OK]
Hint: Check SSH credentials and keys first for connection errors [OK]
Common Mistakes:
Confusing JNLP secret with SSH credentials
Ignoring network reachability issues
Assuming firewall blocks inbound SSH to Jenkins
5. You need to connect Jenkins agents located behind strict firewalls that block incoming connections to the agent machines. Which connection method should you choose and why?
hard
A. Use JNLP because agents initiate connections to Jenkins, bypassing firewall restrictions.
B. Use SSH because Jenkins can initiate connections to agents behind firewalls.
C. Use SSH with VPN to bypass firewall restrictions.
D. Use JNLP but disable agent authentication for easier connection.
Solution
Step 1: Analyze firewall impact on connection methods
Firewalls blocking incoming connections to agents prevent Jenkins from initiating SSH connections.