Question:

Our monitoring tool has reported an issue in Stratos Datacenter. One of our app servers has an issue, as its Apache service is not reachable on port 3004 (which is the Apache port). The service itself could be down, the firewall could be at fault, or something else could be causing the issue.

Find the faulty app server and use tools like telnet, ss, curl, etc. to find and fix the issue. Also make sure Apache is reachable from the jump host without compromising any security settings (do not stop or disable the firewall, and do not flush its rules: allow only the Apache port).

Once fixed, Apache must answer on port 3004 on every app server. Test from the jump host with curl http://stapp01:3004, curl http://stapp02:3004 and curl http://stapp03:3004.

Note: Do not change the website content in /var/www/html; fix the cause of the issue instead.


Solution:

# App server 1 not reachable
curl http://stapp01:3004
curl: (7) Failed to connect to stapp01 port 3004: No route to host

# App server 2 reachable
curl http://stapp02:3004
... Getting html page

# App server 3 reachable
curl http://stapp03:3004
... Getting html page

The problem is in App server 1.

# SSH into App server 1
ssh tony@stapp01

# Check for listening applications
sudo ss -tupln
Netid    State     Local Address:Port   Process                                 
tcp      LISTEN    127.0.0.1:3004       users:(("sendmail",pid=27915,fd=4))    
tcp      LISTEN    0.0.0.0:22           users:(("sshd",pid=1564,fd=3))         
tcp      LISTEN    0.0.0.0:8080         users:(("ttyd",pid=60,fd=11))          
tcp      LISTEN    [::]:22              users:(("sshd",pid=1564,fd=4)) 

# Curl the localhost
curl 127.0.0.1:3004
curl: (1) Received HTTP/0.9 when not allowed

We see curl get a reply back saying the application not accept HTTP. Use the curl -v verbose option and send a http0.9 request (to get more information regrading the application listening on port 3004):

curl -v --http0.9 http://127.0.0.1:3004
*   Trying 127.0.0.1:3004...
* Connected to 127.0.0.1 (127.0.0.1) port 3004 (#0)

GET / HTTP/1.1
Host: 127.0.0.1:3004
User-Agent: curl/7.76.1
Accept: */*

220 stapp01.gge5o2lnwdy6itdr.svc.cluster.local ESMTP Sendmail 8.16.1/8.16.1; Tue, 1 Dec 2026 07:12:56 GMT
421 4.7.0 stapp01.gge5o2lnwdy6itdr.svc.cluster.local Rejecting open proxy localhost [127.0.0.1]
* Closing connection 0

This is a SMTP server not running Apache webserver

nc 127.0.0.1 3004
220 stapp01.gge5o2lnwdy6itdr.svc.cluster.local ESMTP Sendmail 8.16.1/8.16.1; Tue, 1 Dec 2026 07:22:52 GMT
help
214-2.0.0 This is sendmail
214-2.0.0 Topics:
214-2.0.0       HELO    EHLO    MAIL    RCPT    DATA
214-2.0.0       RSET    NOOP    QUIT    HELP    VRFY
214-2.0.0       EXPN    VERB    ETRN    DSN     AUTH
214-2.0.0       STARTTLS
214-2.0.0 For more info use "HELP <topic>".
214-2.0.0 To report bugs in the implementation see
214-2.0.0       http://www.sendmail.org/email-addresses.html
214-2.0.0 For local information send email to Postmaster at your site.
214 2.0.0 End of HELP info
^C

Check HTTP server status

sudo systemctl status httpd
× httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2026-12-01 08:33:14 UTC; 5min ago
       Docs: man:httpd.service(8)
    Process: 15079 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
   Main PID: 15079 (code=exited, status=1/FAILURE)
     Status: "Reading configuration..."
        CPU: 39ms

Dec 01 08:33:14 stapp01 systemd[1]: Starting The Apache HTTP Server...
Dec 01 08:33:14 stapp01 httpd[15079]: AH00558: httpd: Could not reliably determine the server's fully qualifi>
Dec 01 08:33:14 stapp01 httpd[15079]: (98)Address already in use: AH00072: make_sock: could not bind to addre>
Dec 01 08:33:14 stapp01 httpd[15079]: (98)Address already in use: AH00072: make_sock: could not bind to addre>
Dec 01 08:33:14 stapp01 httpd[15079]: no listening sockets available, shutting down
Dec 01 08:33:14 stapp01 httpd[15079]: AH00015: Unable to open logs
Dec 01 08:33:14 stapp01 systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Dec 01 08:33:14 stapp01 systemd[1]: httpd.service: Failed with result 'exit-code'.
Dec 01 08:33:14 stapp01 systemd[1]: Failed to start The Apache HTTP Server.

The Apache server is exited. We can see the apache config file port specified

cat /etc/httpd/conf/httpd.conf | grep 3004
Listen 3004

Indeed it’s listening on port 3004. Now we need to stop the SMTP server and restart the Apache server

# Check for listening applications
sudo ss -tupln
Netid    State     Local Address:Port   Process                                 
tcp      LISTEN    127.0.0.1:3004       users:(("sendmail",pid=27915,fd=4))    
tcp      LISTEN    0.0.0.0:22           users:(("sshd",pid=1564,fd=3))         
tcp      LISTEN    0.0.0.0:8080         users:(("ttyd",pid=60,fd=11))          
tcp      LISTEN    [::]:22              users:(("sshd",pid=1564,fd=4)) 

# Note the process ID is 27915. Kill it
sudo kill 27915

# Restart http server
sudo systemctl restart httpd

# List the application listening ports
sudo ss -tupln
Netid    State     Local Address:Port   Process                                 
tcp      LISTEN    0.0.0.0:22           users:(("sshd",pid=1564,fd=3))         
tcp      LISTEN    0.0.0.0:8080         users:(("ttyd",pid=60,fd=11))          
tcp      LISTEN    [::]:22              users:(("sshd",pid=1564,fd=4)) 
tcp      LISTEN    *:3004               users:(("httpd",pid=61093,fd=4),("httpd",pid=61092,fd=4),("httpd",pid=61091,fd=4),("httpd",pid=61083,fd=4))

Now we should allow port 3004 from the firewall side. In the app server 1 the utility used to manage firewall config is the iptables command.

# List all firewall settings
sudo iptables -L INPUT -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

# Add rule on port 3004
sudo iptables -I INPUT 5 -p tcp --dport 3004 -m state --state NEW -j ACCEPT

# Save the firewall configuration
which iptables-save
/usr/sbin/iptables-save

sudo sh -c 'iptables-save > /etc/sysconfig/iptables'

cat /etc/sysconfig/iptables
# Generated by iptables-save v1.8.10 on Tue Dec  1 08:41:23 2026
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [446:5530144]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3004 -m state --state NEW -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Dec  1 08:41:23 2026

Ok now we see the http is listening and the firewall rule is added to allow 3004 TCP traffic. Let’s do some testing

# Exit from App server 1 to Jump host
exit

# Now try the curl from jump host
curl http://stapp01:3004
... Got response from Apache http server

By shafdo

Leave a Reply

Your email address will not be published. Required fields are marked *