How Do You Troubleshoot Puppet Agent with a “Failed to open TCP connection…connection refused port 8140” error?

Problem scenario
You run puppet agent but you get this error:

Error: Could not request certificate: Failed to open TCP connection to puppetmaster.domain.com:8140 (Connection refused – connect(2) for “puppetmaster.domain.com” port 8140)

What do you do?

Solution
Ensure port 8140 is open. Install nmap on a server, and run this command:

nmap -p 8140 puppetmaster.domain.com

If you see this

PORT STATE SERVICE
8140/tcp closed unknown

Then the Puppet Master service is not running.

…

How Do You Troubleshoot the Puppet Problem “Error 500 on SERVER: … Could not find node statement with name ‘default’ or “?

Problem scenario
You run the Puppet agent on a server but you receive this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name ‘default’ or ‘ip-172-31-20-105.us-east-2.compute.internal, ip-172-31-20-105.us-east-2.compute, ip-172-31-20-105.us-east-2, ip-172-31-20-105’ on node ip-172-31-20-105.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

What should you do?

…

How Do You Send an Email via a Postfix Server on Linux with the Command Prompt That Has Multiple Recipients and a Subject?

Problem scenario
You want to send one email to multiple people. You tried separating the email addresses with a comma or semicolon but you received this message: “555 5.5.4 Unsupported option:”

You do not know how to send an email with a subject via the Postfix command prompt. How do you send an email to multiple people with “Re:” content of your choice?

Solution
Prerequisite
You need to have Postfix installed and configured.

…

How Do You Print out Lines of a File One-by-One with No Commas and No Semicolons from a Linux Shell?

Problem scenario
You have a flat file that may have lines that terminate (or end) with semicolons or commas. You want to print one line of this file at a time without commas or semicolons. How do you do this with Linux?

Prerequisite
You have a file named “list” (with no extension) in the same directory as this script below.

Solution
Run this Bash script:

while read list; …

How Do You Automate a telnet Session to Send a Postfix Email on a Linux Server?

Problem scenario
You want to create a script that will send an email from a Linux server. You want it to use telnet. How do you automatically send an email using telnet?

Solution
Prerequisite
Set up Postfix. If you are running SUSE, see this posting. If you are running a RedHat derivative, see this posting.

…

How Do You Configure Linux CentOS 6.x to Accept SSH Connections?

Problem scenario
You try to use PuTTY to connect to a Linux CentOS 6.x server. You get the message “Network error: Connection refused.” What should you do?

Solution
Prerequisite
This assumes that there is no software or hardware firewall blocking port 22. You may want to use nmap or a Windows PowerShell port tester to verify port 22 is open.

…

How Do You Send an Email from a Postfix Email Server with A “Reply-to” Email Address of Your Choosing?

Problem scenario
You are using Linux. You want to send emails from your server directly (e.g., from the command prompt using telnet and helo commands) with a customized “Reply-To” email address. How do you do this so the recipient clicks “reply” the “To:” field will be pre-populated.

Prerequisite
Install Postfix. See one this posting if you are using Linux SUSE;

…

How Do You Troubleshoot “550 5.1.1 johndoe@example.com: Recipient address rejected: User unknown in local recipient table”?

Problem scenario
You are using Postfix. You are trying to send emails directly from the Postfix server. After you use telnet and helo commands, you enter a recipient like this:

rcpt to: johndoe@example.com

But you get this error:

“550 5.1.1 johndoe@example.com: Recipient address rejected: User unknown in local recipient table”

What should you do?

Root cause
If you change the /etc/postfix/main.cf file to have emails use a “reply-to” of example.com,

…