summarylogtreecommitdiffstats
path: root/bitwarden.install
blob: 5e5a76982b4a69882e6cceee14c8ccc0a4c492cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
post_install() {
  # Create user
  systemd-sysusers /usr/lib/sysusers.d/bitwarden.conf
  
  # Change directories owner
  chown -R bitwarden:bitwarden /etc/bitwarden
  chown -R bitwarden:bitwarden /var/lib/bitwarden
  chown -R bitwarden:bitwarden /var/log/bitwarden

  # Generate required vars
	FQDN=$(hostname -f)
  BW_UID=$(id -u bitwarden)
  BW_GID=$(id -G bitwarden)

  # Configure global.env
	sed -i "s/#FQDN#/$FQDN/" /etc/bitwarden/global.env

  # Configure uid.env
  sed -i "s/#UID#/$BW_UID/" /etc/bitwarden/uid.env
  sed -i "s/#GID#/$BW_GID/" /etc/bitwarden/uid.env

  # Configure app-id.json
	sed -i "s/#FQDN#/$FQDN/" /var/lib/bitwarden/web/app-id.json

  # Pull docker images
  docker pull bitwarden/mssql:1.38.1
  docker pull bitwarden/web:1.38.1
  docker pull bitwarden/attachments:1.38.1
  docker pull bitwarden/api:1.38.1
  docker pull bitwarden/identity:1.38.1
  docker pull bitwarden/admin:1.38.1
  docker pull bitwarden/icons:1.38.1
  docker pull bitwarden/nginx:1.38.1

  # Create docker network
  docker network create bitwarden-net --driver bridge

  # Initialize the database

  # Reload systemd services
  systemctl daemon-reload
cat << EOF

  Bitwarden server:
  --------------------------
  Bitwarden server can be started with systemd: 
    systemctl start bitwarden-server

  Web interface will be available at http://localhost:8080, and Admin UI at http://localhost:8080/admin

  Bitwarden requires HTTPS to be fully functional, and this package did not generate a SSL certificate.
  If you use a reverse proxy in front of Bitwarden, please configure the SSL endpoint on your reverse proxy.

  If you require SSL endpoint on Bitwarden, copy your certificate and key, mount the files to bitwarden-nginx docker & change the port
  binding by overriding systemd service for bitwarden-nginx.service, and modify the /var/lib/bitwarden/nginx/default.conf nginx config file.

  Bitwarden requires an installation key, which can be retrieved on https://bitwarden.com/host

  Please edit the file /etc/bitwarden/global.env with your installation id and installation key:

  globalSettings__installation__id=*** your id ***
  globalSettings__installation__key=*** your key ***

EOF
}