Skip to content

Commit b37cea6

Browse files
authored
Merge branch 'master' into issues/562-fatal-auth-path-fix
2 parents 35cfe01 + 0754c16 commit b37cea6

7 files changed

Lines changed: 92 additions & 10 deletions

File tree

.github/workflows/backport.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Backport fixes to stable branch
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
issue_comment:
8+
types: [created]
9+
10+
concurrency:
11+
group: backport-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: false
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
backport-on-push:
20+
if: github.event_name == 'push'
21+
uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
22+
with:
23+
commit_sha: ${{ github.sha }}
24+
secrets:
25+
app_id: ${{ secrets.OPENWISP_BOT_APP_ID }}
26+
private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
27+
28+
backport-on-comment:
29+
if: >
30+
github.event_name == 'issue_comment' &&
31+
github.event.issue.pull_request &&
32+
github.event.issue.pull_request.merged_at != null &&
33+
github.event.issue.state == 'closed' &&
34+
contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) &&
35+
startsWith(github.event.comment.body, '/backport')
36+
uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
37+
with:
38+
pr_number: ${{ github.event.issue.number }}
39+
comment_body: ${{ github.event.comment.body }}
40+
secrets:
41+
app_id: ${{ secrets.OPENWISP_BOT_APP_ID }}
42+
private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}

images/common/services.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88

99

1010
def database_status():
11+
import psycopg
12+
1113
try:
12-
psycopg2.connect(
14+
with psycopg.connect(
1315
dbname=os.environ["DB_NAME"],
1416
user=os.environ["DB_USER"],
1517
password=os.environ["DB_PASS"],
@@ -19,8 +21,9 @@ def database_status():
1921
sslcert=os.environ["DB_SSLCERT"],
2022
sslkey=os.environ["DB_SSLKEY"],
2123
sslrootcert=os.environ["DB_SSLROOTCERT"],
22-
)
23-
except psycopg2.OperationalError:
24+
):
25+
pass
26+
except psycopg.OperationalError:
2427
time.sleep(3)
2528
return False
2629
else:
@@ -74,8 +77,6 @@ def redis_status():
7477
arguments = sys.argv[1:]
7578
# Database Connection
7679
if "database" in arguments:
77-
import psycopg2
78-
7980
print("Waiting for database to become available...")
8081
connected = False
8182
while not connected:

images/openwisp_base/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
channels_redis
22
service_identity
33
django-redis
4-
psycopg2
4+
# pool is useful in prod deployments we include it
5+
# by default, but has to be configured manually
6+
psycopg[binary,pool]<4.0.0
57
sentry-sdk
68
supervisor>=4.3.0,<4.4.0
79
django-cors-headers>=4.9.0,<4.10.0

images/openwisp_dashboard/load_init_data.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def create_default_vpn_template(vpn):
124124
if Template.objects.filter(vpn=vpn).exists():
125125
return Template.objects.get(vpn=vpn)
126126

127-
template = Template.objects.create(
127+
template = Template(
128128
auto_cert=True,
129129
name=template_name,
130130
type="vpn",
@@ -133,6 +133,11 @@ def create_default_vpn_template(vpn):
133133
vpn=vpn,
134134
default=True,
135135
)
136+
# The config field is auto-generated on full_clean()
137+
template.full_clean()
138+
if template.config.get("openvpn"):
139+
template.config["openvpn"][0]["log"] = "/var/log/tun0.log"
140+
# Verify that the config is still valid.
136141
template.full_clean()
137142
template.save()
138143
return template
@@ -196,6 +201,26 @@ def create_ssh_key_template():
196201
return template
197202

198203

204+
def update_default_site():
205+
"""Update default site with DASHBOARD_DOMAIN."""
206+
if "django.contrib.sites" in settings.INSTALLED_APPS:
207+
from django.contrib.sites.models import Site
208+
209+
try:
210+
site = Site.objects.get(pk=settings.SITE_ID)
211+
except Site.DoesNotExist:
212+
# Optionally log a message here if desired
213+
return
214+
dashboard_domain = os.environ.get("DASHBOARD_DOMAIN", "")
215+
if (
216+
site.name == "example.com" or site.domain == "example.com"
217+
) and dashboard_domain:
218+
site.name = dashboard_domain
219+
site.domain = dashboard_domain
220+
site.full_clean()
221+
site.save()
222+
223+
199224
def create_default_topology(vpn):
200225
"""Creates Topology object for the default VPN."""
201226
if vpn.backend == "openwisp_controller.vpn_backends.OpenVpn":
@@ -239,6 +264,7 @@ def create_default_topology(vpn):
239264
redis_client = redis.Redis.from_url(settings.CACHES["default"]["LOCATION"])
240265

241266
create_admin()
267+
update_default_site()
242268
# Steps for creating new vpn client template with all the
243269
# required objects (CA, Certificate, VPN Server).
244270
is_vpn_enabled = os.environ.get("VPN_DOMAIN", "") != ""

images/openwisp_dashboard/openvpn.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
"local": "",
1212
"comp_lzo": "no",
1313
"auth": "SHA1",
14-
"cipher": "none",
14+
"data_ciphers": [
15+
{
16+
"cipher": "AES-128-GCM",
17+
"optional": false
18+
},
19+
{
20+
"cipher": "none",
21+
"optional": false
22+
}
23+
],
24+
"data_ciphers_fallback": "AES-128-GCM",
25+
"cipher": "AES-128-GCM",
1526
"engine": "",
1627
"ca": "ca.pem",
1728
"cert": "cert.pem",

images/openwisp_openvpn/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# hadolint ignore=DL3007
2-
FROM kylemanna/openvpn:2.4
2+
FROM lisenet/openvpn:2.6.17
33

44
# hadolint ignore=DL3018
55
RUN apk add --no-cache \

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
docker>=7.1.0,<7.2.0
2-
openwisp-utils[qa,selenium]~=1.2.1
2+
openwisp-utils[qa,selenium]>=1.2.2,<1.3.0

0 commit comments

Comments
 (0)