|
| 1 | +# Certificate Transparency Monitor |
| 2 | + |
| 3 | +A web application for searching and monitoring SSL/TLS certificates from Certificate Transparency logs, similar to crt.sh. Built with Next.js and ClickHouse. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Multi-type Search**: Search certificates by domain name, common name, serial number, SHA-256 fingerprint, or issuer |
| 8 | +- **Detailed Certificate View**: View complete certificate information including subject, issuer, validity periods, and extensions |
| 9 | +- **Subject Alternative Names**: Display all SAN entries for certificates |
| 10 | +- **Certificate Transparency Logs**: Track which CT log each certificate was found in |
| 11 | +- **Responsive Design**: Works on desktop and mobile devices with dark mode support |
| 12 | + |
| 13 | +## Tech Stack |
| 14 | + |
| 15 | +- **Frontend**: Next.js 15 with React 19 |
| 16 | +- **Styling**: Tailwind CSS 4 |
| 17 | +- **Database**: ClickHouse |
| 18 | +- **Language**: TypeScript |
| 19 | + |
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +- Node.js 18+ |
| 23 | +- ClickHouse database with CT log data |
| 24 | +- Environment variables for ClickHouse connection |
| 25 | + |
| 26 | +## Environment Variables |
| 27 | + |
| 28 | +Create a `.env.local` file in the `ui/` directory with the following variables: |
| 29 | + |
| 30 | +```bash |
| 31 | +CLICKHOUSE_HOST=localhost |
| 32 | +CLICKHOUSE_PORT=8123 |
| 33 | +CLICKHOUSE_USER=default |
| 34 | +CLICKHOUSE_PASSWORD=your_password |
| 35 | +CLICKHOUSE_DATABASE=ct_logs |
| 36 | +``` |
| 37 | + |
| 38 | +## Installation |
| 39 | + |
| 40 | +1. Install dependencies: |
| 41 | +```bash |
| 42 | +npm install |
| 43 | +``` |
| 44 | + |
| 45 | +2. Run the development server: |
| 46 | +```bash |
| 47 | +npm run dev |
| 48 | +``` |
| 49 | + |
| 50 | +3. Open [http://localhost:3000](http://localhost:3000) in your browser |
| 51 | + |
| 52 | +## Database Schema |
| 53 | + |
| 54 | +The application expects a ClickHouse table named `ct_log_entries` with the schema defined in `/schema.sql`. Key fields include: |
| 55 | + |
| 56 | +- Certificate identifiers (SHA-256, serial number) |
| 57 | +- Subject and issuer information |
| 58 | +- Validity periods |
| 59 | +- Subject Alternative Names |
| 60 | +- Certificate extensions and key usage |
| 61 | +- CT log metadata |
| 62 | + |
| 63 | +## API Endpoints |
| 64 | + |
| 65 | +### Get Certificate Details |
| 66 | +``` |
| 67 | +GET /api/certificate/{sha256} |
| 68 | +``` |
| 69 | + |
| 70 | +Returns complete certificate information for a given SHA-256 fingerprint. |
| 71 | + |
| 72 | +## Search Types |
| 73 | + |
| 74 | +1. **Domain/SAN**: Search by domain name or Subject Alternative Name |
| 75 | + - Example: `example.com`, `*.example.com` |
| 76 | + |
| 77 | +2. **Common Name**: Search by certificate Common Name field |
| 78 | + - Example: `www.example.com` |
| 79 | + |
| 80 | +3. **Serial Number**: Search by certificate serial number (hex format) |
| 81 | + - Example: `03f7b3b2a8c9d1e2f4a5b6c7d8e9f0a1` |
| 82 | + |
| 83 | +4. **SHA-256**: Search by certificate SHA-256 fingerprint |
| 84 | + - Example: `a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456` |
| 85 | + |
| 86 | +5. **Issuer**: Search by certificate issuer Common Name |
| 87 | + - Example: `Let's Encrypt Authority X3` |
| 88 | + |
| 89 | +## Project Structure |
| 90 | + |
| 91 | +``` |
| 92 | +ui/ |
| 93 | +├── app/ |
| 94 | +│ ├── api/ |
| 95 | +│ │ ├── search/route.ts # Search API endpoint |
| 96 | +│ │ └── certificate/[sha256]/route.ts # Certificate detail API |
| 97 | +│ ├── certificate/[sha256]/page.tsx # Certificate detail page |
| 98 | +│ ├── layout.tsx # Root layout |
| 99 | +│ ├── page.tsx # Main search page |
| 100 | +│ └── globals.css # Global styles |
| 101 | +├── components/ |
| 102 | +│ ├── search-form.tsx # Search interface |
| 103 | +│ └── certificate-list.tsx # Certificate results list |
| 104 | +├── lib/ |
| 105 | +│ └── clickhouse.ts # ClickHouse client configuration |
| 106 | +├── types/ |
| 107 | +│ └── certificate.ts # TypeScript interfaces |
| 108 | +└── public/ # Static assets |
| 109 | +``` |
| 110 | + |
| 111 | +## Development |
| 112 | + |
| 113 | +- `npm run dev` - Start development server |
| 114 | +- `npm run build` - Build for production |
| 115 | +- `npm run start` - Start production server |
| 116 | +- `npm run lint` - Run ESLint |
| 117 | + |
| 118 | +## Contributing |
| 119 | + |
| 120 | +1. Fork the repository |
| 121 | +2. Create a feature branch |
| 122 | +3. Make your changes |
| 123 | +4. Run linting and tests |
| 124 | +5. Submit a pull request |
| 125 | + |
| 126 | +## License |
| 127 | + |
| 128 | +See the main project LICENSE file. |
0 commit comments