Fix gpgv2+ key generation
Fix gpgv2+ key generation

This resolves failing of gpgv2 key generation with the following error message:
```
gpg: agent_genkey failed: Permission denied
Key generation failed: Permission denied
```

# Explanation
gpgv2's `pinentry-curses` requires access to a current `tty`. If you `su` or `sudo` between users, your tty's permission will stay the same as the initial login user (see illustrating below). You could, in general, work around issues like this by:
 - `old_perms=$(stat -c "%U:%G" $(tty)); chown "www-data:tty" "$(tty)" && { sudo -u www-data gpg --gen-key; chown "${old_perms}" "$(tty)"; }` (uncertain security implications and won't probably work)
 - starting screen/tmux within the newuser and then running `gpg --gen-key`
 - starting a script session

But first point can't really be recommended, latter two will fail because www-data login shell is `/usr/sbin/nologin`. 

Just for illustrating the problem better for you:
```
ssh alice@somehost:
stat -c "%U:%G $(tty)" $(tty)
alice:tty /dev/pts/1
su - root
stat -c "%U:%G $(tty)" $(tty)
alice:tty /dev/pts/1
`
FloatingGhost/MISP,FIRSTdotorg/MISP,MISP/MISP,FloatingGhost/MISP,devnull-/MISP,devnull-/MISP,Rafiot/MISP,MISP/MISP,SteveClement/MISP,devnull-/MISP,FIRSTdotorg/MISP,Rafiot/MISP,TheDr1ver/MISP,SteveClement/MISP,FIRSTdotorg/MISP,SteveClement/MISP,TheDr1ver/MISP,SteveClement/MISP,FIRSTdotorg/MISP,MISP/MISP,devnull-/MISP,TheDr1ver/MISP,FloatingGhost/MISP,MISP/MISP,FloatingGhost/MISP,Rafiot/MISP,MISP/MISP,Rafiot/MISP,TheDr1ver/MISP,SteveClement/MISP