Skip to content

Randomize system hostname and machine-id on Linux at boot. Useful for pentesting, privacy, or any scenario requiring a fresh identity each boot.

License

Notifications You must be signed in to change notification settings

ryanmroth/freshid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

freshid

Randomize system hostname (and optionally machine-id) on Linux at boot. Useful for pentesting, privacy, or any scenario requiring a fresh identity each boot.

Features

  • Randomizes hostname on every boot
  • Optionally randomizes /etc/machine-id for full identity separation
  • Configurable prefix and random string length
  • Runs early in boot, before network services start
  • Configuration via environment variables or CLI flags

Installation

git clone https://github.com/ryanmroth/freshid.git
cd freshid
sudo cp freshid /usr/bin/
sudo chmod +x /usr/bin/freshid
sudo cp freshid.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable freshid.service

Configuration

Configure via environment variables in the service file or CLI flags. Flags take precedence over environment variables.

Environment Variable Flag Default Description
FRESHID_PREFIX --prefix server Hostname prefix
FRESHID_LENGTH --length 6 Length of random portion
FRESHID_MACHINE_ID --with-machine-id false Also randomize machine-id

To customize, edit /etc/systemd/system/freshid.service:

[Service]
Type=oneshot
ExecStart=/usr/bin/freshid
Environment=FRESHID_PREFIX=kali
Environment=FRESHID_LENGTH=8
#Environment=FRESHID_MACHINE_ID=true

Then reload:

sudo systemctl daemon-reload

Usage

The service runs automatically at boot. To run manually:

# Default (server-a1b2c3)
sudo freshid

# Custom prefix (kali-x9f2k1)
sudo freshid --prefix kali

# No prefix (x9f2k1)
sudo freshid --no-prefix

# Longer random portion (server-a1b2c3d4)
sudo freshid --length 8

# Include machine-id randomization
sudo freshid --with-machine-id

# Show help
freshid --help

Verify

# Check hostname
hostname

# Check /etc/hosts
grep 127.0.1.1 /etc/hosts

# Check machine-id (if using --with-machine-id)
cat /etc/machine-id

When to use --with-machine-id

The machine-id flag is useful for:

  • Remote deployments (dropboxes) requiring full identity separation
  • Scenarios where DHCP servers or services fingerprint on machine-id

For local pentesting laptops, hostname randomization alone is usually sufficient. Randomizing machine-id causes journald to create a new log directory each boot, fragmenting your logs.

Uninstall

sudo systemctl disable freshid.service
sudo rm /etc/systemd/system/freshid.service
sudo rm /usr/bin/freshid
sudo systemctl daemon-reload

Changelog

See CHANGELOG.md for version history.

License

MIT

About

Randomize system hostname and machine-id on Linux at boot. Useful for pentesting, privacy, or any scenario requiring a fresh identity each boot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages