shadowsocks-manager 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shadowsocks_manager-0.1.1/LICENSE +21 -0
- shadowsocks_manager-0.1.1/PKG-INFO +475 -0
- shadowsocks_manager-0.1.1/README.md +410 -0
- shadowsocks_manager-0.1.1/bin/ssm-dev-start +34 -0
- shadowsocks_manager-0.1.1/bin/ssm-dev-stop +20 -0
- shadowsocks_manager-0.1.1/bin/ssm-setup +221 -0
- shadowsocks_manager-0.1.1/bin/ssm-test +113 -0
- shadowsocks_manager-0.1.1/pyproject.toml +3 -0
- shadowsocks_manager-0.1.1/setup.cfg +107 -0
- shadowsocks_manager-0.1.1/setup.py +5 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/__main__.py +45 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/args_formatter/__init__.py +74 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/args_formatter/tests.py +42 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/admin.py +78 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/migrations/0001_initial.py +79 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/models.py +265 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/serializers.py +25 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/tests.py +138 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/urls.py +18 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/domain/views.py +38 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/admin.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/models.py +96 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/tests.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/dynamicmethod/views.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/manage.py +29 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/admin.py +18 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/migrations/0001_initial.py +40 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/models.py +66 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/serializers.py +13 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/tests.py +93 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/urls.py +16 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/notification/views.py +19 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/retry/__init__.py +68 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/retry/tests.py +42 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocks_manager/__init__.py +6 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocks_manager/celery.py +27 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocks_manager/settings.py +217 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocks_manager/urls.py +31 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocks_manager/wsgi.py +19 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/admin.py +188 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/management/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/management/commands/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/management/commands/shadowsocks_config.py +24 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/migrations/0001_initial.py +114 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/models.py +1024 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/serializers.py +41 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/tasks.py +21 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/tests.py +470 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/urls.py +20 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/shadowsocksz/views.py +53 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/admin.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/models.py +46 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/tests.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/singleton/views.py +8 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/admin.py +78 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/apps.py +10 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/migrations/0001_initial.py +57 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/migrations/0002_auto_20210313_1419.py +19 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/migrations/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/models.py +308 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/serializers.py +19 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/tasks.py +17 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/tests.py +99 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/urls.py +16 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/statistic/views.py +26 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/__init__.py +0 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/celery.py +28 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/createsuperuser.py +57 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/dotenv.py +70 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/manage.py +29 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager/utils/uwsgi.py +27 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/PKG-INFO +475 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/SOURCES.txt +93 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/dependency_links.txt +1 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/entry_points.txt +7 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/requires.txt +39 -0
- shadowsocks_manager-0.1.1/shadowsocks_manager.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Alex Zhang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: shadowsocks-manager
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A shadowsocks manager for multi-user and traffic statistics
|
|
5
|
+
Home-page: https://github.com/alexzhangs/shadowsocks-manager
|
|
6
|
+
Author: Alex
|
|
7
|
+
Author-email: alexzhangs@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: shadowsocks,manager,django,web,statistics,cluster,celery,uwsgi,pypi,docker,github-actions
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Web Environment
|
|
12
|
+
Classifier: Framework :: Django
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 2
|
|
19
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Topic :: Internet :: Proxy Servers
|
|
28
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
29
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
|
30
|
+
Classifier: Topic :: Security :: Cryptography
|
|
31
|
+
Classifier: Topic :: System :: Networking :: Firewalls
|
|
32
|
+
Classifier: Topic :: System :: Systems Administration
|
|
33
|
+
Requires-Python: >=2.7
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: future
|
|
37
|
+
Requires-Dist: six
|
|
38
|
+
Requires-Dist: boto3
|
|
39
|
+
Requires-Dist: celery
|
|
40
|
+
Requires-Dist: Django<4
|
|
41
|
+
Requires-Dist: django-allowedsites-dynamic
|
|
42
|
+
Requires-Dist: django-cache-lock
|
|
43
|
+
Requires-Dist: django-celery-beat==1.6.0; python_version <= "2.7"
|
|
44
|
+
Requires-Dist: django-celery-beat<2.6.0; python_version < "3.8"
|
|
45
|
+
Requires-Dist: django-celery-beat; python_version >= "3.8"
|
|
46
|
+
Requires-Dist: django-celery-results==2.0.1; python_version <= "2.7"
|
|
47
|
+
Requires-Dist: django-celery-results; python_version > "2.7"
|
|
48
|
+
Requires-Dist: django-enumfield<3.0; python_version <= "2.7"
|
|
49
|
+
Requires-Dist: django-enumfield; python_version > "2.7"
|
|
50
|
+
Requires-Dist: django-filter~=1.1; python_version <= "2.7"
|
|
51
|
+
Requires-Dist: django-filter; python_version > "2.7"
|
|
52
|
+
Requires-Dist: django-import-export
|
|
53
|
+
Requires-Dist: djangorestframework
|
|
54
|
+
Requires-Dist: docopt
|
|
55
|
+
Requires-Dist: ipaddress; python_version < "3.3"
|
|
56
|
+
Requires-Dist: psutil
|
|
57
|
+
Requires-Dist: python-crontab==2.6.0; python_version <= "2.7"
|
|
58
|
+
Requires-Dist: python-crontab; python_version > "2.7"
|
|
59
|
+
Requires-Dist: python-decouple
|
|
60
|
+
Requires-Dist: python-memcached==1.59
|
|
61
|
+
Requires-Dist: pytz
|
|
62
|
+
Requires-Dist: requests
|
|
63
|
+
Requires-Dist: shadowsocks-alexforks
|
|
64
|
+
Requires-Dist: uWSGI
|
|
65
|
+
|
|
66
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/tags)
|
|
67
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/)
|
|
68
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/commits/master)
|
|
69
|
+
|
|
70
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/actions/workflows/main.yml)
|
|
71
|
+
[](https://codecov.io/gh/alexzhangs/shadowsocks-manager)
|
|
72
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/issues)
|
|
73
|
+
[](https://github.com/alexzhangs/shadowsocks-manager/pulls)
|
|
74
|
+
|
|
75
|
+
# shadowsocks-manager
|
|
76
|
+
|
|
77
|
+
A web-based Shadowsocks management tool.
|
|
78
|
+
|
|
79
|
+
Features:
|
|
80
|
+
|
|
81
|
+
* Central user management
|
|
82
|
+
* Heartbeat on Shadowsocks ports(users)
|
|
83
|
+
* Shadowsocks multi-user API
|
|
84
|
+
* Shadowsocks node cluster
|
|
85
|
+
* Statistic for network traffic usage
|
|
86
|
+
* Scheduled jobs
|
|
87
|
+
* name.com API
|
|
88
|
+
* Auto-creating DNS records
|
|
89
|
+
* Production deployment ready
|
|
90
|
+
* How's the Shadowsocks supported:
|
|
91
|
+
* libev edition:
|
|
92
|
+
* Full functional.
|
|
93
|
+
* No builtin service manager, you need to install it and start the service by yourself.
|
|
94
|
+
* python edition:
|
|
95
|
+
* Lacks the collection of traffic statistics.
|
|
96
|
+
* Lacks the ability to test user port creation status.
|
|
97
|
+
* Pre-installed, and have a builtin service manager.
|
|
98
|
+
|
|
99
|
+
Code in Python, base on Django, Django REST framework, Celery, and SQLite.
|
|
100
|
+
|
|
101
|
+
The development status can be found at: [project home](https://github.com/alexzhangs/shadowsocks-manager/projects/1).
|
|
102
|
+
|
|
103
|
+
Node List:
|
|
104
|
+

|
|
105
|
+
|
|
106
|
+
Node's Shadowsocks Manager:
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1. Requirements
|
|
111
|
+
|
|
112
|
+
* Python 2.7, Python 3.x
|
|
113
|
+
* Django 1.11.x, Django 3.x
|
|
114
|
+
* macOS Big Sur
|
|
115
|
+
* [AWS Amazon Linux AMI](https://aws.amazon.com/amazon-linux-ami/)
|
|
116
|
+
* [AWS Amazon Linux 2 AMI](https://aws.amazon.com/amazon-linux-2/)
|
|
117
|
+
* [Shadowsocks-libev 3.2.0 for Linux (multi-user API is required)](https://github.com/shadowsocks/shadowsocks-libev)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## 2. Install
|
|
121
|
+
|
|
122
|
+
This project is a part of an entire VPN solution, which includes the Shadowsocks server and Shadowsocks manager. The Shadowsocks server serves the traffic, the Shadowsocks manager serves the users and the traffic statistics. The solution is designed to be deployed in the AWS cloud. If you are looking for such a solution, you can refer to the repo [aws-cfn-vpn](https://github.com/alexzhangs/aws-cfn-vpn). With `aws-cfn-vpn`, you can deploy the entire solution with a few commands.
|
|
123
|
+
|
|
124
|
+
### 2.1. Dependencies
|
|
125
|
+
|
|
126
|
+
Assume you have installed the [Docker](https://www.docker.com/) on your host.
|
|
127
|
+
|
|
128
|
+
### 2.2. Manual installation
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
# create a docker network
|
|
132
|
+
docker network create ssm-network
|
|
133
|
+
|
|
134
|
+
# run memcached, used by django cache
|
|
135
|
+
docker run -d -p 11211:11211 --network ssm-network --name ssm-memcached memcached
|
|
136
|
+
|
|
137
|
+
# run rabbitmq, used by celery
|
|
138
|
+
docker run -d -p 5672:5672 --network ssm-network --name ssm-rabbitmq rabbitmq
|
|
139
|
+
|
|
140
|
+
# create a directory to store the data, it will be mounted to the container
|
|
141
|
+
mkdir -p ~/ssm-volume
|
|
142
|
+
|
|
143
|
+
# run the shadowsocks-manager
|
|
144
|
+
docker run -d -p 80:80 --network ssm-network -v ~/ssm-volume:/var/local/ssm --name ssm alexzhangs/shadowsocks-manager \
|
|
145
|
+
-e SSM_SECRET_KEY=yourkey -e SSM_DEBUG=False -e SSM_MEMCACHED_HOST=ssm-memcached -e SSM_RABBITMQ_HOST=ssm-rabbitmq \
|
|
146
|
+
-u admin -p yourpassword -M admin@yourdomain.com
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 2.3. Install with script
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
git clone https://github.com/alexzhangs/shadowsocks-manager
|
|
153
|
+
bash shadowsocks-manager/install.sh -u admin -p yourpassword -M admin@yourdomain.com
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 2.4. Verify the installation
|
|
157
|
+
|
|
158
|
+
If all go smoothly, the shadowsocks-manager services should have been all started. Open the web admin console in a web browser, and log on with the admin user.
|
|
159
|
+
|
|
160
|
+
Use:
|
|
161
|
+
```
|
|
162
|
+
http://<your_server_ip>/admin
|
|
163
|
+
or
|
|
164
|
+
http://localhost/admin
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
If goes well, then congratulations! The installation has succeeded.
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 3. Using shadowsocks-manager
|
|
171
|
+
|
|
172
|
+
1. Shadowsocks server
|
|
173
|
+
|
|
174
|
+
First, you need to have a Shadowsocks server with the multi-user API
|
|
175
|
+
enabled.
|
|
176
|
+
|
|
177
|
+
About how to install and configure Shadowsocks server in AWS, refer
|
|
178
|
+
to the repo
|
|
179
|
+
[aws-ec2-shadowsocks-libev](https://github.com/alexzhangs/aws-ec2-shadowsocks-libev)
|
|
180
|
+
|
|
181
|
+
After the server is installed and started, there should be a
|
|
182
|
+
running process named `ss-manager`. Write down the IP address and
|
|
183
|
+
the port that the `ss-manager` is listening on, and also the public IP
|
|
184
|
+
address of the server, the encryption method that Shadowsocks is using,
|
|
185
|
+
they are going to be used in the next step.
|
|
186
|
+
|
|
187
|
+
1. Add Shadowsocks server to shadowsocks-manager
|
|
188
|
+
|
|
189
|
+
Add the Shadowsocks server as a Node of shadowsocks-manager from
|
|
190
|
+
web admin console: `Home › Shadowsocks › Shadowsocks Nodes`.
|
|
191
|
+
|
|
192
|
+
1. Create users(ports) and assign Shadowsocks Node
|
|
193
|
+
|
|
194
|
+
Create users from web admin console: `Home › Shadowsocks ›
|
|
195
|
+
Shadowsocks Accounts` and assign the existing nodes to them.
|
|
196
|
+
|
|
197
|
+
After a few seconds, the created user ports should be available to your
|
|
198
|
+
Shadowsocks client.
|
|
199
|
+
|
|
200
|
+
1. The builtin local service manager for Shadowsocks python edition
|
|
201
|
+
|
|
202
|
+
There's a builtin local service manager available for the Shadowsocks `python edition`.
|
|
203
|
+
|
|
204
|
+
The `python edition` is pre-installed with `shadowsocks-manager`. With the service manager, you can start&stop
|
|
205
|
+
the local service daemon on-the-fly. Check it out from the web admin console `Home › Shadowsocks › Shadowsocks Nodes`,
|
|
206
|
+
under the `SHADOWSOCKS MANAGERS` tab.
|
|
207
|
+
|
|
208
|
+
However the `traffice statistics` and `user port creation status` features are not available for the
|
|
209
|
+
`python edition`.
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
## 4. Sendmail (Optional)
|
|
213
|
+
|
|
214
|
+
`sendmail` is used to send account notification Email, it should
|
|
215
|
+
be configured on the same server with shadowsocks-manager.
|
|
216
|
+
|
|
217
|
+
About how to configure `sendmail` client to use AWS SES as SMTP server on AWS EC2 instance, refer to repo
|
|
218
|
+
[aws-ec2-ses](https://github.com/alexzhangs/aws-ec2-ses).
|
|
219
|
+
|
|
220
|
+
On macOS, refer to repo
|
|
221
|
+
[macos-aws-ses](https://github.com/alexzhangs/macos-aws-ses).
|
|
222
|
+
|
|
223
|
+
NOTE: This dependency needs the manual setup anyway, it is not handled by any installation script.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 5. Differences from the alternation: [shadowsocks/shadowsocks-manager](https://github.com/shadowsocks/shadowsocks-manager)
|
|
227
|
+
|
|
228
|
+
**This repo Do's:**
|
|
229
|
+
|
|
230
|
+
* Serve as a nonprofit business model.
|
|
231
|
+
* Have central user management for multi nodes.
|
|
232
|
+
* Collect traffic statistic that can be viewed by account, node, and period.
|
|
233
|
+
* Show the existence and accessibility of ports in the admin.
|
|
234
|
+
* Handle the DNS records if using Name.com as nameserver.
|
|
235
|
+
|
|
236
|
+
**This repo Don'ts:**
|
|
237
|
+
|
|
238
|
+
* Handle self-serviced user registration.
|
|
239
|
+
* Handle bill or payment.
|
|
240
|
+
* Need to run an additional agent on each Shadowsocks server.
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
## 6. Some differences between the Shadowsocks Python edition (2.8.2) and libev edition
|
|
244
|
+
|
|
245
|
+
Version status for the Shadowsocks Python edition:
|
|
246
|
+
* pypi: [2.8.2](https://pypi.org/project/shadowsocks/)
|
|
247
|
+
* github: [3.0.0](https://github.com/shadowsocks/shadowsocks/tree/master)
|
|
248
|
+
|
|
249
|
+
Although the Shadowsocks Python edition
|
|
250
|
+
supports the multi-user API, but it doesn't fit this project, here's why:
|
|
251
|
+
|
|
252
|
+
* The python edition code and doc seem to be out of maintenance due to some reason. If you really need this you probably need to fork it and make your own.
|
|
253
|
+
* They are having different service process names and CLI interfaces which introduces the complexity of installation.
|
|
254
|
+
* The Python edition lacks the `list` commands. A pull request was opened years ago but never merged.
|
|
255
|
+
* The Python edition's `stat` command has a very different way to use, I didn't figure the usage syntax out by looking into the code.
|
|
256
|
+
* The Python edition's `ping` command returns a simple string `pong` rather than a list of ports.
|
|
257
|
+
* The Python edition's `ping` command has to be sent as the syntax: `ping:{}` in order to work if tested with `nc`. It caused by the tailing newline: `ping\n`.
|
|
258
|
+
|
|
259
|
+
So either you get some change on your own or stick with the libev edition.
|
|
260
|
+
|
|
261
|
+
### Update for Shadowsocks Python edition on 2024-04
|
|
262
|
+
|
|
263
|
+
Both the pypi version (2.8.2) and the github master branch (3.0.0) failed to start `ssserver` due to the upstream and dependency changes.
|
|
264
|
+
|
|
265
|
+
Since the Python edition is pre-installed in this project, mainly for running test cases, I have to make a patch to make it work.
|
|
266
|
+
|
|
267
|
+
The fix based on github master branch 3.0.0, and would be minimal, just to make the `ssserver` start without any error, no more features added.
|
|
268
|
+
After the fix, the pre-installed Python edition will be changed from the pypi version to [my fork](https://github.com/alexforks/shadowsocks/tree/master).
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## 7. Known Issues
|
|
272
|
+
|
|
273
|
+
1. DNS records matching for Node may not be accurate on macOS.
|
|
274
|
+
For unknown reason sometimes DNS query returns only one IP address
|
|
275
|
+
while multiple IP addresses were configured for the domain.
|
|
276
|
+
|
|
277
|
+
1. The Shadowsocks Python edition's ssserver won't start on macOS.
|
|
278
|
+
The error message is like:
|
|
279
|
+
```
|
|
280
|
+
$ ssserver -k passw0rd
|
|
281
|
+
WARNING: /Users/***/.pyenv/versions/3.12.0/envs/ssm-3.12/bin/python3.12 is loading libcrypto in an unsafe way
|
|
282
|
+
Abort trap: 6
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Solution:
|
|
286
|
+
Link the homebrew openssl library to the system library.
|
|
287
|
+
```sh
|
|
288
|
+
sudo ln -s /opt/homebrew/opt/openssl/lib/libcrypto.dylib /usr/local/lib/
|
|
289
|
+
sudo ln -s /opt/homebrew/opt/openssl/lib/libssl.dylib /usr/local/lib/
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
1. Install the project with pip under Python 2.7 get error:
|
|
293
|
+
```
|
|
294
|
+
pip install -e .
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Error message:
|
|
298
|
+
```
|
|
299
|
+
...
|
|
300
|
+
Collecting pyyaml
|
|
301
|
+
Downloading PyYAML-5.4.1.tar.gz (175 kB)
|
|
302
|
+
|████████████████████████████████| 175 kB 392 kB/s
|
|
303
|
+
Installing build dependencies ... done
|
|
304
|
+
Getting requirements to build wheel ... error
|
|
305
|
+
ERROR: Command errored out with exit status 1:
|
|
306
|
+
...
|
|
307
|
+
raise AttributeError, attr
|
|
308
|
+
AttributeError: cython_sources
|
|
309
|
+
...
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Solution:
|
|
313
|
+
```sh
|
|
314
|
+
pip install --no-build-isolation -e .
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 8. Development
|
|
319
|
+
|
|
320
|
+
1. Install the dependencies
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
# run memcached, used by django cache
|
|
324
|
+
docker run -d -p 11211:11211 --name ssm-memcached memcached
|
|
325
|
+
|
|
326
|
+
# run rabbitmq, used by celery
|
|
327
|
+
docker run -d -p 5672:5672 --name ssm-rabbitmq rabbitmq
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
1. Link the project code in your workspace to the Python environment
|
|
331
|
+
|
|
332
|
+
```sh
|
|
333
|
+
cd shadowsocks-manager
|
|
334
|
+
pip install -e .
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
1. Configure the shadowsocks-manager
|
|
338
|
+
|
|
339
|
+
```sh
|
|
340
|
+
ssm-setup -c -m -l -u admin -p yourpassword
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
1. Run the development server
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
ssm-dev-start
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
1. Stop the development server
|
|
350
|
+
|
|
351
|
+
```sh
|
|
352
|
+
ssm-dev-stop
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
1. Test the Django code
|
|
356
|
+
|
|
357
|
+
```sh
|
|
358
|
+
ssm-test -t
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
1. Test the Django code with coverage
|
|
362
|
+
|
|
363
|
+
```sh
|
|
364
|
+
pip install coverage
|
|
365
|
+
ssm-test -c
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
1. Upload the coverage report to codecov
|
|
369
|
+
|
|
370
|
+
Make sure the `CODECOV_TOKEN` is exported in the environment before uploading.
|
|
371
|
+
|
|
372
|
+
```sh
|
|
373
|
+
pip install codecov-cli
|
|
374
|
+
ssm-test -u
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
1. Test the Github workflows locally
|
|
378
|
+
|
|
379
|
+
```sh
|
|
380
|
+
brew install act
|
|
381
|
+
act -j test
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
1. Build the pypi package
|
|
385
|
+
|
|
386
|
+
```sh
|
|
387
|
+
pip install build
|
|
388
|
+
|
|
389
|
+
# build source distribution, equivalent to `python setup.py sdist`
|
|
390
|
+
python -m build -s
|
|
391
|
+
|
|
392
|
+
# build binary distribution for py3, equivalent to `python setup.py bdist_wheel`
|
|
393
|
+
python3 -m build -w
|
|
394
|
+
|
|
395
|
+
# build binary distribution for py2
|
|
396
|
+
python2 -m build -w
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
1. Upload the pypi package
|
|
400
|
+
|
|
401
|
+
Set the ~/.pypirc file with the API token from the TestPyPI and PyPI before uploading.
|
|
402
|
+
|
|
403
|
+
```sh
|
|
404
|
+
pip install twine
|
|
405
|
+
|
|
406
|
+
# upload the package to the test pypi
|
|
407
|
+
python -m twine upload --repository testpypi dist/*
|
|
408
|
+
|
|
409
|
+
# upload the package to the live pypi
|
|
410
|
+
python -m twine upload dist/*
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
1. Test the pypi package
|
|
414
|
+
|
|
415
|
+
```sh
|
|
416
|
+
# install the package from the test pypi
|
|
417
|
+
# --no-deps is used to skip installing dependencies for the test pypi
|
|
418
|
+
pip install -i https://test.pypi.org/simple/ --no-deps shadowsocks-manager
|
|
419
|
+
|
|
420
|
+
# install the package from the live pypi
|
|
421
|
+
# --no-binary is used to force building the package from the source
|
|
422
|
+
# --use-pep517 is used together to make sure the PEP 517 is tested
|
|
423
|
+
pip install --no-binary --use-pep517 shadowsocks-manager
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
1. Build the docker image
|
|
427
|
+
|
|
428
|
+
```sh
|
|
429
|
+
docker build -t alexzhangs/shadowsocks-manager .
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
## 9. Troubleshooting
|
|
434
|
+
|
|
435
|
+
1. Check the logs
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
# supervisor
|
|
439
|
+
cat /var/log/supervisor/supervisord.log
|
|
440
|
+
|
|
441
|
+
# uWSGI
|
|
442
|
+
cat /var/log/ssm-uwsgi.log
|
|
443
|
+
|
|
444
|
+
# Celery
|
|
445
|
+
cat /var/log/ssm-cerlery*
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
1. Check the services
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
# nginx
|
|
452
|
+
service nginx {status|start|stop|reload}
|
|
453
|
+
|
|
454
|
+
# supervisor
|
|
455
|
+
service supervisord {status|start|stop|restart}
|
|
456
|
+
supervisorctl reload
|
|
457
|
+
supervisorctl start all
|
|
458
|
+
|
|
459
|
+
# uWSGI
|
|
460
|
+
supervisorctl start ssm-uwsgi
|
|
461
|
+
|
|
462
|
+
# Celery
|
|
463
|
+
supervisorctl start ssm-celery-worker
|
|
464
|
+
supervisorctl start ssm-celery-beat
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
1. Check the listening ports (Linux)
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
# TCP
|
|
471
|
+
netstat -tan
|
|
472
|
+
|
|
473
|
+
# UDP
|
|
474
|
+
netstat -uan
|
|
475
|
+
```
|