aboutsummaryrefslogtreecommitdiff
path: root/autopeer_shell.py
diff options
context:
space:
mode:
authorGravatar steering72532026-05-05 02:34:22 +0000
committerGravatar steering72532026-05-05 02:34:22 +0000
commitcc64aee28824dc3db49737c3b510f4d3604ea8f2 (patch)
treede9eb729854ccedb94be317e459347a4d2e66cae /autopeer_shell.py
parentlicense (diff)
use fqdn everywhere
Diffstat (limited to 'autopeer_shell.py')
-rwxr-xr-xautopeer_shell.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/autopeer_shell.py b/autopeer_shell.py
index 9ec8702..307b04f 100755
--- a/autopeer_shell.py
+++ b/autopeer_shell.py
@@ -67,10 +67,10 @@ SELECTED_ASN = as_from_user()
class AutopeerShell(cmd.Cmd):
def preloop(self):
self.intro = f'Welcome to the autopeer shell. Type help or ? to list commands.\nSelected AS: {SELECTED_ASN}'
- self.prompt = f'{getpass.getuser()}@{socket.gethostname()}:{SELECTED_ASN}> '
+ self.prompt = f'{getpass.getuser()}@{socket.getfqdn()}:{SELECTED_ASN}> '
def postcmd(self, stop, line):
- self.prompt = f'{getpass.getuser()}@{socket.gethostname()}:{SELECTED_ASN}> '
+ self.prompt = f'{getpass.getuser()}@{socket.getfqdn()}:{SELECTED_ASN}> '
return stop
def onecmd(self, line):
@@ -146,7 +146,7 @@ My Tunnel IPv6LL: {me.ipll}
print(f'Error: {name} already exists', file=sys.stderr)
return
- sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.gethostname()}] Created new peering {name!r} for AS{SELECTED_ASN} by {USER}", text=True)
+ sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.getfqdn()}] Created new peering {name!r} for AS{SELECTED_ASN} by {USER}", text=True)
try:
curs = DB.execute(
@@ -172,7 +172,7 @@ My Tunnel IPv6LL: {me.ipll}
'''<name>
Delete your peering.
Note: The deletion will be processed the next time the cronjob runs, at which time the name will become available.'''
- sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.gethostname()}] Deleted peering {name!r} for AS{SELECTED_ASN} by {USER}", text=True)
+ sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.getfqdn()}] Deleted peering {name!r} for AS{SELECTED_ASN} by {USER}", text=True)
curs = DB.execute(
'UPDATE peers SET deleted = 1 WHERE name = :name AND asn = :asn AND deleted = 0',
dict(name=name, asn=SELECTED_ASN)
@@ -269,8 +269,8 @@ if __name__ == '__main__':
shell = AutopeerShell()
command = os.getenv('SSH_ORIGINAL_COMMAND', '')
if len(command):
- sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.gethostname()}] {USER} ran {command!r} via {os.getenv('SSH_CONNECTION')}", text=True)
+ sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.getfqdn()}] {USER} ran {command!r} via {os.getenv('SSH_CONNECTION')}", text=True)
shell.onecmd(command)
else:
- sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.gethostname()}] {USER} logged in via {os.getenv('SSH_CONNECTION')}", text=True)
+ sp = subprocess.run(['socat', 'stdio', NOTIFY_TO], input=f"[autopeer {socket.getfqdn()}] {USER} logged in via {os.getenv('SSH_CONNECTION')}", text=True)
shell.cmdloop()