summarylogtreecommitdiffstats
path: root/rockhopper.install
blob: 00360fdb3082c8a72505fa0f9427792bc820e2ed (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
setup_rhpmain_dirs() {
	main_hdir=/var/lib/rhpmain

	mkdir -p $main_hdir/config
	mkdir -p $main_hdir/www/tmp
	mkdir -p $main_hdir/log
	mkdir -p $main_hdir/script
	mkdir -p $main_hdir/restore
	mkdir -p $main_hdir/tmp
	mkdir -p $main_hdir/certs

	chmod -R 0700 $main_hdir
	chown -R rhpmain:rhpenguin $main_hdir

	chmod -R 0700 $main_hdir/www/tmp
}

setup_rhpprotected_dirs() {
	protected_hdir=/var/lib/rhpprotected

	mkdir -p $protected_hdir/config
	mkdir -p $protected_hdir/certs
	mkdir -p $protected_hdir/script
	mkdir -p $protected_hdir/rhptrace
	mkdir -p $protected_hdir/restore
	mkdir -p $protected_hdir/tmp

	chmod -R 0700 $protected_hdir
	chown -R rhpprotected:rhpenguin $main_hdir
}

msg_blue() {
    printf "${blue}==>${bold} $1${all_off}\n"
}

note() {
    printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
}

all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

post_install(){
	groupadd -g 1006 rhpenguin &> /dev/null
	useradd -g 1006 -d /var/lib/rhpmain -s /bin/false rhpmain &> /dev/null
	useradd -g 1006 -d /var/lib/rhpprotected -s /bin/false rhpprotected &> /dev/null

	setup_rhpmain_dirs

	setup_rhpprotected_dirs

	#setcap
	setcap cap_net_admin,cap_net_raw=eip /var/lib/rhpprotected/script/rhp_netmng

	note "[NOTICE]";
	msg_blue " - Default administrator's information for management";
	msg_blue "   tools (Web console and rockhopper command):";
	msg_blue "     Name    : admin";
	msg_blue "     Password: secret";
	msg_blue "   Please change the default password immediately!";
	msg_blue " - A default HTTP URL for Web Management Service:";
	msg_blue "     URL: http://127.0.0.1:32501/";
	msg_blue "         (http://localhost:32501/)";
	msg_blue "   Web console has been tested only on Firefox and";
	msg_blue "   Google Chrome.";
	msg_blue "Rockhopper was successfully installed.";
	msg_blue "Enjoy,                    --- Rockhopper VPN Project";
}


post_update() {
	setup_rhpmain_dirs

	setup_rhpprotected_dirs

	#setcap
	setcap cap_net_admin,cap_net_raw=eip /var/lib/rhpprotected/script/rhp_netmng

	note "[NOTICE]";
	msg_blue " - Default administrator's information for management";
	msg_blue "   tools (Web console and rockhopper command):";
	msg_blue "     Name    : admin";
	msg_blue "     Password: secret";
	msg_blue "   Please change the default password immediately!";
	msg_blue " - A default HTTP URL for Web Management Service:";
	msg_blue "     URL: http://127.0.0.1:32501/";
	msg_blue "         (http://localhost:32501/)";
	msg_blue "   Web console has been tested only on Firefox and";
	msg_blue "   Google Chrome.";
	msg_blue "Rockhopper was successfully installed.";
	msg_blue "Enjoy,                    --- Rockhopper VPN Project";
}