vps_-_freebsd
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
vps_-_freebsd [2023/09/12 05:08] – hc9 | vps_-_freebsd [2024/04/10 03:55] (current) – [Package Management] {AB hc9 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{example: | ||
+ | < | ||
+ | |||
+ | ====== FreeBSD Setup and Configuration ====== | ||
+ | |||
+ | ===== User Accounts ===== | ||
+ | |||
+ | After your FreeBSD image has been installed and started, connect to the console and log-in as user '' | ||
+ | |||
+ | Change the //root// password using the '' | ||
+ | |||
+ | It's standard practice to create a regular user account for general use, using '' | ||
+ | |||
+ | If '' | ||
+ | |||
+ | * The default user home directory is present at ''/ | ||
+ | * ''/ | ||
+ | |||
+ | Once the default directory and the symlink are present, run: | ||
+ | |||
+ | < | ||
+ | |||
+ | $ / | ||
+ | $ rmuser < | ||
+ | |||
+ | </ | ||
+ | |||
+ | Run '' | ||
+ | |||
+ | ===== Networking ===== | ||
+ | |||
+ | Take note of the HOSTNAME and EXTERNAL_IP from the first line of your vps control panel. | ||
+ | |||
+ | < | ||
+ | |||
+ | VPS Maintenance Shell for freebsd99 (205.166.94.nnn) | ||
+ | --------- | ||
+ | ^ ^ | ||
+ | | | | ||
+ | | EXTERNAL_IP | ||
+ | HOSTNAME | ||
+ | |||
+ | </ | ||
+ | |||
+ | Open ''/ | ||
+ | |||
+ | <file config / | ||
+ | |||
+ | hostname=" | ||
+ | ifconfig_xn0=" | ||
+ | defaultrouter=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | Inspect ''/ | ||
+ | |||
+ | Run '' | ||
+ | |||
+ | ===== Package Management ===== | ||
+ | |||
+ | FreeBSD uses '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | < | ||
+ | |||
+ | $ cp / | ||
+ | |||
+ | # In / | ||
+ | # the repository | ||
+ | |||
+ | FreeBSD: { | ||
+ | ... | ||
+ | url: " | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | # Update all | ||
+ | |||
+ | $ pkg update -f | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== System Time ===== | ||
+ | |||
+ | Timezone files are found in ''/ | ||
+ | |||
+ | < | ||
+ | |||
+ | ln -sf / | ||
+ | |||
+ | </ | ||
+ | |||
+ | FreeBSD can be prone to clock skew so it's best to setup NTP at this time. | ||
+ | |||
+ | < | ||
+ | |||
+ | $ pkg install ca_root_nss | ||
+ | $ sysrc ntpd_enable=" | ||
+ | $ sysrc ntpd_sync_on_start=" | ||
+ | $ service ntpd fetch # Update the leapseconds file. | ||
+ | $ ntpd -gq # Force an update of the system time. | ||
+ | $ service ntpd start # Start the service. | ||
+ | |||
+ | </ | ||
+ | |||
+ | If '' | ||
+ | |||
+ | ===== System Update ===== | ||
+ | |||
+ | The initial FreeBSD image is version 14.0. To upgrade to a newer version run: | ||
+ | |||
+ | < | ||
+ | |||
+ | $ freebsd-update -r RELEASE_NAME upgrade | ||
+ | |||
+ | # This process will take a while, be patient. Answer " | ||
+ | # When the upgrade configuration is done, run: | ||
+ | |||
+ | $ freebsd-update install | ||
+ | |||
+ | # Again, answer " | ||
+ | # reboot when instructed. | ||
+ | |||
+ | </ | ||
+ | |||
+ | Once the upgrade is complete, clean up the files with '' | ||
+ | |||
+ | ===== Hardening ===== | ||
+ | |||
+ | FreeBSD comes with a few system hardening options which are typically set during install. To check ''/'' | ||
+ | |||
+ | Addiional options can be added to ''/ | ||
+ | |||
+ | < | ||
+ | |||
+ | security.bsd.see_other_uids=0 | ||
+ | security.bsd.see_other_gids=0 | ||
+ | security.bsd.see_jail_proc=0 | ||
+ | security.bsd.unprivileged_read_msgbuf=0 | ||
+ | kern.randompid=107 | ||
+ | net.inet.ip.random_id=1 | ||
+ | net.inet.ip.redirect=0 | ||
+ | net.inet.tcp.always_keepalive=0 | ||
+ | net.inet.tcp.blackhole=2 | ||
+ | net.inet.udp.blackhole=1 | ||
+ | net.inet.tcp.path_mtu_discovery=0 | ||
+ | net.inet.icmp.drop_redirect=1 | ||
+ | hw.mds_disable=3 | ||
+ | hw.spec_store_bypass_disable=1 | ||
+ | kern.elf64.allow_wx=0 | ||
+ | security.bsd.allow_destructive_dtrace=0 | ||
+ | hw.ibrs_disable=1 | ||
+ | kern.elf32.aslr.enable=1 | ||
+ | kern.elf32.aslr.pie_enable=1 | ||
+ | |||
+ | </ | ||
+ | |||
+ | Kernel security levels are best set in ''/ | ||
+ | |||
+ | < | ||
+ | |||
+ | kern_securelevel_enable=" | ||
+ | kern_securelevel=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== SSH Setup ===== | ||
+ | |||
+ | The default image comes with SSH turned off. To turn it on edit ''/ | ||
+ | |||
+ | It's best to turn off root SSH login by setting '' | ||
+ | |||
+ | ==== SSH Public Key Authentication ==== | ||
+ | |||
+ | Follow [[using_ssh_for_connections_transfer_to_from_sdf|these instructions]] to create and add a public SSH key((The basic concepts of [[ssh_public_key_authentication|SSH Public Key Authentication]].)) to your FreeBSD install. Once done and confirmed working you may disable password based SSH-login by setting '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | $Id: VPS_FreeBSD.html, | ||