# Unable to re-provision DO server, ssh connection refused

**URL:** <https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752>\
**Category:** trellis\
**Created:** [August 16, 2022, 5:47pm UTC](https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752 "2022-08-16T17:47:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mZoo](https://discourse.roots.io/user_avatar/discourse.roots.io/mzoo/32/1989_2.png) [@mZoo](https://discourse.roots.io/u/mZoo)\
**Post date:** [August 16, 2022, 5:47pm UTC](https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752/1 "2022-08-16T17:47:09Z")

</div>

Hi. Using a pretty recent Trellis codebase (June 2022 `"Add built-in fail2ban filters"`) on a year old DO droplet, we seem to be hitting [this issue](https://discourse.roots.io/t/unable-to-re-provision-on-digitalocean-unreachable/20419/5) with connection refused.

The server says it has

```auto
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1g 21 Apr 2020

```

Locally `ssh -V` returns `OpenSSH_8.6p1, LibreSSL 3.3.6`.

Confirmed the IP is being temporarily banned.

Ansible.cfg looks like this:

```auto
[ssh_connection]
ssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s
retries = 1

```

Tried updating to the latest from codebase

```auto
[ssh_connection]
ssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o HostKeyAlgorithms=ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa
retries = 1

```

Still same error. Does it have to do with Ansible version?

(On `2.10.16`, but not sure what the server was initially provisioned with.)

Thanks, as always.

---

<div class="post-metadata">

**Author:** ![swalkinshaw](https://discourse.roots.io/user_avatar/discourse.roots.io/swalkinshaw/32/6288_2.png) [@swalkinshaw](https://discourse.roots.io/u/swalkinshaw)\
**Post date:** [August 16, 2022, 8:02pm UTC](https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752/2 "2022-08-16T20:02:16Z")

</div>

> [@mZoo](#):
>
> Confirmed the IP is being temporarily banned.

How or what did you do to confirm this?

> [@mZoo](#):
>
> Still same error. Does it have to do with Ansible version?

Very unlikely the Ansible version would affect this.

---

<div class="post-metadata">

**Author:** ![swalkinshaw](https://discourse.roots.io/user_avatar/discourse.roots.io/swalkinshaw/32/6288_2.png) [@swalkinshaw](https://discourse.roots.io/u/swalkinshaw)\
**Post date:** [August 16, 2022, 8:29pm UTC](https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752/3 "2022-08-16T20:29:23Z")

</div>

If the IP was banned by fail2ban, there’s a few things you can do:

1. Manually unban the IP. Here’s a [solution that might work](https://serverfault.com/a/760324)
2. or just wait for the ban to expire
3. set the whitelist ignore IP manually to contain the IPs you want: [trellis/security.yml at 4d1e5f403d73fd095e7967f101dc68eceab1ae98 · roots/trellis · GitHub](https://github.com/roots/trellis/blob/4d1e5f403d73fd095e7967f101dc68eceab1ae98/group_vars/all/security.yml#L34-L36)

---

<div class="post-metadata">

**Author:** ![mZoo](https://discourse.roots.io/user_avatar/discourse.roots.io/mzoo/32/1989_2.png) [@mZoo](https://discourse.roots.io/u/mZoo)\
**Post date:** [August 16, 2022, 9:21pm UTC](https://discourse.roots.io/t/unable-to-re-provision-do-server-ssh-connection-refused/23752/4 "2022-08-16T21:21:22Z")

</div>

Thanks, Scott.

> [@swalkinshaw](#):
>
> How or what did you do to confirm this?

1. `trellis ssh staging`
2. in a separate terminal, run `trellis provision --tags users staging`
3. `trellis ssh staging` fails `connect to host... port 22: Connection refused`
4. on server `sudo tail -10 /var/log/fail2ban.log` returns my IP address
5. After a few minutes (untimed) I can connect again

However I still can’t run provisioning command.

Seems my current IP wasn’t whitelisted. Solved, I believe, by manually updating `/etc/fail2ban/jail.local`:

```auto
[DEFAULT]

ignoreip = 127.0.0.0/8 perhaps.old.ip.here ADD.CURRENT.IP.HERE

```

Then restarting `systemctl restart fail2ban`.

Had to do that for both `staging` and `production` on this site. Not sure why my IP address changed, or if that’s what caused the issue.
