ASTGENKEY(8)
π
astgenkey β the astgenkey(8) page, but make it make sense
okay so bestie, welcome to the Linux Programmer's Manual corner of the group chat. today's main character is astgenkey, and she's here to hand you keys for Asterisk IAX2 RSA authentication. let's get into it π
β¨ SYNOPSIS β¨
astgenkey [ -q ] [ -n ] [ keyname ]
π¦ DESCRIPTION π¦
so this script? it generates an RSA private and public key pair in PEM format, specifically for Asterisk to use. slay.
now listen. the private key is a secret, okay? like, keep-it-in-the-vault secret, because it can be used to fake your system's identity. that's not a vibe, that's a felony-ish vibe. so by default β meaning without the -n option β the script makes a passphrase-encrypted copy of your secret key. and if you don't enter that passphrase? you literally can't use it. no passphrase, no key, no service. periodt. π
but here's the catch, bestie: if you do want to use such a key with Asterisk, you'll have to start it interactively, because the scripts that start asterisk can't use that encrypted key. they just can't. they weren't built for that. π
the key gets identified by a name. don't put the name on the command line? the script will prompt you for one. no skipping. π
the outputs of the script are:
name.pubβ the public key: not secret. send this to the other side. share it like a playlist, it's fine. πname.keyβ the private key: secret. do not share. do not post. do not text it to the group chat. π«Ά
those files should be copied to /var/lib/asterisk/keys
(private key: on your system. public key: on other systems) β¨
and if you wanna see the currently-installed keys from the asterisk CLI, use this command:
keys show
πΈ OPTIONS πΈ
-qβ run quietly. no yapping, just keys. π€«-nβ don't encrypt the private key. (reminder that this is the un-encrypted route, so be careful bestie) β οΈ
π₯ SECURITY π₯
okay this part is highkey important, so read it twice.
the keys are created using the umask of the user running the command. that means if your umask is being messy, your private key might be readable by the whole world. not iconic. not even a little.
to create the keys in a secure manner, you should check to ensure that your umask is first set to disallow the private key from being world-readable, such as with the following commands:
umask 0066
astgenkey yourkey
and then make the key accessible to Asterisk (assuming you run it as user "asterisk").
chown asterisk /var/lib/asterisk/keys/yourname.*
π¨ do NOT skip the umask step. a world-readable private key is a whole villain arc.
π§ FILES π§
/var/lib/asterisk/keys
π SEE ALSO π
π AUTHOR π
this manual page was written by Tzafrir Cohen <tzafrir.cohen@xorcom.com> π
permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
on Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.
okay and that's the whole page bestie π«Ά this came from the Asterisk peeps, dated May 14th, 2005 β yes she's vintage, yes she still ate. go generate those keys responsibly, set that umask, and keep the private one private. mwah π β¨
π¦ where this page comes from
- alpine 3.22: asterisk-doc 20.11.1-r6 Β· GPL-2.0-only WITH OpenSSL-Exception
- alpine 3.23: asterisk-doc 20.15.2-r1 Β· GPL-2.0-only WITH OpenSSL-Exception
- alpine 3.24: asterisk-doc 22.9.0-r0 Β· GPL-2.0-only WITH OpenSSL-Exception
- epel 9: asterisk 18.26.4-1.el9 Β· GPL-2.0-only
- fedora 43: asterisk 18.12.1-1.fc43.15 Β· GPL-2.0-only
- fedora 43: asterisk 18.12.1-1.fc43.15 Β· GPL-2.0-only
- fedora 43: asterisk 18.26.4-1.fc43 Β· GPL-2.0-only
- fedora 43: asterisk 18.26.4-1.fc43 Β· GPL-2.0-only
- fedora 44: asterisk 18.12.1-1.fc44.17 Β· GPL-2.0-only
- fedora 44: asterisk 18.12.1-1.fc44.17 Β· GPL-2.0-only
- fedora 44: asterisk 18.26.4-1.fc44 Β· GPL-2.0-only
- fedora 44: asterisk 18.26.4-1.fc44 Β· GPL-2.0-only
- nixos 26.05: asterisk 23.5.0
- nixos 26.05: asterisk-ldap 22.11.0
- nixpkgs unstable: asterisk 23.5.0
- nixpkgs unstable: asterisk-ldap 22.11.0
- ubuntu jammy: asterisk 1:18.10.0~dfsg+~cs6.10.40431411-2 Β· GPL-2-Asterisk
- ubuntu noble: asterisk 1:20.6.0~dfsg+~cs6.13.40431414-2build5 Β· GPL-2-Asterisk
- ubuntu resolute: asterisk 1:22.5.2~dfsg+~cs6.15.60671435-1 Β· GPL-2-Asterisk
- ubuntu stonking: asterisk 1:22.10.0+dfsg+~cs6.17.60671434-1ubuntu3 Β· GPL-2-Asterisk
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms