pip config
This commit is contained in:
parent
54645f4ba5
commit
b5f006b103
3
configs/pip/pip.conf
Normal file
3
configs/pip/pip.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[global]
|
||||||
|
break-system-packages = true
|
||||||
|
user = true
|
@ -35,6 +35,7 @@ mkdir -p ~/.config/systemd/user
|
|||||||
mkdir -p ~/.config/glab-cli
|
mkdir -p ~/.config/glab-cli
|
||||||
mkdir -p ~/.config/user-tmpfiles.d
|
mkdir -p ~/.config/user-tmpfiles.d
|
||||||
mkdir -p ~/.config/gqrx
|
mkdir -p ~/.config/gqrx
|
||||||
|
mkdir -p ~/.config/pip
|
||||||
mkdir -p ~/.cargo
|
mkdir -p ~/.cargo
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
|
|
||||||
@ -95,6 +96,9 @@ ln -sf $EWCONFIG_ROOT/configs/user-tmpfiles.d/* ~/.config/user-tmpfiles.d/
|
|||||||
# Logid config
|
# Logid config
|
||||||
ln -sf $EWCONFIG_ROOT/configs/logid/logid.cfg ~/.config/logid/logid.cfg
|
ln -sf $EWCONFIG_ROOT/configs/logid/logid.cfg ~/.config/logid/logid.cfg
|
||||||
|
|
||||||
|
# Pip config
|
||||||
|
ln -sf $EWCONFIG_ROOT/configs/pip/pip.conf ~/.config/pip/pip.conf
|
||||||
|
|
||||||
# GQRX
|
# GQRX
|
||||||
ln -sf $EWCONFIG_ROOT/configs/gqrx/bookmarks.csv ~/.config/gqrx/bookmarks.csv
|
ln -sf $EWCONFIG_ROOT/configs/gqrx/bookmarks.csv ~/.config/gqrx/bookmarks.csv
|
||||||
|
|
||||||
|
63
scripts/vpn-last-handshakes
Executable file
63
scripts/vpn-last-handshakes
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
import logging
|
||||||
|
import requests
|
||||||
|
import subprocess
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
# Handle program arguments
|
||||||
|
ap = argparse.ArgumentParser(prog="", description="")
|
||||||
|
|
||||||
|
ap.add_argument(
|
||||||
|
"-v", "--verbose", help="Enable verbose logging", action="store_true"
|
||||||
|
)
|
||||||
|
args = ap.parse_args()
|
||||||
|
|
||||||
|
# Configure logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.DEBUG if args.verbose else logging.INFO,
|
||||||
|
format="%(levelname)s: %(message)s",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make request
|
||||||
|
response = requests.get(
|
||||||
|
"http://gateway.vpn:9090/api/v1/query?query=wireguard_latest_handshake_seconds"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Parse into a list of peers
|
||||||
|
peers = response.json()["data"]["result"]
|
||||||
|
logger.debug(f"Found {len(peers)} peers")
|
||||||
|
|
||||||
|
# Handle each peer
|
||||||
|
now = datetime.now()
|
||||||
|
for peer in peers:
|
||||||
|
allowed_ips = peer["metric"]["allowed_ips"]
|
||||||
|
latest_handshake = peer["value"][1]
|
||||||
|
|
||||||
|
# Figure out the friendly name
|
||||||
|
first_ip = allowed_ips.split(",")[0].split("/")[0]
|
||||||
|
name = (
|
||||||
|
subprocess.check_output(
|
||||||
|
["dig", "+short", "-x",first_ip ]
|
||||||
|
)
|
||||||
|
.decode("utf-8")
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
|
||||||
|
# Construct the output
|
||||||
|
output = f"{first_ip}"
|
||||||
|
if name:
|
||||||
|
output += f" ({name})"
|
||||||
|
output += f" {(now - datetime.fromtimestamp(int(latest_handshake))).seconds}"
|
||||||
|
print(output)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
Loading…
x
Reference in New Issue
Block a user