# What OpenPanel changes on your server

Source: https://openpanel.sh/docs/servers/what-changes

Every change the setup makes to a server, from the openpanel user and SSH settings to the firewall, Docker, the private network, the agent, logs and passwords.

The setup changes the server completely. This page lists every change, in the order the [setup steps](/docs/servers/setup-steps) make them. The order keeps a way in open at every moment: OpenPanel's own key works before SSH changes, and SSH works on its new port before the firewall turns on.

## The openpanel user and its key [#the-openpanel-user-and-its-key]

| Change | Details |
|---|---|
| A new user, `openpanel` | With a home directory and the `bash` shell. |
| Root rights without a password | `openpanel` joins the `sudo` group, and `/etc/sudoers.d/90-openpanel` lets it run any command as root without a password. |
| An SSH key only OpenPanel holds | An Ed25519 key made for this server. Its public half goes into `/home/openpanel/.ssh/authorized_keys`; its private half is kept encrypted by OpenPanel. |

Before going on, OpenPanel signs in as `openpanel` with the key and checks that it can run commands as root.

## Updates and security tools [#updates-and-security-tools]

- Installs every pending update (`apt-get update` and `apt-get upgrade`).
- Installs `ufw`, `fail2ban`, `unattended-upgrades`, `ca-certificates` and `curl`.
- Turns on automatic updates in `/etc/apt/apt.conf.d/20auto-upgrades`: the package lists are refreshed and security updates install themselves every day.

## SSH [#ssh]

OpenPanel writes `/etc/ssh/sshd_config.d/00-openpanel.conf`:

```text title="/etc/ssh/sshd_config.d/00-openpanel.conf"
# Written by OpenPanel. Sign-in is by key only, on this port.
Port 41873
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AllowUsers openpanel
MaxAuthTries 3
LoginGraceTime 30
X11Forwarding no
```

- **The port** is picked at random from 20000 to 59999 for each server (41873 above is an example).
- **Only the user `openpanel` can sign in**, and only with OpenPanel's key. Passwords and root sign-in are off for everyone.
- **The file name starts with `00-`** so that it wins over the image's own files, such as `50-cloud-init.conf`: SSH keeps the first value it reads for each setting.

OpenPanel checks the configuration (`sshd -t`), restarts SSH, and signs in again on the new port. If it cannot reach the new port, it removes the file, restarts SSH on the old settings and stops the setup.

## Firewall and brute-force bans [#firewall-and-brute-force-bans]

The firewall (`ufw`) is reset, which removes any rules it had, and then set to:

| Direction | Rule |
|---|---|
| Incoming | Closed, except the ports below |
| Outgoing | Open |
| TCP, the new SSH port | Open (OpenPanel SSH) |
| TCP 80 | Open (HTTP) |
| TCP 443 | Open (HTTPS) |

`fail2ban` watches SSH on the new port. An address that fails to sign in 5 times within 10 minutes is banned for an hour. The settings are in `/etc/fail2ban/jail.d/openpanel.local`.

OpenPanel then signs in once more through the firewall. If the firewall blocks it, OpenPanel switches the firewall off again and stops the setup.

### Ports Docker publishes [#ports-docker-publishes]

Docker writes its own forwarding rules, which pass before `ufw`'s. Without more rules, a container started with a published port (`docker run -p …`) would be reachable from the internet even though `ufw` does not list the port. The setup adds rules to Docker's `DOCKER-USER` chain, in `ufw`'s own files `/etc/ufw/after.rules` and `/etc/ufw/after6.rules`, so they come back at every reload and restart, for IPv4 and IPv6:

- answers to connections a container made, and traffic from Docker's own networks and the private network, pass;
- from outside, a published port is reachable only if it is 80 or 443;
- everything else is dropped.

OpenPanel's own services publish no ports: their traffic reaches them through the [agent](/docs/servers/agent).

The private network adds two more rules; see [The private network](#the-private-network) below.

## Docker [#docker]

- Installs Docker from Ubuntu's own packages (`docker.io`), unless Docker is already installed.
- Writes `/etc/docker/daemon.json`:

  ```json title="/etc/docker/daemon.json"
  { "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true }
  ```

  Each container's log rotates at 10 MB and keeps three files. With `live-restore`, containers keep running while Docker itself restarts.
- Starts Docker at boot, and adds `openpanel` to the `docker` group.
- Checks that the firewall's rules for Docker's ports are in place, and stops the setup if they are not.

## The private network [#the-private-network]

The server joins the organization's [private network](/docs/network), run by Tiltas:

- Tiltas's software is downloaded from the network service and installed, and the server joins with a one-time key that works once, within an hour. The key reaches the installer on its input, never on a command line.
- The server is named after its OpenPanel name, in lowercase, with dashes for anything other than letters and digits.
- Two firewall rules are added: every port is open on the private network's interface (`quietlane0`), to your organization's own servers and devices, and UDP 41641 is open for direct connections.

If the server cannot join (for example, the network service does not answer), the setup goes on without it, and you can join later from the server's page. See [Servers in the network](/docs/network/servers).

## The OpenPanel agent [#the-openpanel-agent]

The setup installs the [OpenPanel agent](/docs/servers/agent) from its signed release:

| Change | Details |
|---|---|
| The program | `/usr/local/bin/openpanel-agent`, for the server's processor. |
| A systemd service | `openpanel-agent`, in `/etc/systemd/system/openpanel-agent.service`, started at boot and restarted if it stops. |
| Its key | `/etc/openpanel/agent.key`, made on the server, readable by root only, with `/etc/openpanel/agent.json` naming the server and the gateway. |
| Its working folder | `/var/lib/openpanel`, for builds and their tools. |
| Build tools | `git` and Docker Buildx, if they are missing. |

The agent connects out to `gateway.openpanel.sh` on port 443. No port is opened for it.

If the agent cannot be installed, the setup goes on without it.

## System logs [#system-logs]

`/etc/systemd/journald.conf.d/openpanel.conf` keeps the system log across restarts (`Storage=persistent`) and caps it at 500 MB (`SystemMaxUse=500M`).

## Passwords and the marker [#passwords-and-the-marker]

- **One new random password** is set for root, `openpanel`, and the user you connected with if it is neither. It is for your provider's web console or the machine's own screen and keyboard; SSH does not accept it. The Owner or an Admin sees it under **Console access** on the server's page.
- **The password you typed** in OpenPanel was used once to sign in and is not stored.
- **A marker file**, `/etc/openpanel/server.json` (readable by root only), records the server's OpenPanel ID and the time. It stops the server from being set up twice.

## What disconnecting undoes [#what-disconnecting-undoes]

A clean disconnect removes the agent, OpenPanel's containers and volumes, its key, `/etc/openpanel`, the `sudoers` file and the private network, and turns password sign-in back on for `openpanel`. The firewall, `fail2ban`, automatic updates and Docker stay. See [Disconnect and force disconnect](/docs/servers/disconnect).