diff --git a/RDP/RDP_TOGGLE_API.md b/RDP/RDP_TOGGLE_API.md new file mode 100644 index 0000000..4faaf09 --- /dev/null +++ b/RDP/RDP_TOGGLE_API.md @@ -0,0 +1,160 @@ +# RDP Toggle API Documentation + +## 개요 +Proxmox VE 호스트에서 RDP/Shell 모드를 API로 전환할 수 있는 시스템입니다. + +## 구성 요소 + +### 1. **rdp-toggle-api.py** +- FastAPI 기반 REST API 서버 +- 포트: 8080 +- RDP/Shell 모드 전환 제어 + +### 2. **rdp-toggle-web.html** +- 웹 기반 컨트롤 패널 +- 실시간 상태 모니터링 +- 설정 변경 인터페이스 + +### 3. **install-rdp-api.sh** +- 자동 설치 스크립트 +- systemd 서비스 설정 + +## API 엔드포인트 + +### GET /status +현재 상태 확인 +```bash +curl http://localhost:8080/status +``` + +### POST /toggle +모드 전환 (rdp/shell) +```bash +# RDP 모드로 전환 +curl -X POST http://localhost:8080/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"rdp"}' + +# Shell 모드로 전환 +curl -X POST http://localhost:8080/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"shell"}' +``` + +### GET /config +현재 설정 확인 +```bash +curl http://localhost:8080/config +``` + +### PUT /config +설정 업데이트 +```bash +curl -X PUT http://localhost:8080/config \ + -H 'Content-Type: application/json' \ + -d '{ + "rdp_server": "192.168.0.229", + "rdp_username": "0bin", + "rdp_password": "trajet6640" + }' +``` + +## 테스트 환경 설정 + +### RDP 서버 정보 +- **서버 주소**: 192.168.0.229 +- **사용자명**: 0bin +- **비밀번호**: trajet6640 +- **로컬 사용자**: rdpuser + +## 설치 방법 + +```bash +# 1. 설치 스크립트 실행 +chmod +x install-rdp-api.sh +./install-rdp-api.sh + +# 2. 서비스 상태 확인 +systemctl status rdp-toggle-api + +# 3. 웹 인터페이스 접속 +# 브라우저에서 http://[PROXMOX_IP]:8080 접속 +``` + +## 사용 시나리오 + +### 1. 초기 설정 +```bash +# RDP 설정 구성 +curl -X PUT http://localhost:8080/config \ + -H 'Content-Type: application/json' \ + -d '{ + "rdp_server": "192.168.0.229", + "rdp_username": "0bin", + "rdp_password": "trajet6640" + }' +``` + +### 2. RDP 모드 활성화 +```bash +curl -X POST http://localhost:8080/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"rdp"}' +``` + +### 3. Shell 모드로 복귀 +```bash +curl -X POST http://localhost:8080/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"shell"}' +``` + +## 동작 원리 + +### RDP 모드 활성화 시 +1. getty@tty1 자동 로그인 설정 +2. X Window System 자동 시작 +3. FreeRDP3 전체화면 실행 +4. RDP 연결 자동 수립 + +### Shell 모드 활성화 시 +1. RDP 프로세스 종료 +2. X Window 종료 +3. 자동 로그인 해제 +4. 일반 TTY 로그인 화면 복원 + +## 상태 파일 +- 상태 저장: `/var/lib/rdp-toggle/state.json` +- 설정 저장: `/var/lib/rdp-toggle/config.json` + +## 문제 해결 + +### API 서버가 시작되지 않을 때 +```bash +# 로그 확인 +journalctl -u rdp-toggle-api -f + +# Python 패키지 재설치 +pip3 install --upgrade fastapi uvicorn +``` + +### RDP 연결이 실패할 때 +```bash +# 현재 상태 확인 +curl http://localhost:8080/status + +# RDP 프로세스 확인 +ps aux | grep xfreerdp3 +``` + +### Shell 모드로 전환이 안 될 때 +```bash +# 수동으로 RDP 종료 +pkill -u rdpuser +systemctl restart getty@tty1 +``` + +## 보안 고려사항 +- API는 기본적으로 모든 IP에서 접근 가능 (0.0.0.0:8080) +- 프로덕션 환경에서는 방화벽 설정 권장 +- 비밀번호는 평문으로 저장됨 (향후 암호화 필요) \ No newline at end of file diff --git a/RDP/README.md b/RDP/README.md new file mode 100644 index 0000000..b8e4462 --- /dev/null +++ b/RDP/README.md @@ -0,0 +1,95 @@ +# RDP Toggle API + +Proxmox VE 호스트에서 RDP/Shell 모드를 API로 전환할 수 있는 시스템 + +## 개요 + +외부에서 API 호출을 통해 Proxmox 호스트의 물리적 화면을 Shell 모드와 RDP 모드로 전환할 수 있습니다. +프론트엔드에서 토글 버튼으로 화면 모드를 실시간으로 제어할 수 있습니다. + +## 구성 파일 + +- **rdp-toggle-api.py** - FastAPI 기반 REST API 서버 +- **install-rdp-api.sh** - 자동 설치 스크립트 (venv 환경) +- **requirements.txt** - Python 패키지 의존성 +- **RDP_TOGGLE_API.md** - API 상세 문서 +- **rdp-toggle-web.html** - 웹 기반 컨트롤 패널 +- **proxmox-auto-rdp-setup.sh** - Proxmox RDP 초기 설정 스크립트 +- **proxmox_auto_rdp_setup_korean.md** - 초기 설정 가이드 + +## 빠른 시작 + +```bash +# 1. 설치 +chmod +x install-rdp-api.sh +./install-rdp-api.sh + +# 2. 서비스 확인 +systemctl status rdp-toggle-api + +# 3. API 테스트 +curl http://localhost:8090/status +``` + +## API 엔드포인트 + +### GET /status +현재 상태 확인 +```bash +curl http://localhost:8090/status +``` + +### POST /toggle +모드 전환 +```bash +# RDP 모드 +curl -X POST http://localhost:8090/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"rdp"}' + +# Shell 모드 +curl -X POST http://localhost:8090/toggle \ + -H 'Content-Type: application/json' \ + -d '{"mode":"shell"}' +``` + +## 리액트 연동 예시 + +```jsx +const [status, setStatus] = useState(null); +const API_URL = 'http://your-proxmox-ip:8090'; + +// 상태 확인 +const fetchStatus = async () => { + const res = await fetch(`${API_URL}/status`); + const data = await res.json(); + setStatus(data); +}; + +// 모드 전환 +const toggleMode = async (mode) => { + await fetch(`${API_URL}/toggle`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ mode }) + }); +}; +``` + +## 설치 위치 + +- API 서버: `/opt/rdp-toggle-api/` +- Python 가상환경: `/opt/rdp-toggle-api/venv/` +- systemd 서비스: `/etc/systemd/system/rdp-toggle-api.service` + +## 기능 + +- ✅ RDP ↔ Shell 모드 전환 +- ✅ 실시간 상태 모니터링 +- ✅ CORS 지원 (외부 접근 가능) +- ✅ venv 환경 (패키지 충돌 방지) +- ✅ systemd 서비스 (자동 시작) + +## 포트 + +기본 포트: **8090** diff --git a/RDP/install-rdp-api.sh b/RDP/install-rdp-api.sh new file mode 100755 index 0000000..0f6d55f --- /dev/null +++ b/RDP/install-rdp-api.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# RDP Toggle API 설치 스크립트 + +set -e + +echo "RDP Toggle API 설치 시작..." + +# 설치 디렉토리 설정 +INSTALL_DIR="/opt/rdp-toggle-api" +VENV_DIR="$INSTALL_DIR/venv" + +# Python 및 venv 설치 +apt update +apt install -y python3 python3-venv python3-pip + +# 설치 디렉토리 생성 +mkdir -p "$INSTALL_DIR" + +# 가상환경 생성 +echo "가상환경 생성 중..." +python3 -m venv "$VENV_DIR" + +# 가상환경에서 패키지 설치 +echo "패키지 설치 중..." +"$VENV_DIR/bin/pip" install --upgrade pip +"$VENV_DIR/bin/pip" install -r requirements.txt + +# API 파일 복사 +cp rdp-toggle-api.py "$INSTALL_DIR/" +chmod +x "$INSTALL_DIR/rdp-toggle-api.py" + +# systemd 서비스 생성 +cat > /etc/systemd/system/rdp-toggle-api.service << EOF +[Unit] +Description=RDP Toggle API Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=$INSTALL_DIR +ExecStart=$VENV_DIR/bin/python $INSTALL_DIR/rdp-toggle-api.py +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF + +# 서비스 활성화 및 시작 +systemctl daemon-reload +systemctl enable rdp-toggle-api.service +systemctl start rdp-toggle-api.service + +echo "RDP Toggle API 설치 완료!" +echo "API 서버가 포트 8090에서 실행 중입니다." +echo "" +echo "사용 방법:" +echo " 상태 확인: curl http://localhost:8090/status" +echo " RDP 모드: curl -X POST http://localhost:8090/toggle -H 'Content-Type: application/json' -d '{\"mode\":\"rdp\"}'" +echo " Shell 모드: curl -X POST http://localhost:8090/toggle -H 'Content-Type: application/json' -d '{\"mode\":\"shell\"}'" \ No newline at end of file diff --git a/proxmox-auto-rdp-setup.sh b/RDP/proxmox-auto-rdp-setup.sh similarity index 100% rename from proxmox-auto-rdp-setup.sh rename to RDP/proxmox-auto-rdp-setup.sh diff --git a/RDP/proxmox_auto_rdp_setup_korean.md b/RDP/proxmox_auto_rdp_setup_korean.md new file mode 100644 index 0000000..0f5caab --- /dev/null +++ b/RDP/proxmox_auto_rdp_setup_korean.md @@ -0,0 +1,212 @@ +# Proxmox 9.0 자동 RDP 연결 설정 가이드 + +## 개요 +Proxmox VE 9.0 (Debian 13 기반) 호스트가 부팅될 때 자동으로 Windows VM에 RDP로 풀스크린 연결하는 설정 가이드입니다. + +**목표**: CLI 화면을 보지 않고 부팅 후 바로 RDP 화면이 풀스크린으로 표시 + +## 환경 정보 +- **OS**: Proxmox VE 9.0.5 (Debian 13 기반) +- **RDP 대상**: ysleadersos.com:6642 +- **인증정보**: doctor-03 / @flejtm301 + +## 전체 설정 과정 + +### 1단계: 필수 패키지 설치 + +```bash +# X 윈도우 시스템 및 관련 패키지 설치 +apt update +apt install -y xorg openbox unclutter freerdp3-x11 + +# 설치된 패키지 확인 +dpkg -l | grep -E "(xorg|openbox|freerdp)" +``` + +### 2단계: 사용자 계정 생성 및 설정 + +```bash +# rdpuser 계정 생성 (이미 존재한다면 건너뛰기) +useradd -m -s /bin/bash rdpuser +passwd rdpuser + +# 사용자 홈 디렉토리 권한 설정 +chown -R rdpuser:rdpuser /home/rdpuser +``` + +### 3단계: systemd 자동 로그인 설정 + +```bash +# getty@tty1 서비스 override 디렉토리 생성 +mkdir -p /etc/systemd/system/getty@tty1.service.d + +# override.conf 파일 생성 +cat > /etc/systemd/system/getty@tty1.service.d/override.conf << 'EOF' +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin rdpuser --noclear %I $TERM +Type=idle +EOF + +# systemd 설정 리로드 +systemctl daemon-reload +systemctl restart getty@tty1.service +``` + +### 4단계: 자동 X 시작 설정 + +```bash +# rdpuser의 .bash_profile 생성 +cat > /home/rdpuser/.bash_profile << 'EOF' +# tty1에서만 X 자동 시작 +if [[ -z $DISPLAY ]] && [[ $(tty) == /dev/tty1 ]]; then + startx + logout +fi +EOF + +# 파일 소유권 설정 +chown rdpuser:rdpuser /home/rdpuser/.bash_profile +``` + +### 5단계: X 세션 설정 (.xinitrc) + +```bash +# .xinitrc 파일 생성 +cat > /home/rdpuser/.xinitrc << 'EOF' +#!/bin/bash + +# 화면 절전 모드 비활성화 +xset -dpms +xset s off +xset s noblank + +# 마우스 커서 숨기기 +unclutter -idle 0.1 -root & + +# Openbox 윈도우 매니저 시작 +openbox-session & + +# 잠시 대기 (X 완전 초기화) +sleep 2 + +# FreeRDP3를 사용한 직접 RDP 연결 (풀스크린) +xfreerdp3 \ + /v:ysleadersos.com:6642 \ + /u:doctor-03 \ + /p:"@flejtm301" \ + +f \ + /cert:ignore \ + +dynamic-resolution \ + /sound:sys:alsa \ + +clipboard + +# RDP 종료 시 X 세션도 종료 +pkill -SIGTERM Xorg +EOF + +# 실행 권한 및 소유권 설정 +chmod +x /home/rdpuser/.xinitrc +chown rdpuser:rdpuser /home/rdpuser/.xinitrc +``` + +### 6단계: Openbox 설정 (풀스크린 최적화) + +```bash +# Openbox 설정 디렉토리 생성 +mkdir -p /home/rdpuser/.config/openbox + +# rc.xml 설정 파일 생성 (윈도우 장식 제거, 풀스크린 강제) +cat > /home/rdpuser/.config/openbox/rc.xml << 'EOF' + + + + + no + yes + + + +EOF + +# 디렉토리 및 파일 소유권 설정 +chown -R rdpuser:rdpuser /home/rdpuser/.config +``` + +## 주요 문제 해결 과정 + +### 문제 1: 초기 Remmina 사용 시 연결 실패 +- **증상**: 부팅 후 화면 깜빡임, RDP 연결되지 않음 +- **원인**: Remmina가 자동 실행 환경에서 불안정 +- **해결**: Remmina를 FreeRDP3로 교체 + +### 문제 2: .bash_profile의 exec startx 문제 +- **증상**: 로그인/로그아웃 반복 루프 +- **원인**: `exec startx`로 인한 세션 교체 문제 +- **해결**: `exec startx`를 `startx`로 변경하고 `logout` 추가 + +### 문제 3: FreeRDP3 명령어 문법 오류 +- **증상**: "Unexpected keyword" 오류 +- **해결**: 올바른 FreeRDP3 문법 적용 + - `/cert-ignore` → `/cert:ignore` + - `/f` → `+f` + - `/dynamic-resolution` → `+dynamic-resolution` + - `/clipboard` → `+clipboard` + +## 설정 파일 요약 + +### 핵심 설정 파일들: +1. `/etc/systemd/system/getty@tty1.service.d/override.conf` - 자동 로그인 +2. `/home/rdpuser/.bash_profile` - X 자동 시작 +3. `/home/rdpuser/.xinitrc` - RDP 연결 실행 +4. `/home/rdpuser/.config/openbox/rc.xml` - 풀스크린 최적화 + +## 동작 흐름 + +1. **부팅 완료** → systemd가 tty1에서 rdpuser 자동 로그인 +2. **로그인** → .bash_profile이 tty1에서 startx 실행 +3. **X 시작** → .xinitrc가 실행됨 +4. **Openbox 실행** → 윈도우 매니저 시작 +5. **FreeRDP3 실행** → 풀스크린 RDP 연결 +6. **RDP 종료시** → X 세션도 함께 종료 + +## 테스트 및 확인 + +### 설정 확인 명령어: +```bash +# 자동 로그인 서비스 상태 확인 +systemctl status getty@tty1.service + +# X 서버 실행 확인 +ps aux | grep Xorg + +# RDP 연결 테스트 (수동) +su - rdpuser -c "DISPLAY=:0 xfreerdp3 /v:ysleadersos.com:6642 /u:doctor-03 /p:'@flejtm301' +f /cert:ignore" +``` + +### 로그 확인: +```bash +# systemd 로그 확인 +journalctl -u getty@tty1.service -f + +# X 서버 로그 확인 +cat /home/rdpuser/.local/share/xorg/Xorg.0.log +``` + +## 최종 결과 + +설정 완료 후 Proxmox 호스트를 재부팅하면: +- ✅ CLI 화면을 보지 않고 바로 RDP 화면이 표시됨 +- ✅ 풀스크린 모드로 Windows VM에 자동 연결 +- ✅ 사용자 개입 없이 완전 자동화된 부팅-RDP 연결 + +## 주의사항 + +1. **보안**: 패스워드가 설정 파일에 평문으로 저장됨 (운영 환경에서는 보안 강화 필요) +2. **네트워크**: RDP 대상 서버가 접근 가능한 상태여야 함 +3. **백업**: 설정 변경 전 기존 설정 백업 권장 +4. **권한**: 모든 설정 파일의 소유권이 rdpuser로 설정되어야 함 + +--- +*생성일: 2025-08-24* +*작성자: Claude Code Assistant* \ No newline at end of file diff --git a/RDP/rdp-toggle-api.py b/RDP/rdp-toggle-api.py new file mode 100644 index 0000000..dd540d4 --- /dev/null +++ b/RDP/rdp-toggle-api.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python3 +""" +RDP Toggle API Server +Control RDP/Shell display mode via REST API +""" + +from fastapi import FastAPI, HTTPException +from fastapi.middleware.cors import CORSMiddleware +from pydantic import BaseModel +import subprocess +import os +import json +from typing import Optional +from datetime import datetime +import uvicorn + +app = FastAPI(title="RDP Toggle API", version="1.0.0") + +# CORS 설정 (외부에서 접근 가능) +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# 상태 저장 파일 +STATE_FILE = "/var/lib/rdp-toggle/state.json" +CONFIG_FILE = "/var/lib/rdp-toggle/config.json" + +# 기본 설정 +DEFAULT_CONFIG = { + "rdp_server": "192.168.0.229", + "rdp_username": "0bin", + "rdp_password": "trajet6640", + "local_user": "rdpuser" +} + +class ToggleRequest(BaseModel): + mode: str # "rdp" or "shell" + +class ConfigUpdate(BaseModel): + rdp_server: Optional[str] = None + rdp_username: Optional[str] = None + rdp_password: Optional[str] = None + local_user: Optional[str] = None + +class StatusResponse(BaseModel): + current_mode: str + rdp_active: bool + last_changed: str + config: dict + +def ensure_directories(): + """필요한 디렉토리 생성""" + os.makedirs("/var/lib/rdp-toggle", exist_ok=True) + +def load_state(): + """현재 상태 로드""" + if os.path.exists(STATE_FILE): + with open(STATE_FILE, 'r') as f: + return json.load(f) + return { + "current_mode": "shell", + "rdp_active": False, + "last_changed": datetime.now().isoformat() + } + +def save_state(state): + """상태 저장""" + ensure_directories() + with open(STATE_FILE, 'w') as f: + json.dump(state, f) + +def load_config(): + """설정 로드""" + if os.path.exists(CONFIG_FILE): + with open(CONFIG_FILE, 'r') as f: + return json.load(f) + return DEFAULT_CONFIG + +def save_config(config): + """설정 저장""" + ensure_directories() + with open(CONFIG_FILE, 'w') as f: + json.dump(config, f) + +def enable_rdp(): + """RDP 모드 활성화""" + config = load_config() + + # 자동 로그인 설정 + subprocess.run([ + "mkdir", "-p", "/etc/systemd/system/getty@tty1.service.d" + ], check=False) + + override_content = f"""[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin {config['local_user']} --noclear %I $TERM +Type=idle""" + + with open("/etc/systemd/system/getty@tty1.service.d/override.conf", "w") as f: + f.write(override_content) + + # X 자동 시작 스크립트 + bash_profile = f"""if [[ -z $DISPLAY ]] && [[ $(tty) == /dev/tty1 ]]; then + startx + logout +fi""" + + user_home = f"/home/{config['local_user']}" + with open(f"{user_home}/.bash_profile", "w") as f: + f.write(bash_profile) + + # .xinitrc 업데이트 + xinitrc_content = f"""#!/bin/bash +xset -dpms +xset s off +xset s noblank +unclutter -idle 0.1 -root & +openbox-session & +sleep 2 +xfreerdp3 /v:{config['rdp_server']} /u:{config['rdp_username']} /p:"{config['rdp_password']}" +f /cert:ignore +dynamic-resolution /sound:sys:alsa +clipboard +pkill -SIGTERM Xorg""" + + with open(f"{user_home}/.xinitrc", "w") as f: + f.write(xinitrc_content) + + subprocess.run(["chmod", "+x", f"{user_home}/.xinitrc"]) + subprocess.run(["chown", f"{config['local_user']}:{config['local_user']}", + f"{user_home}/.bash_profile", f"{user_home}/.xinitrc"]) + + # systemd 리로드 및 getty 재시작 + subprocess.run(["systemctl", "daemon-reload"]) + subprocess.run(["systemctl", "restart", "getty@tty1.service"]) + + return True + +def disable_rdp(): + """Shell 모드로 전환 (RDP 비활성화)""" + config = load_config() + + # RDP 프로세스 종료 + subprocess.run(["pkill", "-u", config['local_user'], "xfreerdp3"], check=False) + subprocess.run(["pkill", "-u", config['local_user'], "-f", "xinit|Xorg|openbox"], check=False) + + # 자동 로그인 설정 제거 + subprocess.run(["rm", "-f", "/etc/systemd/system/getty@tty1.service.d/override.conf"], check=False) + + # 자동 시작 스크립트 제거 + user_home = f"/home/{config['local_user']}" + subprocess.run(["rm", "-f", f"{user_home}/.bash_profile"], check=False) + + # systemd 리로드 및 getty 재시작 + subprocess.run(["systemctl", "daemon-reload"]) + subprocess.run(["systemctl", "restart", "getty@tty1.service"]) + + # TTY1으로 전환 + subprocess.run(["chvt", "1"], check=False) + + return True + +@app.get("/") +async def root(): + """API 정보""" + return { + "name": "RDP Toggle API", + "version": "1.0.0", + "endpoints": { + "GET /status": "현재 상태 확인", + "POST /toggle": "모드 전환 (rdp/shell)", + "GET /config": "현재 설정 확인", + "PUT /config": "설정 업데이트" + } + } + +@app.get("/status", response_model=StatusResponse) +async def get_status(): + """현재 상태 반환""" + state = load_state() + config = load_config() + + # 실제 프로세스 확인 + try: + result = subprocess.run( + ["pgrep", "-f", "xfreerdp3"], + capture_output=True, + text=True + ) + rdp_running = result.returncode == 0 + state["rdp_active"] = rdp_running + state["current_mode"] = "rdp" if rdp_running else "shell" + except: + pass + + return StatusResponse( + current_mode=state["current_mode"], + rdp_active=state["rdp_active"], + last_changed=state["last_changed"], + config=config + ) + +@app.post("/toggle") +async def toggle_mode(request: ToggleRequest): + """모드 전환""" + if request.mode not in ["rdp", "shell"]: + raise HTTPException(status_code=400, detail="Mode must be 'rdp' or 'shell'") + + state = load_state() + + try: + if request.mode == "rdp": + success = enable_rdp() + if success: + state["current_mode"] = "rdp" + state["rdp_active"] = True + else: # shell + success = disable_rdp() + if success: + state["current_mode"] = "shell" + state["rdp_active"] = False + + state["last_changed"] = datetime.now().isoformat() + save_state(state) + + return { + "status": "success", + "mode": request.mode, + "message": f"Switched to {request.mode} mode" + } + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + +@app.get("/config") +async def get_config(): + """현재 설정 반환""" + return load_config() + +@app.put("/config") +async def update_config(update: ConfigUpdate): + """설정 업데이트""" + config = load_config() + + if update.rdp_server: + config["rdp_server"] = update.rdp_server + if update.rdp_username: + config["rdp_username"] = update.rdp_username + if update.rdp_password is not None: + config["rdp_password"] = update.rdp_password + if update.local_user: + config["local_user"] = update.local_user + + save_config(config) + + # 현재 RDP 모드인 경우 재시작 + state = load_state() + if state["rdp_active"]: + disable_rdp() + enable_rdp() + + return { + "status": "success", + "config": config + } + +if __name__ == "__main__": + # Root 권한 확인 + if os.geteuid() != 0: + print("This script must be run as root") + exit(1) + + ensure_directories() + + # 서버 시작 + uvicorn.run(app, host="0.0.0.0", port=8090) \ No newline at end of file diff --git a/RDP/rdp-toggle-web.html b/RDP/rdp-toggle-web.html new file mode 100644 index 0000000..bac9152 --- /dev/null +++ b/RDP/rdp-toggle-web.html @@ -0,0 +1,480 @@ + + + + + + RDP Toggle Control + + + +
+

🖥️ RDP Toggle Control

+ +
+ +
+
+ 연결 상태 + + + 확인 중... + +
+
+ 현재 모드 + - +
+
+ 마지막 변경 + - +
+
+ +
+
+ +
+
+ +
+
RDP 설정
+
+ 서버 주소: + +
+
+ 사용자명: + +
+
+ 비밀번호: + +
+
+ +
+ + +
+ +
+
+

처리 중...

+
+
+ + + + \ No newline at end of file diff --git a/RDP/requirements.txt b/RDP/requirements.txt new file mode 100644 index 0000000..fb95d92 --- /dev/null +++ b/RDP/requirements.txt @@ -0,0 +1,4 @@ +fastapi==0.115.5 +uvicorn==0.32.1 +python-multipart==0.0.20 +pydantic==2.10.3