#Solved# I need help, I can't really find out the location/path of TLS certificates files

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

Just installed it on a new system, by the official Auto-Installation script apt install caddy

a. System environment:

Debian 10, new and clean, everything and settings are default.

b. Command:

root@ruvds-hzgd3:~# echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
> | tee -a /etc/apt/sources.list.d/caddy-fury.list
deb [trusted=yes] https://apt.fury.io/caddy/ /
root@ruvds-hzgd3:~# apt update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Ign:4 https://apt.fury.io/caddy  InRelease
Ign:5 https://apt.fury.io/caddy  Release
Ign:6 https://apt.fury.io/caddy  Packages
Ign:7 https://apt.fury.io/caddy  Translation-en
Get:6 https://apt.fury.io/caddy  Packages
Ign:7 https://apt.fury.io/caddy  Translation-en
Ign:7 https://apt.fury.io/caddy  Translation-en
Ign:7 https://apt.fury.io/caddy  Translation-en
Ign:7 https://apt.fury.io/caddy  Translation-en
Ign:7 https://apt.fury.io/caddy  Translation-en
Ign:7 https://apt.fury.io/caddy  Translation-en
Fetched 3385 B in 2s (1679 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
41 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@ruvds-hzgd3:~# apt install caddy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  caddy
0 upgraded, 1 newly installed, 0 to remove and 41 not upgraded.
Need to get 11.5 MB of archives.
After this operation, 33.1 MB of additional disk space will be used.
Get:1 https://apt.fury.io/caddy  caddy 2.2.1 [11.5 MB]
Fetched 11.5 MB in 4s (2806 kB/s)
Selecting previously unselected package caddy.
(Reading database ... 21011 files and directories currently installed.)
Preparing to unpack .../archives/caddy_2.2.1_amd64.deb ...
Unpacking caddy (2.2.1) ...
Setting up caddy (2.2.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/caddy.service → /lib/systemd/system/caddy.service.
root@ruvds-hzgd3:~# caddy version
v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=
root@ruvds-hzgd3:~# nano /etc/caddy/Caddyfile
root@ruvds-hzgd3:~# systemctl reload caddy
root@ruvds-hzgd3:~# systemctl enable caddy
root@ruvds-hzgd3:~# systemctl status caddy
● caddy.service - Caddy
   Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-12-22 15:00:25 MSK; 2min 5s ago
     Docs: https://caddyserver.com/docs/
 Main PID: 3522 (caddy)
    Tasks: 7 (limit: 454)
   Memory: 18.3M
   CGroup: /system.slice/caddy.service
           └─3522 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile

Dec 22 15:02:22 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638542.2909446,"logger":"tls.issuance.acme","msg":"done waiDec 22 15:02:22 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638542.7987666,"logger":"tls.issuance.acme.acme_client","msDec 22 15:02:23 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638543.0975592,"logger":"tls","msg":"served key authenticatDec 22 15:02:23 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638543.2226691,"logger":"tls","msg":"served key authenticatDec 22 15:02:23 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638543.3863065,"logger":"tls","msg":"served key authenticatDec 22 15:02:23 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638543.4004786,"logger":"tls","msg":"served key authenticatDec 22 15:02:23 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638543.8518963,"logger":"tls.issuance.acme.acme_client","msDec 22 15:02:24 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638544.7533195,"logger":"tls.issuance.acme.acme_client","msDec 22 15:02:24 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638544.7546074,"logger":"tls.obtain","msg":"certificate obtDec 22 15:02:24 ruvds-hzgd3 caddy[3522]: {"level":"info","ts":1608638544.7548,"logger":"tls.obtain","msg":"releasing lock","i

c. Service/unit/compose file:

None.

d. My complete Caddyfile or JSON config:

    # The Caddyfile is an easy way to configure your Caddy web server.
    #
    # Unless the file starts with a global options block, the first
    # uncommented line is always the address of your site.
    #
    # To use your own domain name (with automatic HTTPS), first make
    # sure your domain's A/AAAA DNS records are properly pointed to
    # this machine's public IP, then replace the line below with your
    # domain name.
    test.com

    # Set this path to your site's directory.
    root * /usr/share/caddy

    # Enable the static file server.
    file_server

    # Another common task is to set up a reverse proxy:
    # reverse_proxy localhost:8080

    # Or serve a PHP site through php-fpm:
    # php_fastcgi localhost:9000

    # Refer to the Caddy docs for more information:
    # https://caddyserver.com/docs/caddyfile

3. The problem I’m having:

I need to know and get the exact location/path of the TLS certificates files that caddy just created, but i googled a lot, i still can not find it.

4. Error messages and/or full log output:

&

5. What I already tried:

according to the caddy documentation

root@ruvds-hzgd3:~# cd $HOME/.local/share/caddy
-bash: cd: /root/.local/share/caddy: No such file or directory

root@ruvds-hzgd3:~# cd $XDG_DATA_HOME/caddy
-bash: cd: /caddy: No such file or directory

6. Links to relevant resources:

I literaly already tried everything that i googled, but i still cannot find the certificates files, i’m pretty sure there is a certificates file which caddy just created, because like i said, it was new server and new system, and right after i install caddy and add my new domain into Caddyfile, ( and of course i also added DNS recorder for this domain to this server IP only before i install caddy)
i’m so much a noob i’m quite aware, please givmme a simple way, like cd a/b/c/d
THX^^

When running as a service, Caddy runs as the caddy user. The $HOME for the caddy user is /var/lib/caddy. So the certs are in /var/lib/caddy/.local/share/caddy.

1 Like

OMG, Thank You, Man!
i’m so glad to see you, you are the one!

1 Like

root@ruvds-hzgd3:~# cd /var/lib/caddy/.local/share/caddy
root@ruvds-hzgd3:/var/lib/caddy/.local/share/caddy# ls
acme certificates locks ocsp
root@ruvds-hzgd3:/var/lib/caddy/.local/share/caddy#

Just one more question if you don’t mind, now i can see the certificates.crt file in right here,
but i also need the .key file, i’m not sure, but does Caddy also create a .key file? if so, which one is it, or where is it?

Thank you.

Yes, it’s in there, in the certificates dir. But why do you need those files? Caddy will manage them for your automatically.

1 Like

Yeah, the real .crtand .key files hide quite deeply.

root@ruvds-hzgd3:~# cd /var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/test.com

root@ruvds-hzgd3:/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/test.com# ls
test.com.crt test.com.json test.com.key

I need the path of them both because of some proxy tool, it has a TLS & Websocket funcation, and that need the path of Both .crt and .key files.

Here is a link about an example config of the proxy tool i mentioned.

Just in case you might be interested too, oneday or another^^

Thanks a lot, man
Sincerely.

This topic was automatically closed after 30 days. New replies are no longer allowed.