Здесь я описываю, как я развернул сервер vostok для хостинга этой капсулы на машине под управлением операционной системы OpenBSD.
# adduser Use option ``-silent'' if you don't want to see all warnings and questions. Reading /etc/shells Check /etc/master.passwd Check /etc/group Ok, let's go. Don't worry about mistakes. There will be a chance later to correct any input. Enter username []: _vostok Enter full name []: Enter shell csh git-shell ksh nologin sh [ksh]: nologin Uid [1005]: Login group _vostok [_vostok]: Login group is ``_vostok''. Invite _vostok into other groups: guest no [no]: Login class authpf bgpd daemon default dovecot mysqld pbuild staff unbound vmd xenodm [default]: daemon Enter password []: Disable password logins for the user? (y/n) [n]: y Name: _vostok Password: **** Fullname: _vostok Uid: 1005 Gid: 1005 (_vostok) Groups: _vostok Login Class: daemon HOME: /home/_vostok Shell: /sbin/nologin OK? (y/n) [y]: Added user ``_vostok'' Add another user? (y/n) [y]: n Goodbye!
# su -s /bin/sh _vostok $ cd ~ $ git clone --branch v0.0.3 ssh://anonymous@got.any-key.press/vostok
$ cd vostok/ $ make make -C vostok c++ -O2 -pipe -Wall -Wextra -std=c++11 -c -o transport.o transport.cc <...> c++ -O2 -pipe -Wall -Wextra -std=c++11 -c -o vostok.o vostok.cc c++ -o vostok transport.o error.o gemini.o args.o parse_url.o open_file.o vostok.o -ltls
# cd /home/_vostok/vostok # make install make -C vostok install mkdir -p -m 755 /bin install -m 755 vostok /bin/vostok
# mkdir /var/vostok # chown _vostok:_vostok /var/vostok/ # su -s /bin/sh _vostok $ cd /var/vostok
$ mkdir cert $ openssl req -newkey rsa:4096 -nodes -keyout cert/server.key -x509 -days 36500 -out cert/server.crt Generating a 4096 bit RSA private key <...> writing new private key to 'cert/server.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) []: State or Province Name (full name) []: Locality Name (eg, city) []: Organization Name (eg, company) []: Organizational Unit Name (eg, section) []: Common Name (eg, fully qualified host name) []:any-key.press Email Address []:continue@to.any-key.press
$ mkdir capsule $ echo "# Добро пожаловать" > capsule/index.gmi
# cat /etc/rc.d/vostok #!/bin/ksh daemon_args="-a 46.23.89.166 -k /var/vostok/cert/server.key -c /var/vostok/cert/server.crt -f /var/vostok/capsule -m /usr/share/misc/mime.types" daemon_user="_vostok" daemon="vostok ${daemon_args}" . /etc/rc.d/rc.subr pexp="${daemon}.*" rc_reload=NO rc_bg=YES rc_cmd $1
# chmod +x /etc/rc.d/vostok
# rcctl enable vostok # rcctl start vostok vostok(ok)
$ amfora any-key.press