Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre/post renewal hooks scripts #24

Merged
merged 4 commits into from Jul 8, 2019
Merged

Add pre/post renewal hooks scripts #24

merged 4 commits into from Jul 8, 2019

Conversation

dongbohu
Copy link
Contributor

@dongbohu dongbohu commented Jul 5, 2019

This PR adds pre and post renewal scripts so that the SSL certificate can be renewed successfully. The pre script stops neo4j docker container before renewal process (otherwise port 80 would be taken by the docker container and the renewal would fail); and post scripts starts the docker container.

@dongbohu
Copy link
Contributor Author

dongbohu commented Jul 5, 2019

@dhimmel: I have tested the new scripts and renewed the SSL certificate on https://neo4j.het.io successfully.

Copy link
Member

@dhimmel dhimmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So guessing that without this renewal has been failing? If we have any logs of the failure can we post them as a PR comment so we can search for them in the future if something similar happens.

One minor suggestion, otherwise looks good to me. I will merge when ready.

@@ -25,22 +25,26 @@ sudo certbot certonly \
# Create "sync-neo4j-ssl.sh" dynamically and run it:
cat > ./sync-neo4j-ssl.sh << EOF
#!/bin/bash
# Certbot post-renewal-hook script that synchronizes SSL certificates for neo4j
# Certbot deploy-renewal-hook script, which synchronizes SSL certificates for neo4j.
# This script will be executed ONLY WHEN certificate is renrewed successfully.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# This script will be executed ONLY WHEN certificate is renrewed successfully.
# This script will be executed ONLY WHEN certificate is renewed successfully.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks.

if [ -n $(docker ps --quiet --filter name=hetionet-container) ]; then
echo -n "Restarting "
docker restart hetionet-container
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the command above is just for the initial installation of SSH and the hooks are for future renewals?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@dongbohu
Copy link
Contributor Author

dongbohu commented Jul 8, 2019

@dhimmel: I realized this issue due to a message sent to team-contact channel in Slack. You can take a look at that message (and my reply).

The exact error can be found in /var/log/letsencrypt/letsencrypt.log*. It is kind of esoteric and tedious. Here is part of it:

2019-07-01 22:49:30,323:INFO:certbot.auth_handler:Performing the following challenges:
2019-07-01 22:49:30,323:INFO:certbot.auth_handler:http-01 challenge for neo4j.het.io
2019-07-01 22:49:30,324:DEBUG:acme.standalone:Failed to bind to :80 using IPv6
2019-07-01 22:49:30,324:DEBUG:acme.standalone:Failed to bind to :80 using IPv4
2019-07-01 22:49:30,324:DEBUG:certbot.error_handler:Encountered exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/plugins/standalone.py", line 76, in run
    address, self.http_01_resources)
  File "/usr/lib/python3/dist-packages/acme/standalone.py", line 189, in __init__
    BaseDualNetworkedServers.__init__(self, HTTP01Server, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/acme/standalone.py", line 108, in __init__
    raise socket.error("Could not bind to IPv4 or IPv6.")
OSError: Could not bind to IPv4 or IPv6.

@dongbohu
Copy link
Contributor Author

dongbohu commented Jul 8, 2019

If you don't have any other comments, please feel free to merge it. Thanks.

@dhimmel dhimmel merged commit 268af37 into hetio:master Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants