0

When I login to my Proxmox VE7 host, I'd like to get the email that I entered when I set up Proxmox on installation. Is it possible?

The idea is to automate certbot initialization non-interactively and I would rather use the email I entered previously automatically than asking for the email in my script again.

To clarify, I wish to get the email that I entered here within a shell script:

enter image description here

Martin Braun
  • 100
  • 11

2 Answers2

2

I think you can find your installation email address here :

cat /etc/pve/user.cfg

To get the email address :

EMAIL=`cat /etc/pve/user.cfg | awk '{split($0,a,":"); print a[7]}'`
echo $EMAIL
# test@test.com

Tested on PVE6 and PVE7, but note I've only one user (root).

In the GUI, you can find it under Datacenter / Permissions / Users, double-click on your user, and voila !

1F987
  • 771
  • 1
  • 8
1

You can just copy "template" ( /etc/pve/priv/acme/default ) from another proxmox where LE cert is working, to /etc/pve/priv/acme/default and run order certificate.

pvenode acme cert order

I suggest to create mail something like letsencrypt@example.com and have it in the template.

Im using this in ansible role. Get inspired :D

##################
#LETS ENCRYPT CERT
##################

- name: Create empty file /etc/pve/priv/acme/default - workaround for action below
  file:
    path: /etc/pve/priv/acme/default
    owner: root
    group: www-data
    mode: '0600'
    state: touch
  become: true
  tags:
    - hypervizor_proxmox_letsencrypt

- name: Copy template of LE CERT account - default
  template:
    src: lets_encrypt/le_account_default.j2
    dest: /etc/pve/priv/acme/default
    owner: root
    group: www-data
    mode: '0600'
  become: true
  tags:
    - hypervizor_proxmox_letsencrypt

- name: Create LETS ENCRYPT cert
  block:
    - name : Create LETS ENCRYPT cert
      shell: pvenode config set --acme domains="$(hostname -f|tr -d [:space:])" && pvenode acme cert order
  rescue:
    - name: Create LETS ENCRYPT cert failed, trying to rescue probably too much retries
      shell: pvenode config set --acme domains="$(hostname -f|tr -d [:space:])" && pvenode acme cert order --force
      ignore_errors: yes
  tags:
    - hypervizor_proxmox_letsencrypt
  • Okay. There is simple bash script `EMAIL=$(grep root@pam /etc/pve/user.cfg | cut -d: -f7)` Anyway, you can try acme built in with https://pve.proxmox.com/wiki/Certificate_Management instead installing certbot – Petr Schönmann Apr 12 '22 at 15:19