Score:0

How to get the email I entered on Proxmox VE setup in the shell?

sb flag

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

Score:2
in flag

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
# [email protected]

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 !

Martin Braun avatar
sb flag
This is exactly what I was looking for. :)
Score:1
it flag

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 [email protected] 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
Petr Schönmann avatar
it flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.