SSH Failing between my Jenkins server and my web server












0















Ok, so recently I started noticing, basically the last week, that my Jenkins server has been intermittently failing builds due to an ssh timeout. This has gotten progressively worse until now, where every build fails.



I've spent the last couple days trying to diagnose the issue. Here's what I know.
The problem server is $Emo, $Jenkins is the Jenkins server.



$Emo ssh works normally. I can log in through putty and work as normal.



netstat -natp | grep sshd gives me this:



tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1713/sshd


tcp6 0 0 :::22 :::* LISTEN 1713/sshd


I've ommitted my own connection of course.
I've tried allowing the $Jenkins through the ports and it's not in the fail2ban list or in hosts.deny



If I restart $Emo it will allow ssh through for a short while and then start refusing connection again.



Pinging $Emo from $Jenkins is successful



Telnet $Emo's ssh port from $Jenkins is only successful when $Emo has been rebooted in the beginning, but then timeouts happen a few minutes later.



This is $Emo's ufw:



Chain INPUT (policy DROP)
target prot opt source destination
f2b-NoProxy tcp -- anywhere anywhere multiport dports http,https
f2b-NoScript tcp -- anywhere anywhere multiport dports http,https
f2b-nginx-botsearch tcp -- anywhere anywhere multiport dports http,https
f2b-nginx-http-auth tcp -- anywhere anywhere multiport dports http,https
f2b-sshd tcp -- anywhere anywhere multiport dports ssh
DROP tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: UPDATE seconds: 3600 hit_count: 4 name: DEFAULT side: source mask: 255.255.255.255
tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere icmp echo-request

Chain FORWARD (policy DROP)
target prot opt source destination
ufw-before-logging-forward all -- anywhere anywhere
ufw-before-forward all -- anywhere anywhere
ufw-after-forward all -- anywhere anywhere
ufw-after-logging-forward all -- anywhere anywhere
ufw-reject-forward all -- anywhere anywhere
ufw-track-forward all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ufw-before-logging-output all -- anywhere anywhere
ufw-before-output all -- anywhere anywhere
ufw-after-output all -- anywhere anywhere
ufw-after-logging-output all -- anywhere anywhere
ufw-reject-output all -- anywhere anywhere
ufw-track-output all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:domain state NEW
ACCEPT udp -- anywhere anywhere udp dpt:domain state NEW
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW
ACCEPT tcp -- anywhere anywhere tcp dpt:https state NEW
ACCEPT icmp -- anywhere anywhere icmp echo-reply

Chain f2b-NoProxy (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain f2b-NoScript (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain f2b-nginx-botsearch (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain f2b-nginx-http-auth (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain f2b-sshd (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain ufw-after-forward (1 references)
target prot opt source destination

Chain ufw-after-input (1 references)
target prot opt source destination
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-ns
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-dgm
ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:netbios-ssn
ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:microsoft-ds
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootps
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootpc
ufw-skip-to-policy-input all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-input (1 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target prot opt source destination

Chain ufw-after-output (1 references)
target prot opt source destination

Chain ufw-before-forward (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp echo-request
ufw-user-forward all -- anywhere anywhere

Chain ufw-before-input (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ufw-logging-deny all -- anywhere anywhere ctstate INVALID
DROP all -- anywhere anywhere ctstate INVALID
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
ufw-not-local all -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere 239.255.255.250 udp dpt:1900
ufw-user-input all -- anywhere anywhere

Chain ufw-before-logging-forward (1 references)
target prot opt source destination

Chain ufw-before-logging-input (1 references)
target prot opt source destination

Chain ufw-before-logging-output (1 references)
target prot opt source destination

Chain ufw-before-output (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ufw-user-output all -- anywhere anywhere

Chain ufw-logging-allow (0 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

Chain ufw-logging-deny (2 references)
target prot opt source destination
RETURN all -- anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-not-local (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
DROP all -- anywhere anywhere

Chain ufw-reject-forward (1 references)
target prot opt source destination

Chain ufw-reject-input (1 references)
target prot opt source destination

Chain ufw-reject-output (1 references)
target prot opt source destination

Chain ufw-skip-to-policy-forward (0 references)
target prot opt source destination
DROP all -- anywhere anywhere

Chain ufw-skip-to-policy-input (7 references)
target prot opt source destination
DROP all -- anywhere anywhere

Chain ufw-skip-to-policy-output (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain ufw-track-forward (1 references)
target prot opt source destination

Chain ufw-track-input (1 references)
target prot opt source destination

Chain ufw-track-output (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere ctstate NEW
ACCEPT udp -- anywhere anywhere ctstate NEW

Chain ufw-user-forward (1 references)
target prot opt source destination

Chain ufw-user-input (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* 'dapp_OpenSSH' */
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT udp -- anywhere anywhere udp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT udp -- anywhere anywhere udp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT udp -- anywhere anywhere udp dpt:https
ACCEPT tcp -- $Jenkins anywhere tcp dpt:ssh
ACCEPT udp -- $Jenkins anywhere udp dpt:ssh

Chain ufw-user-limit (0 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain ufw-user-logging-forward (0 references)
target prot opt source destination

Chain ufw-user-logging-input (0 references)
target prot opt source destination

Chain ufw-user-logging-output (0 references)
target prot opt source destination

Chain ufw-user-output (1 references)
target prot opt source destination


I'm tempted to flush the ufw tables but turning the firewall off completely doesn't affect the timeout. It still happens. What else can I do to try to diagnose the issue?










share|improve this question





























    0















    Ok, so recently I started noticing, basically the last week, that my Jenkins server has been intermittently failing builds due to an ssh timeout. This has gotten progressively worse until now, where every build fails.



    I've spent the last couple days trying to diagnose the issue. Here's what I know.
    The problem server is $Emo, $Jenkins is the Jenkins server.



    $Emo ssh works normally. I can log in through putty and work as normal.



    netstat -natp | grep sshd gives me this:



    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1713/sshd


    tcp6 0 0 :::22 :::* LISTEN 1713/sshd


    I've ommitted my own connection of course.
    I've tried allowing the $Jenkins through the ports and it's not in the fail2ban list or in hosts.deny



    If I restart $Emo it will allow ssh through for a short while and then start refusing connection again.



    Pinging $Emo from $Jenkins is successful



    Telnet $Emo's ssh port from $Jenkins is only successful when $Emo has been rebooted in the beginning, but then timeouts happen a few minutes later.



    This is $Emo's ufw:



    Chain INPUT (policy DROP)
    target prot opt source destination
    f2b-NoProxy tcp -- anywhere anywhere multiport dports http,https
    f2b-NoScript tcp -- anywhere anywhere multiport dports http,https
    f2b-nginx-botsearch tcp -- anywhere anywhere multiport dports http,https
    f2b-nginx-http-auth tcp -- anywhere anywhere multiport dports http,https
    f2b-sshd tcp -- anywhere anywhere multiport dports ssh
    DROP tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: UPDATE seconds: 3600 hit_count: 4 name: DEFAULT side: source mask: 255.255.255.255
    tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
    ufw-before-logging-input all -- anywhere anywhere
    ufw-before-input all -- anywhere anywhere
    ufw-after-input all -- anywhere anywhere
    ufw-after-logging-input all -- anywhere anywhere
    ufw-reject-input all -- anywhere anywhere
    ufw-track-input all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT icmp -- anywhere anywhere icmp echo-request

    Chain FORWARD (policy DROP)
    target prot opt source destination
    ufw-before-logging-forward all -- anywhere anywhere
    ufw-before-forward all -- anywhere anywhere
    ufw-after-forward all -- anywhere anywhere
    ufw-after-logging-forward all -- anywhere anywhere
    ufw-reject-forward all -- anywhere anywhere
    ufw-track-forward all -- anywhere anywhere

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination
    ufw-before-logging-output all -- anywhere anywhere
    ufw-before-output all -- anywhere anywhere
    ufw-after-output all -- anywhere anywhere
    ufw-after-logging-output all -- anywhere anywhere
    ufw-reject-output all -- anywhere anywhere
    ufw-track-output all -- anywhere anywhere
    ACCEPT tcp -- anywhere anywhere tcp dpt:domain state NEW
    ACCEPT udp -- anywhere anywhere udp dpt:domain state NEW
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW
    ACCEPT tcp -- anywhere anywhere tcp dpt:https state NEW
    ACCEPT icmp -- anywhere anywhere icmp echo-reply

    Chain f2b-NoProxy (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere

    Chain f2b-NoScript (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere

    Chain f2b-nginx-botsearch (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere

    Chain f2b-nginx-http-auth (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere

    Chain f2b-sshd (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere

    Chain ufw-after-forward (1 references)
    target prot opt source destination

    Chain ufw-after-input (1 references)
    target prot opt source destination
    ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-ns
    ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-dgm
    ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:netbios-ssn
    ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:microsoft-ds
    ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootps
    ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootpc
    ufw-skip-to-policy-input all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

    Chain ufw-after-logging-forward (1 references)
    target prot opt source destination
    LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

    Chain ufw-after-logging-input (1 references)
    target prot opt source destination
    LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

    Chain ufw-after-logging-output (1 references)
    target prot opt source destination

    Chain ufw-after-output (1 references)
    target prot opt source destination

    Chain ufw-before-forward (1 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
    ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
    ACCEPT icmp -- anywhere anywhere icmp source-quench
    ACCEPT icmp -- anywhere anywhere icmp time-exceeded
    ACCEPT icmp -- anywhere anywhere icmp parameter-problem
    ACCEPT icmp -- anywhere anywhere icmp echo-request
    ufw-user-forward all -- anywhere anywhere

    Chain ufw-before-input (1 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
    ufw-logging-deny all -- anywhere anywhere ctstate INVALID
    DROP all -- anywhere anywhere ctstate INVALID
    ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
    ACCEPT icmp -- anywhere anywhere icmp source-quench
    ACCEPT icmp -- anywhere anywhere icmp time-exceeded
    ACCEPT icmp -- anywhere anywhere icmp parameter-problem
    ACCEPT icmp -- anywhere anywhere icmp echo-request
    ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
    ufw-not-local all -- anywhere anywhere
    ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
    ACCEPT udp -- anywhere 239.255.255.250 udp dpt:1900
    ufw-user-input all -- anywhere anywhere

    Chain ufw-before-logging-forward (1 references)
    target prot opt source destination

    Chain ufw-before-logging-input (1 references)
    target prot opt source destination

    Chain ufw-before-logging-output (1 references)
    target prot opt source destination

    Chain ufw-before-output (1 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
    ufw-user-output all -- anywhere anywhere

    Chain ufw-logging-allow (0 references)
    target prot opt source destination
    LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

    Chain ufw-logging-deny (2 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
    LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

    Chain ufw-not-local (1 references)
    target prot opt source destination
    RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
    RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
    RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
    ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
    DROP all -- anywhere anywhere

    Chain ufw-reject-forward (1 references)
    target prot opt source destination

    Chain ufw-reject-input (1 references)
    target prot opt source destination

    Chain ufw-reject-output (1 references)
    target prot opt source destination

    Chain ufw-skip-to-policy-forward (0 references)
    target prot opt source destination
    DROP all -- anywhere anywhere

    Chain ufw-skip-to-policy-input (7 references)
    target prot opt source destination
    DROP all -- anywhere anywhere

    Chain ufw-skip-to-policy-output (0 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere

    Chain ufw-track-forward (1 references)
    target prot opt source destination

    Chain ufw-track-input (1 references)
    target prot opt source destination

    Chain ufw-track-output (1 references)
    target prot opt source destination
    ACCEPT tcp -- anywhere anywhere ctstate NEW
    ACCEPT udp -- anywhere anywhere ctstate NEW

    Chain ufw-user-forward (1 references)
    target prot opt source destination

    Chain ufw-user-input (1 references)
    target prot opt source destination
    ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* 'dapp_OpenSSH' */
    ACCEPT tcp -- anywhere anywhere tcp dpt:http
    ACCEPT udp -- anywhere anywhere udp dpt:http
    ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
    ACCEPT udp -- anywhere anywhere udp dpt:ssh
    ACCEPT tcp -- anywhere anywhere tcp dpt:https
    ACCEPT udp -- anywhere anywhere udp dpt:https
    ACCEPT tcp -- $Jenkins anywhere tcp dpt:ssh
    ACCEPT udp -- $Jenkins anywhere udp dpt:ssh

    Chain ufw-user-limit (0 references)
    target prot opt source destination
    LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
    REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

    Chain ufw-user-limit-accept (0 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere

    Chain ufw-user-logging-forward (0 references)
    target prot opt source destination

    Chain ufw-user-logging-input (0 references)
    target prot opt source destination

    Chain ufw-user-logging-output (0 references)
    target prot opt source destination

    Chain ufw-user-output (1 references)
    target prot opt source destination


    I'm tempted to flush the ufw tables but turning the firewall off completely doesn't affect the timeout. It still happens. What else can I do to try to diagnose the issue?










    share|improve this question



























      0












      0








      0


      1






      Ok, so recently I started noticing, basically the last week, that my Jenkins server has been intermittently failing builds due to an ssh timeout. This has gotten progressively worse until now, where every build fails.



      I've spent the last couple days trying to diagnose the issue. Here's what I know.
      The problem server is $Emo, $Jenkins is the Jenkins server.



      $Emo ssh works normally. I can log in through putty and work as normal.



      netstat -natp | grep sshd gives me this:



      tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1713/sshd


      tcp6 0 0 :::22 :::* LISTEN 1713/sshd


      I've ommitted my own connection of course.
      I've tried allowing the $Jenkins through the ports and it's not in the fail2ban list or in hosts.deny



      If I restart $Emo it will allow ssh through for a short while and then start refusing connection again.



      Pinging $Emo from $Jenkins is successful



      Telnet $Emo's ssh port from $Jenkins is only successful when $Emo has been rebooted in the beginning, but then timeouts happen a few minutes later.



      This is $Emo's ufw:



      Chain INPUT (policy DROP)
      target prot opt source destination
      f2b-NoProxy tcp -- anywhere anywhere multiport dports http,https
      f2b-NoScript tcp -- anywhere anywhere multiport dports http,https
      f2b-nginx-botsearch tcp -- anywhere anywhere multiport dports http,https
      f2b-nginx-http-auth tcp -- anywhere anywhere multiport dports http,https
      f2b-sshd tcp -- anywhere anywhere multiport dports ssh
      DROP tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: UPDATE seconds: 3600 hit_count: 4 name: DEFAULT side: source mask: 255.255.255.255
      tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
      ufw-before-logging-input all -- anywhere anywhere
      ufw-before-input all -- anywhere anywhere
      ufw-after-input all -- anywhere anywhere
      ufw-after-logging-input all -- anywhere anywhere
      ufw-reject-input all -- anywhere anywhere
      ufw-track-input all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
      ACCEPT icmp -- anywhere anywhere icmp echo-request

      Chain FORWARD (policy DROP)
      target prot opt source destination
      ufw-before-logging-forward all -- anywhere anywhere
      ufw-before-forward all -- anywhere anywhere
      ufw-after-forward all -- anywhere anywhere
      ufw-after-logging-forward all -- anywhere anywhere
      ufw-reject-forward all -- anywhere anywhere
      ufw-track-forward all -- anywhere anywhere

      Chain OUTPUT (policy ACCEPT)
      target prot opt source destination
      ufw-before-logging-output all -- anywhere anywhere
      ufw-before-output all -- anywhere anywhere
      ufw-after-output all -- anywhere anywhere
      ufw-after-logging-output all -- anywhere anywhere
      ufw-reject-output all -- anywhere anywhere
      ufw-track-output all -- anywhere anywhere
      ACCEPT tcp -- anywhere anywhere tcp dpt:domain state NEW
      ACCEPT udp -- anywhere anywhere udp dpt:domain state NEW
      ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
      ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW
      ACCEPT tcp -- anywhere anywhere tcp dpt:https state NEW
      ACCEPT icmp -- anywhere anywhere icmp echo-reply

      Chain f2b-NoProxy (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-NoScript (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-nginx-botsearch (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-nginx-http-auth (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-sshd (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain ufw-after-forward (1 references)
      target prot opt source destination

      Chain ufw-after-input (1 references)
      target prot opt source destination
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-ns
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-dgm
      ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:netbios-ssn
      ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:microsoft-ds
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootps
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootpc
      ufw-skip-to-policy-input all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

      Chain ufw-after-logging-forward (1 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-after-logging-input (1 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-after-logging-output (1 references)
      target prot opt source destination

      Chain ufw-after-output (1 references)
      target prot opt source destination

      Chain ufw-before-forward (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
      ACCEPT icmp -- anywhere anywhere icmp source-quench
      ACCEPT icmp -- anywhere anywhere icmp time-exceeded
      ACCEPT icmp -- anywhere anywhere icmp parameter-problem
      ACCEPT icmp -- anywhere anywhere icmp echo-request
      ufw-user-forward all -- anywhere anywhere

      Chain ufw-before-input (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ufw-logging-deny all -- anywhere anywhere ctstate INVALID
      DROP all -- anywhere anywhere ctstate INVALID
      ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
      ACCEPT icmp -- anywhere anywhere icmp source-quench
      ACCEPT icmp -- anywhere anywhere icmp time-exceeded
      ACCEPT icmp -- anywhere anywhere icmp parameter-problem
      ACCEPT icmp -- anywhere anywhere icmp echo-request
      ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
      ufw-not-local all -- anywhere anywhere
      ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
      ACCEPT udp -- anywhere 239.255.255.250 udp dpt:1900
      ufw-user-input all -- anywhere anywhere

      Chain ufw-before-logging-forward (1 references)
      target prot opt source destination

      Chain ufw-before-logging-input (1 references)
      target prot opt source destination

      Chain ufw-before-logging-output (1 references)
      target prot opt source destination

      Chain ufw-before-output (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ufw-user-output all -- anywhere anywhere

      Chain ufw-logging-allow (0 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

      Chain ufw-logging-deny (2 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-not-local (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
      ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
      DROP all -- anywhere anywhere

      Chain ufw-reject-forward (1 references)
      target prot opt source destination

      Chain ufw-reject-input (1 references)
      target prot opt source destination

      Chain ufw-reject-output (1 references)
      target prot opt source destination

      Chain ufw-skip-to-policy-forward (0 references)
      target prot opt source destination
      DROP all -- anywhere anywhere

      Chain ufw-skip-to-policy-input (7 references)
      target prot opt source destination
      DROP all -- anywhere anywhere

      Chain ufw-skip-to-policy-output (0 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere

      Chain ufw-track-forward (1 references)
      target prot opt source destination

      Chain ufw-track-input (1 references)
      target prot opt source destination

      Chain ufw-track-output (1 references)
      target prot opt source destination
      ACCEPT tcp -- anywhere anywhere ctstate NEW
      ACCEPT udp -- anywhere anywhere ctstate NEW

      Chain ufw-user-forward (1 references)
      target prot opt source destination

      Chain ufw-user-input (1 references)
      target prot opt source destination
      ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* 'dapp_OpenSSH' */
      ACCEPT tcp -- anywhere anywhere tcp dpt:http
      ACCEPT udp -- anywhere anywhere udp dpt:http
      ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
      ACCEPT udp -- anywhere anywhere udp dpt:ssh
      ACCEPT tcp -- anywhere anywhere tcp dpt:https
      ACCEPT udp -- anywhere anywhere udp dpt:https
      ACCEPT tcp -- $Jenkins anywhere tcp dpt:ssh
      ACCEPT udp -- $Jenkins anywhere udp dpt:ssh

      Chain ufw-user-limit (0 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
      REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

      Chain ufw-user-limit-accept (0 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere

      Chain ufw-user-logging-forward (0 references)
      target prot opt source destination

      Chain ufw-user-logging-input (0 references)
      target prot opt source destination

      Chain ufw-user-logging-output (0 references)
      target prot opt source destination

      Chain ufw-user-output (1 references)
      target prot opt source destination


      I'm tempted to flush the ufw tables but turning the firewall off completely doesn't affect the timeout. It still happens. What else can I do to try to diagnose the issue?










      share|improve this question
















      Ok, so recently I started noticing, basically the last week, that my Jenkins server has been intermittently failing builds due to an ssh timeout. This has gotten progressively worse until now, where every build fails.



      I've spent the last couple days trying to diagnose the issue. Here's what I know.
      The problem server is $Emo, $Jenkins is the Jenkins server.



      $Emo ssh works normally. I can log in through putty and work as normal.



      netstat -natp | grep sshd gives me this:



      tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1713/sshd


      tcp6 0 0 :::22 :::* LISTEN 1713/sshd


      I've ommitted my own connection of course.
      I've tried allowing the $Jenkins through the ports and it's not in the fail2ban list or in hosts.deny



      If I restart $Emo it will allow ssh through for a short while and then start refusing connection again.



      Pinging $Emo from $Jenkins is successful



      Telnet $Emo's ssh port from $Jenkins is only successful when $Emo has been rebooted in the beginning, but then timeouts happen a few minutes later.



      This is $Emo's ufw:



      Chain INPUT (policy DROP)
      target prot opt source destination
      f2b-NoProxy tcp -- anywhere anywhere multiport dports http,https
      f2b-NoScript tcp -- anywhere anywhere multiport dports http,https
      f2b-nginx-botsearch tcp -- anywhere anywhere multiport dports http,https
      f2b-nginx-http-auth tcp -- anywhere anywhere multiport dports http,https
      f2b-sshd tcp -- anywhere anywhere multiport dports ssh
      DROP tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: UPDATE seconds: 3600 hit_count: 4 name: DEFAULT side: source mask: 255.255.255.255
      tcp -- anywhere anywhere tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
      ufw-before-logging-input all -- anywhere anywhere
      ufw-before-input all -- anywhere anywhere
      ufw-after-input all -- anywhere anywhere
      ufw-after-logging-input all -- anywhere anywhere
      ufw-reject-input all -- anywhere anywhere
      ufw-track-input all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
      ACCEPT icmp -- anywhere anywhere icmp echo-request

      Chain FORWARD (policy DROP)
      target prot opt source destination
      ufw-before-logging-forward all -- anywhere anywhere
      ufw-before-forward all -- anywhere anywhere
      ufw-after-forward all -- anywhere anywhere
      ufw-after-logging-forward all -- anywhere anywhere
      ufw-reject-forward all -- anywhere anywhere
      ufw-track-forward all -- anywhere anywhere

      Chain OUTPUT (policy ACCEPT)
      target prot opt source destination
      ufw-before-logging-output all -- anywhere anywhere
      ufw-before-output all -- anywhere anywhere
      ufw-after-output all -- anywhere anywhere
      ufw-after-logging-output all -- anywhere anywhere
      ufw-reject-output all -- anywhere anywhere
      ufw-track-output all -- anywhere anywhere
      ACCEPT tcp -- anywhere anywhere tcp dpt:domain state NEW
      ACCEPT udp -- anywhere anywhere udp dpt:domain state NEW
      ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
      ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW
      ACCEPT tcp -- anywhere anywhere tcp dpt:https state NEW
      ACCEPT icmp -- anywhere anywhere icmp echo-reply

      Chain f2b-NoProxy (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-NoScript (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-nginx-botsearch (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-nginx-http-auth (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain f2b-sshd (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere

      Chain ufw-after-forward (1 references)
      target prot opt source destination

      Chain ufw-after-input (1 references)
      target prot opt source destination
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-ns
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-dgm
      ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:netbios-ssn
      ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:microsoft-ds
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootps
      ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootpc
      ufw-skip-to-policy-input all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

      Chain ufw-after-logging-forward (1 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-after-logging-input (1 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-after-logging-output (1 references)
      target prot opt source destination

      Chain ufw-after-output (1 references)
      target prot opt source destination

      Chain ufw-before-forward (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
      ACCEPT icmp -- anywhere anywhere icmp source-quench
      ACCEPT icmp -- anywhere anywhere icmp time-exceeded
      ACCEPT icmp -- anywhere anywhere icmp parameter-problem
      ACCEPT icmp -- anywhere anywhere icmp echo-request
      ufw-user-forward all -- anywhere anywhere

      Chain ufw-before-input (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ufw-logging-deny all -- anywhere anywhere ctstate INVALID
      DROP all -- anywhere anywhere ctstate INVALID
      ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
      ACCEPT icmp -- anywhere anywhere icmp source-quench
      ACCEPT icmp -- anywhere anywhere icmp time-exceeded
      ACCEPT icmp -- anywhere anywhere icmp parameter-problem
      ACCEPT icmp -- anywhere anywhere icmp echo-request
      ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
      ufw-not-local all -- anywhere anywhere
      ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
      ACCEPT udp -- anywhere 239.255.255.250 udp dpt:1900
      ufw-user-input all -- anywhere anywhere

      Chain ufw-before-logging-forward (1 references)
      target prot opt source destination

      Chain ufw-before-logging-input (1 references)
      target prot opt source destination

      Chain ufw-before-logging-output (1 references)
      target prot opt source destination

      Chain ufw-before-output (1 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere
      ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
      ufw-user-output all -- anywhere anywhere

      Chain ufw-logging-allow (0 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

      Chain ufw-logging-deny (2 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
      LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

      Chain ufw-not-local (1 references)
      target prot opt source destination
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
      RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
      ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
      DROP all -- anywhere anywhere

      Chain ufw-reject-forward (1 references)
      target prot opt source destination

      Chain ufw-reject-input (1 references)
      target prot opt source destination

      Chain ufw-reject-output (1 references)
      target prot opt source destination

      Chain ufw-skip-to-policy-forward (0 references)
      target prot opt source destination
      DROP all -- anywhere anywhere

      Chain ufw-skip-to-policy-input (7 references)
      target prot opt source destination
      DROP all -- anywhere anywhere

      Chain ufw-skip-to-policy-output (0 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere

      Chain ufw-track-forward (1 references)
      target prot opt source destination

      Chain ufw-track-input (1 references)
      target prot opt source destination

      Chain ufw-track-output (1 references)
      target prot opt source destination
      ACCEPT tcp -- anywhere anywhere ctstate NEW
      ACCEPT udp -- anywhere anywhere ctstate NEW

      Chain ufw-user-forward (1 references)
      target prot opt source destination

      Chain ufw-user-input (1 references)
      target prot opt source destination
      ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* 'dapp_OpenSSH' */
      ACCEPT tcp -- anywhere anywhere tcp dpt:http
      ACCEPT udp -- anywhere anywhere udp dpt:http
      ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
      ACCEPT udp -- anywhere anywhere udp dpt:ssh
      ACCEPT tcp -- anywhere anywhere tcp dpt:https
      ACCEPT udp -- anywhere anywhere udp dpt:https
      ACCEPT tcp -- $Jenkins anywhere tcp dpt:ssh
      ACCEPT udp -- $Jenkins anywhere udp dpt:ssh

      Chain ufw-user-limit (0 references)
      target prot opt source destination
      LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
      REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

      Chain ufw-user-limit-accept (0 references)
      target prot opt source destination
      ACCEPT all -- anywhere anywhere

      Chain ufw-user-logging-forward (0 references)
      target prot opt source destination

      Chain ufw-user-logging-input (0 references)
      target prot opt source destination

      Chain ufw-user-logging-output (0 references)
      target prot opt source destination

      Chain ufw-user-output (1 references)
      target prot opt source destination


      I'm tempted to flush the ufw tables but turning the firewall off completely doesn't affect the timeout. It still happens. What else can I do to try to diagnose the issue?







      networking server ssh firewall






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 13 at 5:09







      Mugluck

















      asked Feb 13 at 1:59









      MugluckMugluck

      13




      13






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117811%2fssh-failing-between-my-jenkins-server-and-my-web-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117811%2fssh-failing-between-my-jenkins-server-and-my-web-server%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?