Files
Pier_v1/RAG/design-model-box-sample_2/tools/set_company_password.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

35 lines
1.3 KiB
Python

"""Create a local gateway password record; never store a default password."""
import argparse
import getpass
import hashlib
import json
import os
from pathlib import Path
import secrets
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--auth-file', type=Path,
default=Path('.runtime-data/company-auth.json'))
args = parser.parse_args()
if args.auth_file.exists():
parser.error('Auth file already exists; choose a new file for rotation.')
password = getpass.getpass('New company password: ')
if not password or password != getpass.getpass('Confirm password: '):
parser.error('Passwords must be nonempty and match.')
salt = secrets.token_bytes(32)
iterations = 260000
record = {'salt': salt.hex(), 'iterations': iterations,
'hash': hashlib.pbkdf2_hmac('sha256', password.encode(), salt, iterations).hex()}
args.auth_file.parent.mkdir(parents=True, exist_ok=True)
fd = os.open(args.auth_file, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
with os.fdopen(fd, 'w', encoding='utf-8') as stream:
json.dump(record, stream)
stream.write('\n')
print('Local authentication record created. Restart the gateway to apply.')
if __name__ == '__main__':
main()