NEWS.RU | 1 + THANKS | 7 ++++++- TODO | 2 +- VERSION | 2 +- common.mk | 2 +- doc/Makefile | 8 ++++++-- doc/about.ru.texi | 17 +++++++---------- doc/about.texi | 14 +++++++------- doc/client.texi | 24 +++++++++++------------- doc/contacts.texi | 5 ----- doc/cpr.texi | 4 +--- doc/developer.texi | 3 --- doc/download.texi | 41 +++++++++++++++++++++-------------------- doc/egd.texi | 11 ++++------- doc/encless.texi | 7 ------- doc/example.texi | 30 +++++++++++++----------------- doc/faq.ru.texi | 139 +++++++++++++++++++++++++++++++++++------------------ doc/faq.texi | 152 +++++++++++++++++++++++++++++++++-------------------- doc/glossary.texi | 2 ++ doc/govpn.texi => doc/index.texi | 16 +++------------- doc/handshake.texi | 15 --------------- doc/identity.texi | 2 -- doc/installation.texi | 27 +++++++++------------------ doc/integrity.texi | 6 +----- doc/media.texi | 2 -- doc/mtu.texi | 2 -- doc/netproto.texi | 4 ---- doc/news.ru.texi | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/news.texi | 188 ++++++++++++++++++++++++++++++----------------------- doc/noise.texi | 4 +--- doc/pake.texi | 2 -- doc/precautions.texi | 4 +--- doc/proxy.texi | 9 ++------- doc/russian.texi | 12 ++++++++++++ doc/server.texi | 24 ++++++++---------------- doc/sources.texi | 10 ++-------- doc/stats.texi | 4 +--- doc/style.css | 13 +++++++++++++ doc/thanks.texi | 23 ++++++----------------- doc/timeout.texi | 1 - doc/timesync.texi | 19 +++++++++++++++++++ doc/todo.texi | 9 --------- doc/transport.texi | 8 -------- doc/user.texi | 3 --- doc/verifier.texi | 16 +++++++--------- doc/verifierstruct.texi | 4 ---- src/cypherpunks.ru/govpn/cmd/govpn-client/main.go | 9 ++++++++- src/cypherpunks.ru/govpn/cmd/govpn-server/conf.go | 9 +++------ src/cypherpunks.ru/govpn/conf.go | 1 + src/cypherpunks.ru/govpn/handshake.go | 16 ++++++++++------ src/cypherpunks.ru/govpn/identify.go => src/cypherpunks.ru/govpn/identity.go | 62 +++++++++++++++++++++++++++++++++-------------------- src/cypherpunks.ru/govpn/tap.go | 16 +++++++--------- src/cypherpunks.ru/govpn/verifier.go | 2 +- utils/makedist.sh | 2 +- diff --git a/NEWS.RU b/NEWS.RU new file mode 120000 index 0000000000000000000000000000000000000000..85f9daf175ebac5a755ebba947addfb79b4e284e --- /dev/null +++ b/NEWS.RU @@ -0,0 +1 @@ +doc/news.ru.texi \ No newline at end of file diff --git a/THANKS b/THANKS old mode 120000 new mode 100644 index 7862103b6ce3dcb94d50a3a99cf56a073679a89e..740d6b38109de82880f578dc99b093d94460f264 --- a/THANKS +++ b/THANKS @@ -1 +1,6 @@ -doc/thanks.texi \ No newline at end of file +* Applied Cryptography (https://www.schneier.com/books/applied_cryptography/) (C) 1996 Bruce Schneier. +* Strong Password-Only Authenticated Key Exchange (http://tnlandforms.us/cns05/speke.pdf) (C) 1996 David P. Jablon. +* Augmented Encrypted Key Exchange (https://www.cs.columbia.edu/~smb/papers/aeke.pdf): a Password-Based Protocol Secure Against Dictionary Attacks and Password File Compromise (C) Steven M. Belloving, Michael Merrit. +* Watson Ladd for suggestion of Elligator (http://elligator.cr.yp.to/) encoding. +* Password Hashing Competition for Argon2 (https://password-hashing.net/#argon2). +* Chaffing and Winnowing: Confidentiality without Encryption (http://people.csail.mit.edu/rivest/chaffing-980701.txt) (C) Ronald L. Rivest diff --git a/TODO b/TODO old mode 120000 new mode 100644 index e8b79ff7bcccc2d0ab0409382a279d9b0ddf963e..2ecafb04518cb20354d7c44ac67daf0579a20fbf --- a/TODO +++ b/TODO @@ -1 +1 @@ -doc/todo.texi \ No newline at end of file +* Randomize ports usage diff --git a/VERSION b/VERSION index d346e2ab7f2109b12c9bf53299bbbf6e7527fe7f..37c2d9960ec72414b3941f8f4c1172fb6e3c6e7f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.3 +5.4 diff --git a/common.mk b/common.mk index 8597a61f79d6b7c5cb32f194353a0bc2af617cb6..0730f59f283057ac2d1e8759d52f15e3624d34ee 100644 --- a/common.mk +++ b/common.mk @@ -1,6 +1,6 @@ .PHONY: doc -LDFLAGS = -X govpn.Version=$(VERSION) +LDFLAGS = -X cypherpunks.ru/govpn.Version=$(VERSION) PREFIX ?= /usr/local BINDIR = $(DESTDIR)$(PREFIX)/bin INFODIR = $(DESTDIR)$(PREFIX)/info diff --git a/doc/Makefile b/doc/Makefile index e68437a4e8229a75d987426f678847ad5ac5d8a8..d51a84341651772baaebf27b094a6a2ae76a9569 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -6,8 +6,12 @@ handshake.utxt: handshake.txt plantuml -tutxt handshake.txt govpn.info: *.texi handshake.utxt - $(MAKEINFO) govpn.texi + $(MAKEINFO) index.texi govpn.html: *.texi handshake.utxt rm -f govpn.html/*.html - $(MAKEINFO) --html --css-include=style.css -o govpn.html govpn.texi + $(MAKEINFO) --html \ + --css-include=style.css \ + --set-customization-variable SHOW_TITLE=0 \ + --set-customization-variable DATE_IN_HEADER=1 \ + -o govpn.html index.texi diff --git a/doc/about.ru.texi b/doc/about.ru.texi index e301259441fe5e8aab9de1f31f6423ecbe1285f9..5bb7995e03967ecae194ef37d9486f45b563ed60 100644 --- a/doc/about.ru.texi +++ b/doc/about.ru.texi @@ -1,10 +1,5 @@ @node О демоне -@cindex About (russian) -@cindex Description (russian) -@cindex О демоне -@cindex Описание -@cindex Вступление -@unnumbered Подробнее о демоне GoVPN +@section Подробнее о демоне GoVPN GoVPN это простой демон виртуальных частных сетей, код которого нацелен на лёгкость чтения и анализа, безопасность, устойчивость к DPI/цензуре. @@ -12,8 +7,10 @@ @itemize @item -Свободное программное обеспечение, копилефт: лицензировано под условиями -@url{https://www.gnu.org/licenses/gpl-3.0.ru.html, GPLv3+}. +@url{https://www.gnu.org/philosophy/free-sw.ru.html, Свободное программное +обеспечение}, @url{https://www.gnu.org/philosophy/pragmatic.ru.html, копилефт}: +лицензировано под условиями @url{https://www.gnu.org/licenses/gpl-3.0.ru.html, +GPLv3+}. @item Быстрый сильный @ref{PAKE, аутентифицируемый по парольной фразе} @@ -22,7 +19,7 @@ двусторонней аутентификацией сторон и нулевым неразглашением (PAKE DH A-EKE (Diffie-Hellman Augmented Encrypted Key Exchange)). @item -@ref{Verifier structure, Несбалансированные аутентификационные токены} +@ref{Verifier structure, Несбалансированные верификаторы} устойчивые к внесетевым (offline) атакам по словарю. Используют усиленный по CPU и памяти алгоритм хэширования. Злоумышленник не может замаскироваться под клиента даже скомпрометировав базу данных токенов @@ -50,7 +47,7 @@ совершенной прямой секретности} (perfect forward secrecy). @item Защита от атак повторного воспроизведения (replay) (используя -одноразовые MAC). +одноразовые MAC и опциональное условие @ref{Timesync, синхронизации времени}). @item Встроенные функции пересогласования ключей (ротация сессионных ключей) и diff --git a/doc/about.texi b/doc/about.texi index de1abe907534bee6e6aff56dfbe9dd4d1f2dad06..a3ed945f20c1037a72260c9a641594736a766c1d 100644 --- a/doc/about.texi +++ b/doc/about.texi @@ -1,16 +1,15 @@ -@cindex About -@cindex Description -@cindex Introduction - GoVPN is simple free software virtual private network daemon, aimed to be reviewable, secure and @url{https://en.wikipedia.org/wiki/Deep_packet_inspection, DPI}/censorship-resistant. + +See also this page @ref{О демоне, on russian}. @itemize @item -Copylefted free software: licenced under -@url{https://www.gnu.org/licenses/gpl-3.0.html, GPLv3+}. +@url{https://www.gnu.org/philosophy/pragmatic.html, Copylefted} +@url{https://www.gnu.org/philosophy/free-sw.html, free software}: +licenced under @url{https://www.gnu.org/licenses/gpl-3.0.html, GPLv3+}. @item Fast strong @ref{PAKE, passphrase authenticated} augmented @@ -44,7 +43,8 @@ @url{https://en.wikipedia.org/wiki/Forward_secrecy, Perfect forward secrecy} property. @item -Replay attack protection (using one-time MACs). +Replay attack protection (using one-time MACs and optional +@ref{Timesync, time synchronization} requirement). @item Built-in rehandshake (session key rotation) and heartbeat features. diff --git a/doc/client.texi b/doc/client.texi index ba7503874b41e9e02e3b1334929ddbc4486fc3eb..5b0ae2b7fda2723894f76a765641ae736c656f95 100644 --- a/doc/client.texi +++ b/doc/client.texi @@ -1,22 +1,16 @@ @node Client -@cindex Client -@cindex Client part -@cindex Client configuration -@cindex Client side -@cindex Configuring client -@cindex govpn-client @section Client part -Except for common @code{-stats}, @code{-egd} options client has the -following ones: +Except for common @ref{Stats, -stats}, @ref{EGD, -egd} options client +has the following ones: -@table @code +@table @option @item -mtu Expected TAP interface @ref{MTU}. @item -proto -@ref{Network, network protocol} to use. Can be either @emph{udp} +@ref{Network, Network protocol} to use. Can be either @emph{udp} (default) or @emph{tcp}. @item -proxy @@ -42,6 +36,10 @@ to enter it in the terminal. @item -timeout @ref{Timeout} setting in seconds. + +@item -timesync +Optional @ref{Timesync, time synchronization} requirement. If set to +zero, then no synchronization required. @item -noise Enable @ref{Noise}. @@ -57,7 +55,7 @@ Optional path to script that will be executed after connection is established. Interface name will be given to it as a first argument. @item -down -Same as @code{-up} above, but it is executed when connection is lost, +Same as @option{-up} above, but it is executed when connection is lost, when we exit. @end table @@ -65,11 +63,11 @@ Example up-script that calls DHCP client and IPv6 advertisement solicitation: -@example +@verbatim client% cat > up.sh < 0, then XOR timestamp with the data. +func AddTimeSync(ts int, data []byte) { + if ts == 0 { + return + } + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, uint64(time.Now().Unix()/int64(ts)*int64(ts))) + for i := 0; i < 8; i++ { + data[i] ^= buf[i] + } +} + // Try to find peer's identity (that equals to an encryption key) // by taking first blocksize sized bytes from data at the beginning // as plaintext and last bytes as cyphertext. @@ -87,8 +102,9 @@ return nil } buf := make([]byte, xtea.BlockSize) cc.l.RLock() - for pid, cipher := range cc.c { - cipher.Decrypt(buf, data[len(data)-xtea.BlockSize:]) + for pid, ct := range cc.c { + ct.c.Decrypt(buf, data[len(data)-xtea.BlockSize:]) + AddTimeSync(ct.t, buf) if subtle.ConstantTimeCompare(buf, data[:xtea.BlockSize]) == 1 { ppid := PeerId(pid) cc.l.RUnlock() diff --git a/src/cypherpunks.ru/govpn/tap.go b/src/cypherpunks.ru/govpn/tap.go index 6e545b4decfeae9262a73f82e00348e60c89c609..8a44575e5e4eddfd6235ca143d5af8ff9e318ef9 100644 --- a/src/cypherpunks.ru/govpn/tap.go +++ b/src/cypherpunks.ru/govpn/tap.go @@ -26,9 +26,6 @@ type TAP struct { Name string Sink chan []byte dev io.ReadWriter - buf0 []byte - buf1 []byte - bufZ bool } var ( @@ -43,21 +40,22 @@ } tap := TAP{ Name: ifaceName, dev: tapRaw, - buf0: make([]byte, mtu), - buf1: make([]byte, mtu), Sink: make(chan []byte), } go func() { var n int var err error var buf []byte + buf0 := make([]byte, mtu) + buf1 := make([]byte, mtu) + bufZ := false for { - if tap.bufZ { - buf = tap.buf0 + if bufZ { + buf = buf0 } else { - buf = tap.buf1 + buf = buf1 } - tap.bufZ = !tap.bufZ + bufZ = !bufZ n, err = tap.dev.Read(buf) if err != nil { panic("Reading TAP:" + err.Error()) diff --git a/src/cypherpunks.ru/govpn/verifier.go b/src/cypherpunks.ru/govpn/verifier.go index a452a50a84737231a2e0e3d28701dee10138bf23..15955e77a2cf65e35ab18172d638a677170a3200 100644 --- a/src/cypherpunks.ru/govpn/verifier.go +++ b/src/cypherpunks.ru/govpn/verifier.go @@ -73,7 +73,7 @@ // Parse either short or long verifier form. func VerifierFromString(input string) (*Verifier, error) { s := strings.Split(input, "$") - if !(len(s) != 4 || len(s) != 5) || s[1] != "argon2d" { + if len(s) < 4 || s[1] != "argon2d" { return nil, errors.New("Invalid verifier structure") } var m, t, p int diff --git a/utils/makedist.sh b/utils/makedist.sh index 2a6ee311f36610e0de9c7080fe83defb77b79d0b..278ee2db7a1732de490c197e7474a6d264c14c36 100755 --- a/utils/makedist.sh +++ b/utils/makedist.sh @@ -63,7 +63,7 @@ size=$(( $(cat $tarball | wc -c) / 1024 )) hash=$($SHA256 $tarball | sed 's/^.*\([0-9a-f]\{64\}\).*$/\1/') cat <