Skip to content

Commit c8c0841

Browse files
pseusyspseusys
andauthored
Dependencies update (#29)
* Separate file for pointer utils removed * dependencies updated * arguments changed * lesser fixes and dependency updates * async library update * single socket * bake enabled --------- Co-authored-by: pseusys <aleksandr.sergeev.ad@gmail.com>
1 parent 7193c6e commit c8c0841

File tree

15 files changed

+249
-231
lines changed

15 files changed

+249
-231
lines changed

caerulean/whirlpool/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
# Docker image for building whirlpool executable and testing
4-
FROM golang:1.23-alpine AS builder
4+
FROM golang:1.24-alpine3.22 AS builder
55

66
WORKDIR /seaside/caerulean
77

@@ -28,7 +28,7 @@ RUN go build -o whirlpool.run ./sources
2828

2929

3030
# Docker image for whirlpool executable production running
31-
FROM alpine:3.17 AS default
31+
FROM alpine:3.22 AS default
3232

3333
WORKDIR /seaside/caerulean
3434

@@ -74,9 +74,9 @@ ENV SEASIDE_CERTIFICATE_PATH=/seaside/caerulean/certificates/caerulean
7474

7575
RUN apk add --no-cache openssl
7676
RUN mkdir -p /tmp/certificates/caerulean && mkdir -p /tmp/certificates/viridian && cd /tmp/certificates \
77-
&& openssl req -digest -newkey rsa:2048 -sha256 -nodes -keyout viridian/cert.key -out viridian/cert.csr -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNViridian" -addext "subjectAltName = IP:${SEASIDE_ADDRESS}" -addext "keyUsage=critical,digitalSignature" -addext "extendedKeyUsage=clientAuth" \
78-
&& openssl req -digest -newkey rsa:2048 -sha256 -nodes -keyout caerulean/cert.key -out caerulean/cert.csr -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNCaerulean" -addext "subjectAltName = IP:${SEASIDE_ADDRESS}" -addext "keyUsage=critical,digitalSignature,keyEncipherment" -addext "extendedKeyUsage=serverAuth" \
79-
&& openssl req -digest -newkey rsa:2048 -sha256 -nodes -new -x509 -keyout caerulean/rootCA.key -out caerulean/rootCA.crt -days 365250 -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNRootCA" -addext "basicConstraints=critical,CA:true" -addext "keyUsage=critical,keyCertSign,cRLSign" \
77+
&& openssl req -newkey rsa:2048 -nodes -keyout viridian/cert.key -out viridian/cert.csr -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNViridian" -addext "subjectAltName = IP:${SEASIDE_ADDRESS}" -addext "keyUsage=critical,digitalSignature" -addext "extendedKeyUsage=clientAuth" \
78+
&& openssl req -newkey rsa:2048 -nodes -keyout caerulean/cert.key -out caerulean/cert.csr -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNCaerulean" -addext "subjectAltName = IP:${SEASIDE_ADDRESS}" -addext "keyUsage=critical,digitalSignature,keyEncipherment" -addext "extendedKeyUsage=serverAuth" \
79+
&& openssl req -newkey rsa:2048 -nodes -new -x509 -keyout caerulean/rootCA.key -out caerulean/rootCA.crt -days 365250 -subj "/C=TS/ST=TestState/L=PC/O=SeasideVPN/OU=seaside/CN=SeasideVPNRootCA" -addext "basicConstraints=critical,CA:true" -addext "keyUsage=critical,keyCertSign,cRLSign" \
8080
&& openssl x509 -req -CA caerulean/rootCA.crt -CAkey caerulean/rootCA.key -in caerulean/cert.csr -out caerulean/cert.crt -days 365250 -copy_extensions=copyall \
8181
&& openssl x509 -req -CA caerulean/rootCA.crt -CAkey caerulean/rootCA.key -in viridian/cert.csr -out viridian/cert.crt -days 365250 -copy_extensions=copyall \
8282
&& chmod 644 */*.key && cp caerulean/rootCA.* viridian/

caerulean/whirlpool/go.mod

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
module main
22

3-
go 1.23.0
3+
go 1.24.0
4+
5+
toolchain go1.24.4
46

57
require (
68
github.com/google/nftables v0.3.0
79
github.com/pseusys/betterbuf v0.0.3
810
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
911
github.com/sirupsen/logrus v1.9.3
1012
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
11-
github.com/vishvananda/netlink v1.3.0
12-
golang.org/x/crypto v0.37.0
13-
google.golang.org/grpc v1.72.0
14-
google.golang.org/protobuf v1.36.6
13+
github.com/vishvananda/netlink v1.3.1
14+
golang.org/x/crypto v0.41.0
15+
google.golang.org/grpc v1.75.0
16+
google.golang.org/protobuf v1.36.8
1517
)
1618

1719
require (
18-
github.com/google/go-cmp v0.6.0 // indirect
19-
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 // indirect
20-
github.com/mdlayher/socket v0.5.0 // indirect
20+
github.com/google/go-cmp v0.7.0 // indirect
21+
github.com/mdlayher/netlink v1.8.0 // indirect
22+
github.com/mdlayher/socket v0.5.1 // indirect
2123
github.com/vishvananda/netns v0.0.5 // indirect
22-
golang.org/x/net v0.39.0 // indirect
23-
golang.org/x/sync v0.13.0 // indirect
24-
golang.org/x/sys v0.34.0 // indirect
25-
golang.org/x/text v0.24.0 // indirect
26-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
24+
golang.org/x/net v0.43.0 // indirect
25+
golang.org/x/sync v0.16.0 // indirect
26+
golang.org/x/sys v0.35.0 // indirect
27+
golang.org/x/text v0.28.0 // indirect
28+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 // indirect
2729
)

caerulean/whirlpool/sources/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (server *WhirlpoolServer) Authenticate(ctx context.Context, request *genera
170170
return nil, status.Error(codes.PermissionDenied, "wrong payload value")
171171
}
172172

173-
// Create and marshall user token (will be valid for 10 years for non-privileged users)
173+
// Create and marshall user token
174174
token := &generated.UserToken{
175175
Name: request.Name,
176176
Identifier: request.Identifier,

caerulean/whirlpool/users/dictionary.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (dict *ViridianDict) Add(getViridianID func() (any, uint16, error), viridia
8888

8989
// If found, resolve deletion timeout
9090
var deletionTimeout time.Duration
91-
if !token.IsAdmin {
91+
if !token.IsAdmin && token.Subscription != nil {
9292
now := time.Now()
9393
timeout := token.Subscription.AsTime()
9494
if timeout.Before(now) {
@@ -107,7 +107,7 @@ func (dict *ViridianDict) Add(getViridianID func() (any, uint16, error), viridia
107107

108108
// Finally set up deletion timer
109109
var deletionTimer *time.Timer
110-
if !token.IsAdmin {
110+
if deletionTimeout.Nanoseconds() != 0 {
111111
deletionTimer = time.AfterFunc(deletionTimeout, func() { dict.Delete(viridianID, true) })
112112
} else {
113113
deletionTimer = nil

viridian/algae/docker/Dockerfile.echo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM python:3.11-alpine AS default
3+
FROM python:3.11-alpine3.22 AS default
44

55
WORKDIR /seaside/echo
66

viridian/algae/docker/Dockerfile.router

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM alpine:3.18 AS default
3+
FROM alpine:3.22 AS default
44

55
ARG RESTRICTED_ADDRESS=0.0.0.0
66
ENV ARG_RESTRICTED_ADDRESS=$RESTRICTED_ADDRESS

viridian/algae/pyproject.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,49 +53,49 @@ repository = "https://github.com/pseusys/SeasideVPN"
5353
client = [
5454
"ansibleguy-nftables~=1.0.2.post1",
5555
"colorama~=0.4.6",
56-
"pyroute2~=0.7.9",
56+
"pyroute2~=0.9.4",
5757
"betterproto~=2.0.0b6",
5858
"pymonocypher~=4.0.2.5",
5959
"semver~=3.0.4"
6060
]
6161

6262
devel = [
63-
"pytest~=8.3.2",
63+
"pytest~=8.4.2",
6464
"pythonping~=1.1.4",
6565
"dnspython~=2.7.0",
66-
"pytest-asyncio~=0.26.0",
67-
"pytest-timeout~=2.3.1",
66+
"pytest-asyncio~=1.1.0",
67+
"pytest-timeout~=2.4.0",
6868
"pytest-dependency~=0.6.0"
6969
]
7070

7171
codestyle = [
72-
"mypy~=1.3.0",
73-
"flake8~=7.1.0",
74-
"black~=24.8.0",
75-
"isort~=5.11.0",
72+
"mypy~=1.17.0",
73+
"flake8~=7.3.0",
74+
"black~=25.1.0",
75+
"isort~=5.13.2",
7676
"types-PyYAML~=6.0.2"
7777
]
7878

7979
bundle = [
8080
"tomli~=2.2.1",
81-
"zipapps~=2024.8.7"
81+
"zipapps~=2025.9.4"
8282
]
8383

8484
setup = [
8585
"colorama~=0.4.6",
86-
"cryptography~=44.0.0",
86+
"cryptography~=45.0.7",
8787
"semver~=3.0.2"
8888
]
8989

9090
test = [
9191
"colorama~=0.4.6",
92-
"python-on-whales~=0.76.1"
92+
"python-on-whales~=0.78.0"
9393
]
9494

9595
protocol = [
9696
"jupyter~=1.1.1",
9797
"ipywidgets~=8.1.6",
98-
"matplotlib~=3.10.1",
98+
"matplotlib~=3.10.6",
9999
"scapy~=2.6.1",
100100
"nbstripout~=0.8.1"
101101
]

viridian/algae/sources/automation/simple_client.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,31 @@
7070

7171

7272
class AlgaeClient:
73-
def __init__(self, address: str, port: int, dns: IPv4Address = _DEFAULT_CURRENT_DNS, protocol: Optional[Union[Literal["typhoon"], Literal["port"]]] = None, capture_iface: Optional[List[str]] = None, capture_ranges: Optional[List[str]] = None, capture_addresses: Optional[List[str]] = None, capture_ports: Optional[str] = None, exempt_ranges: Optional[List[str]] = None, exempt_addresses: Optional[List[str]] = None, exempt_ports: Optional[str] = None, local_address: Optional[IPv4Address] = None):
74-
self._address = address
75-
self._port = port
73+
def __init__(self) -> None:
74+
self._address: str
75+
self._port: int
76+
self._proto_type: SeasideClient
77+
self._tunnel: Tunnel
78+
79+
@classmethod
80+
async def new(cls, address: str, port: int, dns: IPv4Address = _DEFAULT_CURRENT_DNS, protocol: Optional[Union[Literal["typhoon"], Literal["port"]]] = None, capture_iface: Optional[List[str]] = None, capture_ranges: Optional[List[str]] = None, capture_addresses: Optional[List[str]] = None, capture_ports: Optional[str] = None, exempt_ranges: Optional[List[str]] = None, exempt_addresses: Optional[List[str]] = None, exempt_ports: Optional[str] = None, local_address: Optional[IPv4Address] = None) -> "AlgaeClient":
81+
client = cls()
82+
client._address = address
83+
client._port = port
7684

7785
if protocol is None or protocol == "port":
78-
self._proto_type = PortClient
86+
client._proto_type = PortClient
7987
elif protocol == "typhoon":
80-
self._proto_type = TyphoonClient
88+
client._proto_type = TyphoonClient
8189
else:
8290
raise ValueError(f"Unknown protocol type: {protocol}")
8391

8492
tunnel_name = getenv("SEASIDE_TUNNEL_NAME", _DEFAULT_TUNNEL_NAME)
8593
tunnel_address = IPv4Address(getenv("SEASIDE_TUNNEL_ADDRESS", _DEFAULT_TUNNEL_ADDRESS))
8694
tunnel_netmask = IPv4Address(getenv("SEASIDE_TUNNEL_NETMASK", _DEFAULT_TUNNEL_NETMASK))
8795
tunnel_sva = int(getenv("SEASIDE_TUNNEL_SVA", _DEFAULT_TUNNEL_SVA))
88-
self._tunnel = Tunnel(tunnel_name, tunnel_address, tunnel_netmask, tunnel_sva, IPv4Address(self._address), dns, capture_iface, capture_ranges, capture_addresses, capture_ports, exempt_ranges, exempt_addresses, exempt_ports, local_address)
96+
client._tunnel = await Tunnel.new(tunnel_name, tunnel_address, tunnel_netmask, tunnel_sva, IPv4Address(client._address), dns, capture_iface, capture_ranges, capture_addresses, capture_ports, exempt_ranges, exempt_addresses, exempt_ports, local_address)
97+
return client
8998

9099
async def _send_to_caerulean(self, connection: SeasideClient, tunnel: int) -> None:
91100
loop = get_running_loop()
@@ -163,7 +172,7 @@ async def start(self, command: str, port: Optional[str] = None, token: Optional[
163172

164173
async def interrupt(self, terminate: bool = False) -> None:
165174
logger.debug("Deleting tunnel...")
166-
self._tunnel.delete()
175+
await self._tunnel.delete()
167176
logger.warning("Client connection terminated!")
168177
if terminate:
169178
exit(1)
@@ -216,7 +225,7 @@ async def main(args: Sequence[str] = argv[1:]) -> None:
216225
logger.debug(f"Proceeding with user token: {token!r}")
217226
listener_port = arguments["port"]
218227

219-
client = AlgaeClient(**arguments)
228+
client = await AlgaeClient.new(**arguments)
220229
logger.debug("Setting up interruption handlers for client...")
221230
loop.add_signal_handler(SIGTERM, lambda: create_task(client.interrupt(True)))
222231
loop.add_signal_handler(SIGINT, lambda: create_task(client.interrupt(True)))

0 commit comments

Comments
 (0)