diff options
Diffstat (limited to 'net/gemserv/files')
-rw-r--r-- | net/gemserv/files/config.toml.sample.in | 38 | ||||
-rw-r--r-- | net/gemserv/files/gemserv.in | 2 | ||||
-rw-r--r-- | net/gemserv/files/patch-powerpc | 62 | ||||
-rw-r--r-- | net/gemserv/files/patch-src_lib_tls.rs | 35 |
4 files changed, 72 insertions, 65 deletions
diff --git a/net/gemserv/files/config.toml.sample.in b/net/gemserv/files/config.toml.sample.in index 5c9d4129de61..5ba435ff6881 100644 --- a/net/gemserv/files/config.toml.sample.in +++ b/net/gemserv/files/config.toml.sample.in @@ -1,6 +1,12 @@ -port = 1965 -# use "::" for ipv6 and ipv4 or "0.0.0.0" for ipv4 only -host = "0.0.0.0" +# interface accepts multiple interface/port combinations. However, due to the +# dual stack nature of linux if you specify "[::]:1965" linux will also listen +# on "0.0.0.0:1965" so if you manually specify both it will fail. +# interface = [ "0.0.0.0:1965, "[::]:1965" ] +interface = [ "[::]:1965" ] +# port and host have been deprecated in favor of interface but will still work +# for now. +# port = 1965 +# host = "::" # log is optional and server wide. It defaults to info if not set. Other levels # are error, warn, and info. If error is set it will only show error. If warn # is set it will show error and warn. Info shows all three. @@ -19,3 +25,29 @@ cert = "/usr/local/etc/gemserv/cert.pem" index = "index.gmi" # lang is optional lang = "en" +# cgi is optional bool +cgi = true +# cgipath is optional and only checked if cgi is true. It restricts cgi to only +# this directory. +cgipath = "/path/to/cgi-bin/" +# scgi is optional +scgi = { "/scgi" = "localhost:4000" } +# cgienv is optional +cgienv = { "GIT_PROJECT_ROOT" = "/srv/git" } +# usrdir is optional. it'll look in each user's ~/public_gemini +usrdir = true +# proxy is optional +# path is what comes after the hostname e.g. example.com/path +proxy = { path = "localhost:1966" } +# proxy_all is optional +# It will send all requests to the specified server. It also supports streamming. +proxy_all = "localhost:1967" +# redirect is optional +redirect = { "/redirect" = "/", "/newdomain" = "gemini://example.net" } + +# Server 2 +[[server]] +hostname = "example.net" +dir = "/path/to/serv/" +key = "/path/to/key" +cert = "/path/to/cert" diff --git a/net/gemserv/files/gemserv.in b/net/gemserv/files/gemserv.in index b1fcb394f1ed..91af19354ae9 100644 --- a/net/gemserv/files/gemserv.in +++ b/net/gemserv/files/gemserv.in @@ -59,6 +59,8 @@ pidfile=/var/run/gemserv.pid command=/usr/sbin/daemon procname=%%PREFIX%%/bin/gemserv command_args="-p ${pidfile} ${gemserv_syslog_output_flags} ${procname} ${gemserv_config}" +# reload: support SIGHUP to reparse configuration file +extra_commands="reload" start_precmd="gemserv_start_precmd" stop_postcmd="gemserv_stop_postcmd" diff --git a/net/gemserv/files/patch-powerpc b/net/gemserv/files/patch-powerpc deleted file mode 100644 index 15718f32a5ab..000000000000 --- a/net/gemserv/files/patch-powerpc +++ /dev/null @@ -1,62 +0,0 @@ ---- cargo-crates/libc-0.2.81/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2020-03-17 20:35:43 UTC -+++ cargo-crates/libc-0.2.81/src/unix/bsd/freebsdlike/freebsd/mod.rs -@@ -1486,6 +1486,9 @@ cfg_if! { - } else if #[cfg(target_arch = "powerpc64")] { - mod powerpc64; - pub use self::powerpc64::*; -+ } else if #[cfg(target_arch = "powerpc")] { -+ mod powerpc; -+ pub use self::powerpc::*; - } else { - // Unknown target_arch - } ---- cargo-crates/libc-0.2.81/src/unix/bsd/freebsdlike/freebsd/powerpc.rs.orig 2021-06-23 22:40:24 UTC -+++ cargo-crates/libc-0.2.81/src/unix/bsd/freebsdlike/freebsd/powerpc.rs -@@ -0,0 +1,47 @@ -+pub type c_char = u8; -+pub type c_long = i32; -+pub type c_ulong = u32; -+pub type wchar_t = i32; -+pub type time_t = i64; -+pub type suseconds_t = i32; -+pub type register_t = i32; -+ -+s! { -+ pub struct stat { -+ pub st_dev: ::dev_t, -+ pub st_ino: ::ino_t, -+ pub st_mode: ::mode_t, -+ pub st_nlink: ::nlink_t, -+ pub st_uid: ::uid_t, -+ pub st_gid: ::gid_t, -+ pub st_rdev: ::dev_t, -+ pub st_atime: ::time_t, -+ pub st_atime_nsec: ::c_long, -+ pub st_mtime: ::time_t, -+ pub st_mtime_nsec: ::c_long, -+ pub st_ctime: ::time_t, -+ pub st_ctime_nsec: ::c_long, -+ pub st_size: ::off_t, -+ pub st_blocks: ::blkcnt_t, -+ pub st_blksize: ::blksize_t, -+ pub st_flags: ::fflags_t, -+ pub st_gen: u32, -+ pub st_lspare: i32, -+ pub st_birthtime: ::time_t, -+ pub st_birthtime_nsec: ::c_long, -+ } -+} -+ -+// should be pub(crate), but that requires Rust 1.18.0 -+cfg_if! { -+ if #[cfg(libc_const_size_of)] { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; -+ } else { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = 4 - 1; -+ } -+} -+ -+pub const MAP_32BIT: ::c_int = 0x00080000; -+pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 diff --git a/net/gemserv/files/patch-src_lib_tls.rs b/net/gemserv/files/patch-src_lib_tls.rs new file mode 100644 index 000000000000..83a12a2e21b4 --- /dev/null +++ b/net/gemserv/files/patch-src_lib_tls.rs @@ -0,0 +1,35 @@ +--- src/lib/tls.rs.orig 2022-08-17 08:17:36 UTC ++++ src/lib/tls.rs +@@ -10,7 +10,7 @@ use rustls::{Certificate, Error, PrivateKey}; + use rustls::server::{ClientCertVerified, ClientCertVerifier, ResolvesServerCertUsingSni}; + use rustls::sign::{self, CertifiedKey}; + use rustls::{Certificate, Error, PrivateKey}; +-use rustls_pemfile::{certs, pkcs8_private_keys}; ++use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys}; + use tokio_rustls::rustls; + use tokio_rustls::TlsAcceptor; + +@@ -34,7 +34,22 @@ fn load_key(path: &str) -> io::Result<Vec<PrivateKey>> + } + + fn load_key(path: &str) -> io::Result<Vec<PrivateKey>> { +- pkcs8_private_keys(&mut std::io::BufReader::new(std::fs::File::open(path)?)) ++ let mut private_keys = pkcs8_private_keys(&mut std::io::BufReader::new(std::fs::File::open(path)?)); ++ let rsa_keys = rsa_private_keys(&mut std::io::BufReader::new(std::fs::File::open(path)?)); ++ // It is common to use RSA keys that are not PKCS8-formatted ++ // we need to join both RSA and PKCS8 keys ++ if rsa_keys.is_ok() ++ { ++ if private_keys.is_ok() ++ { ++ let mut all_keys = private_keys.ok().unwrap_or_default(); ++ all_keys.extend(rsa_keys.ok().unwrap_or_default()); ++ private_keys = Ok(all_keys); ++ } ++ else ++ { private_keys = rsa_keys; } ++ } ++ private_keys + .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid key")) + .map(|mut keys| keys.drain(..).map(PrivateKey).collect()) + } |