-
Notifications
You must be signed in to change notification settings - Fork 0
/
softetherAdmin.jps
181 lines (160 loc) · 4.72 KB
/
softetherAdmin.jps
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
type: update
name: 'SoftEther VPN Server Admin Tools'
id: 'SoftEtherVPNServerAdminTools'
homepage: https://github.com/layershift/jps-softether/
baseUrl: https://raw.githubusercontent.com/layershift/jps-softether/main
logo: /images/SoftEtherLogo.png?_r=${fn.random}
categories:
- apps/others
description:
text: /texts/description.md
short: |
SoftEther VPN Server Admin Tools.
version: 2023030302
targetNodes:
nodeGroup: 'vpn_vds'
globals:
message: ""
settings:
UserNameAdd:
fields:
- type: string
caption: Username
name: username
required: true
UserNameSetPassword:
fields:
- type: string
caption: Username
name: username
required: true
UserNameDel:
fields:
- type: string
caption: Username
name: username
required: true
buttons:
- caption: User List
loadingText: Checking..
action: SoftEtherUserList
- menu:
- caption: Add User
settings: UserNameAdd
action: SoftEtherUerAdd
confirmText:
title: Add VPN User
submitButtonText: Add User
- caption: Set User Password
settings: UserNameSetPassword
action: SoftEtherUerSetPassword
confirmText: Are you sure you wish to generate a new random password for this VPN user?
title: Set User Password
- caption: Delete User
settings: UserNameDel
action: SoftEtherUerDelete
confirmText: Are you sure you wish to delete this VPN user?
title: Delete VPN User
onAfterRedeployContainer:
install:
name: Install Action
onAfterAddNode:
install:
name: Install Action
onAfterCloneNodes:
install:
name: Install Action
onInstall:
install:
name: Install Action
onUninstall:
cmd [${targetNodes.nodeGroup}]:
- echo "uninstall";
sayYes: true
actions:
appendMessage:
setGlobals:
message: ${globals.message}${this}
install:
cmd [${targetNodes.nodeGroup}]:
- echo "install";
sayYes: true
SoftEtherUerDelete:
- setGlobals:
- message: ""
- forEach(node:targetNodes):
- cmd [${@node.id}]:
- echo -e " - On node ${@node.id}\n\n ~~~~";
- /usr/local/vpnserver/userDel.sh "${settings.username}"
- echo -e "~~~~~";
user: root
- appendMessage: ${response.out}
- if (globals.message.indexOf("Error") !== -1):
message: ${globals.message}
script: |
return {result: 2309, message: message.replace(/\n/g, ' \n')}
- if (globals.message.length > 0):
return:
type: success
message: '${globals.message}'
SoftEtherUerSetPassword:
- setGlobals:
- message: ""
- forEach(node:targetNodes):
- cmd [${@node.id}]:
- echo -e " - On node ${@node.id}\n\n ~~~~";
- /usr/local/vpnserver/userSetPasswd.sh "${settings.username}"
- echo -e "~~~~~";
user: root
- appendMessage: ${response.out}
- if (globals.message.indexOf("Error") !== -1):
message: ${globals.message}
script: |
return {result: 2309, message: message.replace(/\n/g, ' \n')}
- if (globals.message.length > 0):
return:
type: success
message: '${globals.message}'
SoftEtherUerAdd:
- setGlobals:
- message: ""
- forEach(node:targetNodes):
- cmd [${@node.id}]:
- echo -e " - On node ${@node.id}\n\n ~~~~";
- /usr/local/vpnserver/userAdd.sh "${settings.username}"
- echo -e "~~~~~";
user: root
- appendMessage: ${response.out}
- if (globals.message.indexOf("Error") !== -1):
message: ${globals.message}
script: |
return {result: 2309, message: message.replace(/\n/g, ' \n')}
- if (globals.message.length > 0):
return:
type: success
message: '${globals.message}'
SoftEtherUserList:
- setGlobals:
- message: ""
- forEach(node:targetNodes):
- cmd [${@node.id}]:
- echo -e " - On node ${@node.id}\nConfigured users \n ~~~~";
- /usr/local/vpnserver/userList.sh 2>&1 > /dev/null;
- if [ $? -eq 0 ]; then echo -e "$(/usr/local/vpnserver/userList.sh | grep "User Name" | awk -F "|" '{print $NF}' | tr " " "\n")"; echo -e " \n"; else echo -e "Error=Failed to fetch data\n"; fi;
- echo -e "~~~~~";
user: root
- appendMessage: ${response.out}
- if (globals.message.indexOf("Error") !== -1):
message: ${globals.message}
script: |
return {result: 2309, message: message.replace(/\n/g, ' \n')}
- if (globals.message.length > 0):
return:
type: success
message: '${globals.message}'
responses:
2308:
type: success
2309:
type: error
success: /texts/success.md