-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
186 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "almalinux/9.aarch64" | ||
config.vm.hostname = "almalinux-9" | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.memory = "4096" | ||
vb.cpus = "2" | ||
end | ||
|
||
config.vm.provider "vmware_desktop" do |vd| | ||
vd.memory = "4096" | ||
vd.cpus = "2" | ||
end | ||
|
||
config.vm.box_check_update = false | ||
|
||
config.vm.provision "shell", inline: <<-SHELL | ||
#!/bin/bash | ||
echo "Hello from the inline Bash script!" | ||
# Flush existing rules | ||
iptables-save > rules.v4.old | ||
iptables -F | ||
# Set the default policies to DROP | ||
iptables -P INPUT DROP | ||
iptables -P FORWARD DROP | ||
iptables -P OUTPUT ACCEPT | ||
# Allow incoming SSH traffic | ||
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | ||
# Save the rules so they persist across reboots | ||
iptables-save > rules.v4.new | ||
pwd | ||
SHELL | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "almalinux/9" | ||
config.vm.hostname = "almalinux-9" | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.memory = "4096" | ||
vb.cpus = "2" | ||
end | ||
|
||
config.vm.provider "vmware_desktop" do |vd| | ||
vd.memory = "4096" | ||
vd.cpus = "2" | ||
end | ||
config.vm.box_check_update = false | ||
|
||
config.vm.provision "shell", inline: <<-SHELL | ||
#!/bin/bash | ||
echo "Hello from the inline Bash script!" | ||
# Flush existing rules | ||
iptables-save > rules.v4.old | ||
iptables -F | ||
# Set the default policies to DROP | ||
iptables -P INPUT DROP | ||
iptables -P FORWARD DROP | ||
iptables -P OUTPUT ACCEPT | ||
# Allow incoming SSH traffic | ||
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | ||
# Save the rules so they persist across reboots | ||
iptables-save > rules.v4.new | ||
pwd | ||
SHELL | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# stdlib | ||
from typing import List | ||
from typing import Optional | ||
|
||
# relative | ||
from ..service.context import NodeServiceContext | ||
from ..service.response import SyftError | ||
from ..service.user.user_roles import ServiceRole | ||
|
||
|
||
class PySyftException(Exception): | ||
"""Base class for all PySyft exceptions.""" | ||
|
||
def __init__(self, message: str, roles: Optional[List[ServiceRole]] = None): | ||
super().__init__(message) | ||
self.message = message | ||
self.roles = roles if roles else [ServiceRole.ADMIN] | ||
|
||
def raise_with_context(self, context: NodeServiceContext): | ||
self.context = context | ||
return self | ||
|
||
def handle(self) -> SyftError: | ||
# if self.context and self.context.role in self.roles: | ||
return SyftError(message=self.message) | ||
# else: | ||
# return SyftError(message="Access denied to exception message.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# stdlib | ||
|
||
# relative | ||
from ..service.user.user_roles import ServiceRole | ||
from .exception import PySyftException | ||
|
||
UserAlreadyExistsException = PySyftException( | ||
message="User already exists", roles=[ServiceRole.ADMIN] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters