From: Sergey Matveev Date: Sun, 31 Jan 2016 15:50:28 +0000 (+0300) Subject: Merge branch 'develop' X-Git-Tag: 5.4 X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=refs%2Ftags%2F5.4;hp=a87ec543051d428aaa3888804d6c8451f6d537c9;p=govpn.git Merge branch 'develop' Signed-off-by: Sergey Matveev --- diff --git a/NEWS.RU b/NEWS.RU new file mode 120000 index 0000000..85f9daf --- /dev/null +++ b/NEWS.RU @@ -0,0 +1 @@ +doc/news.ru.texi \ No newline at end of file diff --git a/THANKS b/THANKS deleted file mode 120000 index 7862103..0000000 --- a/THANKS +++ /dev/null @@ -1 +0,0 @@ -doc/thanks.texi \ No newline at end of file diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..740d6b3 --- /dev/null +++ b/THANKS @@ -0,0 +1,6 @@ +* 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 deleted file mode 120000 index e8b79ff..0000000 --- a/TODO +++ /dev/null @@ -1 +0,0 @@ -doc/todo.texi \ No newline at end of file diff --git a/TODO b/TODO new file mode 100644 index 0000000..2ecafb0 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +* Randomize ports usage diff --git a/VERSION b/VERSION index d346e2a..37c2d99 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.3 +5.4 diff --git a/common.mk b/common.mk index 8597a61..0730f59 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 e68437a..d51a843 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 e301259..5bb7995 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 @@ GoVPN это простой демон виртуальных частных с @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 @@ GoVPN это простой демон виртуальных частных с A-EKE (Diffie-Hellman Augmented Encrypted Key Exchange)). @item -@ref{Verifier structure, Несбалансированные аутентификационные токены} +@ref{Verifier structure, Несбалансированные верификаторы} устойчивые к внесетевым (offline) атакам по словарю. Используют усиленный по CPU и памяти алгоритм хэширования. Злоумышленник не может замаскироваться под клиента даже скомпрометировав базу данных токенов @@ -50,7 +47,7 @@ A-EKE (Diffie-Hellman Augmented Encrypted Key Exchange)). @item Защита от атак повторного воспроизведения (replay) (используя -одноразовые MAC). +одноразовые MAC и опциональное условие @ref{Timesync, синхронизации времени}). @item Встроенные функции пересогласования ключей (ротация сессионных ключей) и diff --git a/doc/about.texi b/doc/about.texi index de1abe9..a3ed945 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 @@ indistinguishable from the noise with optionally hidden packets length. 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 ba75038..5b0ae2b 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 @@ -43,6 +37,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 @@ when we exit. 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 @@ func (cc *CipherCache) Find(data []byte) *PeerId { } 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 6e545b4..8a44575 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 @@ func NewTAP(ifaceName string, mtu int) (*TAP, error) { 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 a452a50..15955e7 100644 --- a/src/cypherpunks.ru/govpn/verifier.go +++ b/src/cypherpunks.ru/govpn/verifier.go @@ -73,7 +73,7 @@ func (v *Verifier) PasswordApply(password string) *[ed25519.PrivateKeySize]byte // 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 2a6ee31..278ee2d 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 <