summarylogtreecommitdiffstats
path: root/redsocks2.install
blob: ed641f16a9e603a34d814b559739dabd1453a201 (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
#!/bin/sh

add_redsocks_user() {
  getent group redsocks &>/dev/null || groupadd -r redsocks >/dev/null
  getent passwd redsocks &>/dev/null || useradd -r -g redsocks -d / -s /bin/false -c redsocks redsocks >/dev/null
  systemd-tmpfiles --create redsocks2.conf
}

post_install() {
  add_redsocks_user
  cat << EOF
To launch redsocks2:

1. Start an ssh tunnel on port 4711
2. Start the redsocks2 and iptables daemons:

    rc.d start redsocks2 iptables

3. Load the redsocks2 iptables rules:

    iptables-restore /etc/iptables/redsocks2.rules
EOF
}

post_upgrade() {
  add_redsocks_user
}

post_remove() {
  getent passwd redsocks &>/dev/null && userdel redsocks >/dev/null
  getent group redsocks &>/dev/null && groupdel redsocks >/dev/null
  true
}