zioinfo-mail/scripts/setup/jenkins_check_users.py
DESKTOP-TKLFCPR\ython 28d3ba4836 refactor(cleanup): commit folder reorganization - scripts/, _archive/, docs/ restructure
- Move backend/frontend/messenger/ old paths to _archive/
- Reorganize scripts into scripts/deploy, check, push, setup, misc
- Move docs (pptx, docx) to docs/
- Add .claude agents and skills for fullstack/folder-cleanup harness
- workspace/ projects remain intact

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 19:43:09 +09:00

32 lines
1.2 KiB
Python

import paramiko, sys
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('101.79.17.164', username='root', password='1q2w3e!Q', timeout=15)
def run(label, cmd):
print(f'\n[{label}]')
_, o, _ = client.exec_command(cmd, timeout=15)
print(o.read().decode('utf-8', errors='replace').strip()[:500])
run('사용자 폴더', 'ls /var/lib/jenkins/users/')
run('admin 설정', 'find /var/lib/jenkins/users -name "config.xml" | xargs cat 2>/dev/null | grep -E "fullName|passwordHash|id" | head -10')
run('Security 설정', 'grep -A10 "securityRealm" /var/lib/jenkins/config.xml | head -15')
# Jenkins 임시 보안 해제 후 비밀번호 재설정
run('보안 임시 해제', """
cp /var/lib/jenkins/config.xml /var/lib/jenkins/config.xml.bak
sed -i 's/<useSecurity>true<\/useSecurity>/<useSecurity>false<\/useSecurity>/' /var/lib/jenkins/config.xml
grep "useSecurity" /var/lib/jenkins/config.xml
""")
run('Jenkins 재시작', 'systemctl restart jenkins && sleep 8')
run('보안 해제 후 API', """
HTTP=$(curl -sf -o /dev/null -w "%{http_code}" http://127.0.0.1:9080/api/json 2>/dev/null)
echo "HTTP: $HTTP"
""")
client.close()