google / google-authenticator-libpam

Apache License 2.0
1.76k stars 281 forks source link

Backup google authenticator #169

Closed daniel1302 closed 4 years ago

daniel1302 commented 4 years ago

Hi, I need to backup google authenticator configured for openvpn. How Can I do it? I use this command to generate barcode:

su -c "google-authenticator -t -d -r3 -R30 -W -f -l \"${LABEL}\" -s /etc/openvpn/google-authenticator/${USERNAME}" - gauth
ThomasHabets commented 4 years ago

Are you asking for the backup codes, or how to back up the config?

daniel1302 commented 4 years ago

Sorry I got some troubles with backup config, but I had bug in my restore script. It did not created users.

My flow is:

Backup:

  1. Backup /etc/openvpn/keys
  2. Backup /etc/openvpn/google-authenticator
  3. Backup ovpn files

Restore:

  1. Download /etc/openvpn/keys
  2. Download /etc/openvpn/google-authenticator
  3. Set permissions for /etc/openvpn/google-authenticator
    • 0700 for /etc/openvpn/google-authenticator
    • 0400 for /etc/openvpn/google-authenticator/*
  4. Download ovpn files
  5. Create users based on /etc/openvpn/google-authenticator/*

Now it is working fine :)