srvrco / getssl

obtain free SSL certificates from letsencrypt ACME server Suitable for automating the process on remote servers.
GNU General Public License v3.0
2.09k stars 374 forks source link

cp failing due to identical files is still counted as a failure #825

Open Tsaukpaetra opened 10 months ago

Tsaukpaetra commented 10 months ago

Describe the bug I did a silly and configured a destination location to be the same as its original location (i.e. DOMAIN_KEY_LOCATION="/root/.getssl/domain.com/domain.com.key")

which resulted in this as an apparently fatal error:

copying private key to /root/.getssl/domain.com/domain.com.key
cp: /root/.getssl/domain.com/domain.com.key and /root/.getssl/domain.com/domain.com.key are identical (not copied).
getssl: cannot copy /root/.getssl/domain.com/domain.com.key to /root/.getssl/domain.com/domain.com.key

Traceback

 main() line 3189 called

  cert_install() line 431 called

   copy_file_to_location() line 1108 called

    error_exit() line 1301 called traceback

To Reproduce Set a location for the key/cert/whatever to the same location as it is already in.

Expected behavior Probably a catch warning for cp when it emits that specific error and note that the file wasn't updated.

Operating system (please complete the following information):

Additional context Just noticed that a renewal was failing and had time to troubleshoot it properly today. I think I originally made the mistake when troubleshooting scp auto-login issues and just never actually checked if it was working to the end of the process. Lowest priority. Just wanted to share my mirth when I realized I made a stupid happen. :)