| 1 | Description: astgenkey should generate a private key that is not world-readable |
| 2 | Upstream has not accepted this patch |
| 3 | and chose instead to document this as a known minor issue. |
| 4 | Author: Lionel Elie Mamane <[email protected]> |
| 5 | Bug: https://issues.asterisk.org/jira/browse/ASTERISK-11788 |
| 6 | Last-Update: 2022-01-22 |
| 7 | --- |
| 8 | This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 9 | --- a/contrib/scripts/astgenkey |
| 10 | +++ b/contrib/scripts/astgenkey |
| 11 | @@ -47,7 +47,11 @@ |
| 12 | rm -f ${KEY}.key ${KEY}.pub |
| 13 | |
| 14 | echo "Generating SSL key '$KEY': " |
| 15 | +oldumask="`umask`" |
| 16 | +umask 0077 |
| 17 | openssl genrsa -out ${KEY}.key ${DES3} 1024 |
| 18 | +[ "$(id -u)" = 0 ] && chown asterisk: ${KEY}.key |
| 19 | +umask $oldumask |
| 20 | openssl rsa -in ${KEY}.key -pubout -out ${KEY}.pub |
| 21 | |
| 22 | if [ -f "${KEY}.key" ] && [ -f "${KEY}.pub" ]; then |