- Notifications
You must be signed in to change notification settings - Fork0
wrclark/gem
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
gemini server with TLS and script for generating working TLS certs
Supports
- mime types
- directory listing
- chunked file transfer
- passes most gemini-diagnostics tests
- user-defined charset/lang meta attributes
To build you may need to installlibssl-dev
$ sudo apt install libssl-dev$ make ssl$ make$ sudo setcap cap_sys_chroot+ep gem
Last step is required forchroot
(or you can run as root/sudo)
-c [pub cert path] ex: -c "gem.crt" (tls/server.crt default)-k [priv key path] ex: -k "gem.key" (tls/server.key default)-h [HOSTNAME] ex: -h "example.com" (localhost default)-p [PORT] ex: -p 1965 (default)-d [DOC ROOT] ex: -d "/var/gemini"-i [INDEX FILE] ex: -i "index.gmi" (default)-e enumerate directories without an index file-a permit requests with a different hostname-v print request information
Run with./gem -d capsule -aev
The options-c
for the certificate file (pub key) and-k
for the private key can be used for this purpose.
# example setup$ ./gem -aev -d~/gemini/capsule -c server.crt -k secret.key
To use your own domain name you have to replace/CN=localhost
in thessl
make target to your domain: egexample.com
=>/CN=example.com
.
Then you must also specify the domain as the hostname when running the program:
./gem -h"example.com" -d capsule -aev
The-a
flag can be useful for accessing the server over IP (perhaps over LAN) without a DNS name.
The-d
flag must always be specified.
These are optional, special attributes in the gemini header that define the charset and language used on the page.
To define the language for all the text files in a directory, simply create a.lang
file with anISO 639 2-letter-code optionally followed by by anISO 3166-1 country code.
Examples:
en-GBen-USrues-MXsv-FIja
Character encoding.utf-8
should be enough but some text may require any of the following to render properly:
ISO-8859-1Windows-1251Windows-1252GB2312Shift_JIS
These 'rules' apply for all the files in that directory. Also make sure it is enabled (1
) inconfig.h
.
capsule/├── .charset <--- "utf-8"├── dog.png├── index.gmi├── .lang <--- "en-GB"└── misc ├── 🦊🐦🦉🐞🦓 │ ├── 🦩.gmi │ ├── 🐅.gmi │ ├── 🐧.gmi │ ├── 🐬.gmi │ └── 🐺.gmi ├── jp │ ├── .charset <--- "Shift_JIS" │ ├── .lang <--- "ja" │ └── samurai_text_shift_jis.txt └── міжнародний ├── Sultan'ın garaj uzmanı ├── документ на русском языке.txt ├── คำสารภาพ └── 中国
Great development tool:
https://github.com/michael-lazar/gemini-diagnostics
Test gemini client:
echo"gemini://localhost"| openssl s_client -quiet -crlf -connect localhost:1965
About
gemini server