fix ssh for ubuntu 22.04

This commit is contained in:
mercury
2023-02-18 00:35:57 +04:00
parent 9166011608
commit 4cb700f772
8 changed files with 19 additions and 8 deletions
+6 -6
View File
@@ -55,7 +55,7 @@ class Bot
if (empty($c['admin'])) {
$c['admin'] = [$this->input['from']];
file_put_contents($file, "<?php\n\n\$c = " . var_export($c, true) . ";\n");
} elseif (!is_array($c['admin'])){
} elseif (!is_array($c['admin'])) {
$c['admin'] = [$c['admin']];
file_put_contents($file, "<?php\n\n\$c = " . var_export($c, true) . ";\n");
} elseif (!in_array($this->input['from'], $c['admin'])) {
@@ -67,7 +67,7 @@ class Bot
public function callbackCheck()
{
if (empty($this->callback) && !empty($this->input['callback_id'])) {
$this->answer($this->input['callback_id'], $GLOBALS['debug'] ? $this->input['callback']: false);
$this->answer($this->input['callback_id'], $GLOBALS['debug'] ? $this->input['callback'] : false);
}
}
@@ -359,7 +359,7 @@ class Bot
$this->menu('client', implode('_', $_SESSION['reply'][$this->input['reply']]['args']));
}
public function readClients():array
public function readClients(): array
{
return json_decode(file_get_contents($this->clients), true) ?: [];
}
@@ -1946,7 +1946,7 @@ DNS-over-HTTPS with IP:
return $d;
}
public function getName(array $a):string
public function getName(array $a): string
{
$name = '';
foreach ($a as $k => $v) {
@@ -1989,7 +1989,7 @@ DNS-over-HTTPS with IP:
}
}
$ip_count = (1 << (32 - $bitmask)) - count($ips) - 1;
for ($i=1; $i < $ip_count; $i++) {
for ($i = 1; $i < $ip_count; $i++) {
$ip = $i + $server_ip;
if (!in_array($ip, $ips)) {
$client_ip = long2ip($ip);
@@ -2109,7 +2109,7 @@ DNS-over-HTTPS with IP:
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $json_header ? [
'Content-Type: application/json'
]: [],
] : [],
CURLOPT_POSTFIELDS => $data,
]);
$res = curl_exec($ch);
+2 -2
View File
@@ -3,12 +3,12 @@ arg RELEASE
from ${SYSTEM}:${RELEASE}
ENV DEBIAN_FRONTEND noninteractive
run apt update && \
apt install -y ssh git net-tools
apt install -y ssh git net-tools xz-utils
run mkdir /root/.ssh && \
mkdir /ssh && \
touch /root/.ssh/authorized_keys && \
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.15.2/shadowsocks-v1.15.2.x86_64-unknown-linux-gnu.tar.xz && \
tar -xf shadowsocks-v1.15.2.x86_64-unknown-linux-gnu.tar.xz && \
wget https://github.com/teddysun/v2ray-plugin/releases/download/v5.2.0/v2ray-plugin-linux-amd64-v5.2.0.tar.gz && \
tar xf v2ray-plugin-linux-amd64-v5.2.0.tar.gz && \
tar -xf v2ray-plugin-linux-amd64-v5.2.0.tar.gz && \
mv v2ray-plugin_linux_amd64 /usr/local/bin/v2ray-plugin
+2
View File
@@ -1,4 +1,6 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
/AdGuardHome/AdGuardHome -s install -c /opt/adguardhome/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/
tail -f /dev/null
+2
View File
@@ -1,4 +1,6 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
sed "s/ss:[0-9]\+/ss:$SSPORT/" /nginx_default.conf > change_port
cat change_port > /nginx_default.conf
+2
View File
@@ -1,4 +1,6 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
sed -n "s/\"server_port\": \([0-9]\+\),/\1/p" /config.json > current_port
CURRENT_PORT=$(cat current_port | tr -d " ")
+2
View File
@@ -1,4 +1,6 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
sed "s/\"server_port\": [0-9]\+/\"server_port\": $SSPORT/" /config.json > change_port
cat change_port > /config.json
+1
View File
@@ -1,3 +1,4 @@
rm /ssh/key*
ssh-keygen -m PEM -t rsa -f /ssh/key -N ''
openssl req -newkey rsa:2048 -sha256 -nodes -x509 -days 365 -keyout /certs/self_private -out /certs/self_public -subj "/C=NN/ST=N/L=N/O=N/CN=$(curl https://ipinfo.io/ip)"
php init.php
+2
View File
@@ -13,5 +13,7 @@ sed "s/ListenPort = [0-9]\+/ListenPort = $WGPORT/" /etc/wireguard/wg0.conf > cha
cat change_port > /etc/wireguard/wg0.conf
wg-quick up wg0
cat /ssh/key.pub > /root/.ssh/authorized_keys
echo 'HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
service ssh start
tail -f /dev/null