Compare commits
2
Commits
1e7a53f819
...
84bf2e7016
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84bf2e7016 | ||
|
|
2073ab1ec8 |
No files matched your search
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# 이 박스(z840)에 SSH 서버를 설치하고 2984번 포트, 공개키 로그인만 허용하도록 설정한다.
|
||||
# 루트로: sudo bash /srv/homeclaw/scripts/setup-sshd-2984.sh (여러 번 실행해도 안전)
|
||||
# 이사한 z840에는 openssh-server가 없었다(2026-10-31 확인, 클라이언트만 설치됨).
|
||||
# 접속할 기기의 공개키를 /home/kim/.ssh/authorized_keys에 넣은 뒤 다시 실행하면 비밀번호 로그인이 꺼진다.
|
||||
# authorized_keys가 비어 있을 때 비밀번호를 끄면 아무도 못 들어오므로, 키가 있을 때만 끈다.
|
||||
set -e
|
||||
[ "$(id -u)" = 0 ] || { echo "루트로 실행하세요 (sudo)"; exit 1; }
|
||||
|
||||
PORT=2984
|
||||
USER_NAME=kim
|
||||
KEYS=/home/$USER_NAME/.ssh/authorized_keys
|
||||
CONF=/etc/ssh/sshd_config.d/10-homeclaw.conf
|
||||
|
||||
if ! dpkg -s openssh-server >/dev/null 2>&1; then
|
||||
apt-get install -y openssh-server
|
||||
fi
|
||||
|
||||
# 키가 한 줄이라도 있으면(주석·빈 줄 제외) 비밀번호 로그인을 끈다
|
||||
if [ -s "$KEYS" ] && grep -qvE '^\s*(#|$)' "$KEYS"; then
|
||||
PASSWORD=no
|
||||
else
|
||||
PASSWORD=yes
|
||||
fi
|
||||
|
||||
mkdir -p /etc/ssh/sshd_config.d
|
||||
cat > "$CONF" <<EOF
|
||||
# scripts/setup-sshd-2984.sh가 만든 파일
|
||||
Port $PORT
|
||||
PubkeyAuthentication yes
|
||||
PasswordAuthentication $PASSWORD
|
||||
KbdInteractiveAuthentication no
|
||||
PermitRootLogin no
|
||||
AllowUsers $USER_NAME
|
||||
EOF
|
||||
|
||||
# 설정이 틀리면 서비스를 건드리기 전에 멈춘다
|
||||
sshd -t
|
||||
|
||||
# 우분투는 ssh.socket이 22번을 대신 듣는다 — 끄고 ssh.service가 직접 듣게 해야 Port가 적용된다
|
||||
systemctl disable --now ssh.socket 2>/dev/null || true
|
||||
systemctl enable ssh.service
|
||||
systemctl restart ssh.service
|
||||
|
||||
echo "== 결과"
|
||||
ss -ltnp | grep -E ":$PORT\b" || { echo "$PORT 포트에서 듣지 않는다 — journalctl -u ssh 확인"; exit 1; }
|
||||
sshd -T | grep -E '^(port|passwordauthentication|pubkeyauthentication|permitrootlogin|allowusers) '
|
||||
if [ "$PASSWORD" = yes ]; then
|
||||
echo
|
||||
echo "주의: $KEYS 에 키가 없어 비밀번호 로그인을 아직 끄지 않았다."
|
||||
echo "접속할 기기의 공개키(한 줄)를 그 파일에 추가한 뒤 이 스크립트를 다시 실행하면 비밀번호 로그인이 꺼진다."
|
||||
fi
|
||||
echo "접속: ssh -p $PORT $USER_NAME@192.168.0.5"
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# 공식 저장소(pkgs.tailscale.com)에서 Tailscale을 설치하고 서비스를 켠다.
|
||||
# 루트로: sudo bash /srv/homeclaw/scripts/setup-tailscale.sh (여러 번 실행해도 안전)
|
||||
# 설치 뒤 로그인은 `sudo tailscale up`이 출력하는 주소를 브라우저로 열어 계정으로 승인한다(이 스크립트는 로그인하지 않는다).
|
||||
set -e
|
||||
[ "$(id -u)" = 0 ] || { echo "루트로 실행하세요 (sudo)"; exit 1; }
|
||||
. /etc/os-release
|
||||
|
||||
if ! dpkg -s tailscale >/dev/null 2>&1; then
|
||||
install -d -m 0755 /usr/share/keyrings
|
||||
curl -fsSL "https://pkgs.tailscale.com/stable/ubuntu/$VERSION_CODENAME.noarmor.gpg" -o /usr/share/keyrings/tailscale-archive-keyring.gpg
|
||||
curl -fsSL "https://pkgs.tailscale.com/stable/ubuntu/$VERSION_CODENAME.tailscale-keyring.list" -o /etc/apt/sources.list.d/tailscale.list
|
||||
apt-get update
|
||||
apt-get install -y tailscale
|
||||
fi
|
||||
|
||||
systemctl enable --now tailscaled
|
||||
echo "== 결과"
|
||||
tailscale version | head -1
|
||||
systemctl is-active tailscaled
|
||||
tailscale status 2>&1 | head -3
|
||||
@@ -125,12 +125,16 @@ export class AnthropicAdapter implements LLMProvider {
|
||||
}
|
||||
|
||||
async testConnection(): Promise<boolean> {
|
||||
await this.post('/v1/messages', {
|
||||
model: 'claude-haiku-5-5',
|
||||
max_tokens: 1,
|
||||
messages: [{ role: 'user', content: 'hi' }],
|
||||
});
|
||||
return true;
|
||||
// /api/status가 주기적으로 부르므로 토큰이 드는 메시지 호출 대신 모델 목록 조회(과금 없음)로 키·네트워크만 확인한다
|
||||
try {
|
||||
const response = await fetch(`${this.endpoint}/v1/models?limit=1`, {
|
||||
headers: { 'x-api-key': this.apiKey, 'anthropic-version': '2023-06-01' },
|
||||
signal: AbortSignal.timeout(8_000),
|
||||
});
|
||||
return response.ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user