Date: Wed, 17 Mar 2010 23:50:04 +0100 From: Roland Smith <rsmith@xs4all.nl> To: Peter Steele <psteele@maxiscale.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: Generating a random hostname Message-ID: <20100317225004.GA16533@slackbox.erewhon.net> In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3B27DFDA@MBX03.exg5.exghost.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Wed, Mar 17, 2010 at 05:06:30PM -0500, Peter Steele wrote:
> Is there any facility in FreeBSD for generating a random hostname? We have a
> template with a fixed hostname that has to be changed after the template is
> closed. It would be useful to have a hostname generated randomly.
For random strings, I tend to use openssl (e.g. with base64 encoding);
openssl rand -base64 18
You do run the risk here of getting non-alphabetic characters here, so you
might want to filter those:
openssl rand -base64 18| sed 's|[^[:alpha:]]||g'
Or if you are fine with just hex numbers;
openssl rand 18 | hexdump -e '8 "%X" "\n"'
Roland
--
R.F.Smith http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)
iEYEARECAAYFAkuhXJwACgkQEnfvsMMhpyWPzgCcCGOM6PfzesFLhVtTbIK4Wtx4
zqQAn2GcQdQm++FlQVRuxkn/3bPLlGC3
=T7xO
-----END PGP SIGNATURE-----
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100317225004.GA16533>
