커스터마이징, 테스트, 관리
Nautilus 서버 로직은 src/nautilus-server directory에 있다. 애플리케이션을 커스터마이즈하려면 Nautilus 사용하기를 템플릿으로 참조한다.
정보
이러한 customization, testing, management 단계는 자체 관리되는 TEE를 위한 것이다. 대안으로 Docker 기반 단순성으로 testing 및 management 오버헤드를 제거하는 Marlin Oyster marketplace를 사용할 수 있다.
custom server logic 생성
Nautilus 서버를 커스터마이즈하여 허용할 endpoint를 정의하고 애플리케이션이 접근해야 하는 외부 domain을 지정할 수 있다. process_data 로직을 정의하고 추가 endpoint를 등록하기 위해 mod.rs를 만들 수 있다.
다음 file은 일반적으로 수정이 필요하지 않다:
common.rs는get_attestationendpoint를 처리한다.main.rs는 ephemeral key pair를 초기화하고 HTTP 서버를 설정한다.
local testing
대부분의 기능은 서버를 로컬에서 실행하여 테스트할 수 있다. 그러나 get_attestation endpoint는 Nitro Secure Module(NSM) driver에 대한 접근이 필요하므로 로컬에서는 동작하지 않는데, 이는 구성된 EC2 instance 내부에서 code를 실행할 때만 사용할 수 있기 때문이다. 이 endpoint는 설정 단계에서 설명한 대로 서버가 enclave 내부에서 실행될 때 정상 동작한다.
로컬에서 process_data endpoint를 테스트하려면 다음을 실행한다:
$ cd src/nautilus-server/
$ RUST_LOG=debug API_KEY=045a27812dbe456392913223221306 cargo run --features=weather-example --bin nautilus-server
$ curl -H 'Content-Type: application/json' -d '{"payload": { "location": "San Francisco"}}' -X POST http://localhost:3000/process_data
Click to open
Output
{
"response":
{
"intent":0,
"timestamp_ms":1744041600000,
"data":
{
"location":"San Francisco",
"temperature":13
}
},
"signature":"b75d2d44c4a6b3c676fe087465c0e85206b101e21be6cda4c9ab2fd4ba5c0d8c623bf0166e274c5491a66001d254ce4c8c345b78411fdee7225111960cff250a"
}