Compare commits
5 Commits
4620cb28cd
...
7501da9c5f
| Author | SHA1 | Date | |
|---|---|---|---|
| 7501da9c5f | |||
| bb422a7ff0 | |||
| f464927a1d | |||
| a1a85a26b5 | |||
| 9de1b66bca |
@@ -12,8 +12,7 @@ list_my_git_projects = [
|
|||||||
"https://gitlab.com",
|
"https://gitlab.com",
|
||||||
"https:ubuntu:5000"
|
"https:ubuntu:5000"
|
||||||
]
|
]
|
||||||
my_username = "jonnybravo"
|
my_username = os.environ["USER"]
|
||||||
|
|
||||||
if not os.path.exists(user_gitconfig):
|
if not os.path.exists(user_gitconfig):
|
||||||
os.popen("touch " + user_gitconfig)
|
os.popen("touch " + user_gitconfig)
|
||||||
|
|
||||||
|
|||||||
37
create_wireguard_os_simple/Readme.md
Normal file
37
create_wireguard_os_simple/Readme.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
Was will ich machen.
|
||||||
|
|
||||||
|
- erstellen von parametern -c = client -s server
|
||||||
|
- erstellen der Serverconfig über os.popen oder subproess
|
||||||
|
Serverconf gesamt :
|
||||||
|
```
|
||||||
|
[Interface]
|
||||||
|
Address = 10.50.0.1/24
|
||||||
|
ListenPort = 59308
|
||||||
|
PrivateKey = <privtekey server>
|
||||||
|
# Allow routing between clients
|
||||||
|
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT
|
||||||
|
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT
|
||||||
|
[Peer]
|
||||||
|
PublicKey = <publickey Client 1>
|
||||||
|
AllowedIps = 10.50.0.2/32
|
||||||
|
[Peer]
|
||||||
|
PublicKey = <publickey Client 2>
|
||||||
|
AllowedIps = 10.50.0.3/32
|
||||||
|
```
|
||||||
|
---
|
||||||
|
- client Config erstellen
|
||||||
|
```
|
||||||
|
[Interface]
|
||||||
|
Address = 10.50.0.3/24
|
||||||
|
PrivateKey = <privatekey client>
|
||||||
|
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT
|
||||||
|
DNS = 10.50.0.3
|
||||||
|
[Peer]
|
||||||
|
PublicKey = <publickey server>
|
||||||
|
AllowedIPs = 10.50.0.0/24
|
||||||
|
Endpoint = schlaubistechtalk.de:59308
|
||||||
|
PersistentKeepalive = 25
|
||||||
|
```
|
||||||
|
- Client und Server Unit erstellen und aktiveren und starten
|
||||||
|
- Eingaben vairbale gestalten, gerne über import
|
||||||
|
- server_key mit Name und publickey dauerhaft speichern Skript Folder
|
||||||
1
create_wireguard_os_simple/default_server.py
Normal file
1
create_wireguard_os_simple/default_server.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
@@ -1,32 +1,17 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import my_search
|
||||||
|
|
||||||
def read_all_sub_Folder(target_folder = str, search_string = str):
|
|
||||||
key_liste = []
|
|
||||||
for root, dirs, files in os.walk(target_folder, topdown=False, ):
|
|
||||||
for name in files:
|
|
||||||
if name == search_string:
|
|
||||||
FullPATH = str(os.path.join(root, name))
|
|
||||||
#if FullPATH.endswith(".pub") is False :#and FullPATH.endswith("known_hosts") is False and FullPATH.endswith("authorized_keys") is False:
|
|
||||||
#if FullPATH.
|
|
||||||
key_liste.append({"FullPath": FullPATH,
|
|
||||||
"Name": name,
|
|
||||||
"Root": root,
|
|
||||||
"Folder": dirs})
|
|
||||||
return key_liste
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
search_jenkins_folder = "/home/jonnybravo/.jenkins/data/jobs"
|
search_jenkins_folder = "/home/jonnybravo/.jenkins/data/jobs"
|
||||||
search_string = """<command>./test_play.yml</command>"""
|
search_string = """<command>./test_play.yml</command>"""
|
||||||
for i in read_all_sub_Folder(target_folder=search_jenkins_folder, search_string="config.xml"):
|
for i_full in my_search.read_all_sub_Folder(target_folder=search_jenkins_folder, search_string="config.xml"):
|
||||||
#print(i["FullPath"])
|
#print(i["FullPath"])
|
||||||
with open(i["FullPath"], 'r') as file:
|
with open(i_full["FullPath"], 'r') as file:
|
||||||
data = file.read()
|
data = file.read()
|
||||||
index = data.find(search_string)
|
index = data.find(search_string)
|
||||||
print(index)
|
|
||||||
if not index == -1:
|
if not index == -1:
|
||||||
print("Ist in file vorhanden", file, sep=" ")
|
print("Ist in file vorhanden", file.name, sep=" ")
|
||||||
|
|
||||||
#data = data.replace('<daysToKeep>-1</daysToKeep>', '')
|
#data = data.replace('<daysToKeep>-1</daysToKeep>', '')
|
||||||
#with open(i["FullPath"], 'w') as file:
|
#with open(i["FullPath"], 'w') as file:
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user