2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-13 13:10:32 +00:00
Commit Graph

117 Commits

Author SHA1 Message Date
Michael Santos
3e1eea1069 sandbox/rlimit: return value of setrlimit() 2017-10-30 10:09:01 -04:00
Michael Santos
93c6e1378b makefile: define behaviour for signed ints 2017-10-26 10:56:51 -04:00
Michael Santos
60895c46e4 README: use long options, bump version
Bump version for sandbox compilation changes.
2017-09-05 09:54:06 -04:00
Michael Santos
ec32315684 sandbox: use the lowercase name for configuration 2017-08-25 10:47:57 -04:00
Michael Santos
f0092fd58a seccomp: adjust header for syscalls 2017-08-22 16:38:56 -04:00
Michael Santos
fa2ebb799d Use libstrophe base64 support
Use the base64 interface in libstrophe for encoding/decoding instead of
the undocumented interfaces in libresolv.
2017-07-10 10:08:01 -04:00
Michael Santos
e28f208103 Optionally disable TLS cert verification 2017-07-09 08:33:06 -04:00
Michael Santos
3fa5755655 sandbox/rlimit: remove redundant code, ifdef's 2017-07-05 10:11:48 -04:00
Michael Santos
2cf8dc3f0b Merge pull request #2 from pasis/attr-fix
Fix getting wrong attribute from stanza
2017-07-04 08:33:53 -04:00
Dmitry Podgorny
cca644045f Fix getting wrong attribute from stanza 2017-07-03 17:51:05 +03:00
Michael Santos
c184ce68b2 Depend on libstrophe 0.9.2+
libstrophe 0.9.2 supports TLS certificate verification. Tested by:

* valid certificate: verified using strace that xmppipe is reading the
  system SSL cert store

* invalid certificate:

    sudo chmod 700 /usr/lib/ssl

  Verified xmppipe rejected the cert as invalid without the local CA
  root.

* valid certificate, invalid domain

  Verified a subdomain hosted on the XMPP node but not included in the
  TLS certificate is rejected.
2017-07-03 09:45:01 -04:00
Michael Santos
0ad3918c05 Fix options
Terminate long option list so xmppipe doesn't segfault when passed an
unknown option.

Correct the usage. Revert to using --ouput for the MUC name instead of
--stdout to avoid confusion.
2017-07-02 08:05:07 -04:00
Michael Santos
1d89c8cf96 cli: --output -> --stdout 2017-07-01 08:12:53 -04:00
Michael Santos
9fa747fd5c seccomp: allow llseek(2) for TLS verification
libstrophe 0.9.2 uses OpenSSL to validate TLS certs by checking against
the system cert store.

Allow llseek(2). Probably a better way of handling syscalls is to allow
classes of syscalls based on OpenBSD's pledge.
2017-06-30 10:01:02 -04:00
Michael Santos
a6b81e9fbb Merge branch 'pasis-uuid' 2017-06-29 10:22:18 -04:00
Dmitry Podgorny
ef78dc7deb Replace libuuid with xmpp_uuid_gen()
xmpp_uuid_gen() appeared in libstrophe-0.9.0 and solves issues with
libuuid across different systems.
2017-06-28 00:47:56 +03:00
Michael Santos
f201c6a483 Add support for long options 2017-06-27 08:47:01 -04:00
Michael Santos
41a6897bc1 Use native strtonum(3) on BSDs 2017-05-18 09:55:45 -04:00
Michael Santos
78978f725d sandbox: ignore return value of cap_rights_init(3) 2017-05-01 10:33:07 -04:00
Michael Santos
70423ab6a7 capsicum: remove duplicated process rlimit 2017-04-29 09:31:02 -04:00
Michael Santos
26ef980678 makefile: env vars to pass extra build flags 2017-04-26 07:23:55 -04:00
Michael Santos
db0769c1fd makefile: fix static target 2017-04-23 09:55:09 -04:00
Michael Santos
3e9f34f1fb openbsd/freebsd: cc hardening flags 2017-04-20 11:33:25 -04:00
Michael Santos
e98a6b24fa Increment version for pre-connect sandbox 2017-04-19 10:28:47 -04:00
Michael Santos
20f8b5904c Increment version for pre-connect sandbox 2017-04-19 10:22:16 -04:00
Michael Santos
81b4c2f4db seccomp sandbox: allow sendmmsg(2) 2017-04-18 08:54:11 -04:00
Michael Santos
e3e3d0bcf9 seccomp: pre-connect sandbox
Preliminary pre-connect sandbox for Linux. Tested on 32-bit ARM,
requires testing on other platforms.
2017-04-17 08:59:18 -04:00
Michael Santos
140470458f makefile: ensure compile before tests 2017-04-16 15:24:01 -04:00
Michael Santos
f734b5b77b freebsd: disable forking in preconnect sandbox 2017-04-15 11:35:57 -04:00
Michael Santos
6aa2cb528e sandbox: enforce rlimit restrictions before connect
Basic pre-connect sandbox: disable the ability for the xmppipe process
to fork.
2017-04-13 10:02:29 -04:00
Michael Santos
90c57630b6 openbsd: pre-connect pledge sandbox 2017-04-11 08:36:30 -04:00
Michael Santos
c17b196053 sandbox: add a pre-connect sandbox
Add a sandbox enforced before options are parsed and the connection is
established to the XMPP server. This sandbox will allow network
operations.

The post-connect sandbox is unchanged and restricts operations to stdio.

The commit just adds the infrastructure for the pre-connect sandbox.
2017-04-10 11:25:01 -04:00
Michael Santos
9a87cd4e1b openbsd: fix compile error 2017-04-09 08:16:11 -04:00
Michael Santos
899e988a6f roomname: use UID in default roomname
Use the UID of the xmppipe process instead of the PID in the default
name. This allows many processes running under the same user on a host
to share the same output channel and makes it easier to pre-create the
MUC if the xmppipe XMPP user does not have MUC creation privs.
2017-04-08 08:26:14 -04:00
Michael Santos
be90386d6e stream management: check h value in server response 2017-03-19 09:44:59 -04:00
Michael Santos
f4d9184bac Add wrapper around strtonum(3) for options 2017-03-18 08:00:59 -04:00
Michael Santos
cee9094fc8 options: use strtonum(3) to convert numbers
Limit the ranges for integers accepted as command line options.
2017-03-17 08:13:23 -04:00
Michael Santos
f30f666d87 Convert last handled stanza using strtonum(3) 2017-03-05 09:21:58 -05:00
Michael Santos
58cb075664 state: set room name/resource before options 2017-02-26 14:51:44 -05:00
Michael Santos
ad56bab3cc xmppipe_roomname: use define for hostname 2017-02-25 09:18:04 -05:00
Michael Santos
5cb6364cd0 Check gethostname(2) for error
Whether gethostname(2) returns an error depends on the implementation.
Some implementations:

* truncate the hostname if length is less than the hostname, with or
  without a trailing NULL

* return -1 if length is less than hostname

* return -1 if length is 0

Set a default name if gethostanme() returns error.
2017-02-24 10:13:55 -05:00
Michael Santos
0296f2fbbd readme: running tests 2017-02-22 10:27:02 -05:00
Michael Santos
b9c446a928 test: error message for environment variables 2017-02-19 10:32:19 -05:00
Michael Santos
ad39d23c05 test: base64 encode/decode 2017-02-18 09:56:22 -05:00
Michael Santos
7d1fb8fdb8 makefile: add target for test 2017-02-17 09:57:32 -05:00
Michael Santos
e4fcd47b20 test: send using FIFOs between parent/child 2017-02-16 10:42:46 -05:00
Michael Santos
ff86eb8f9a test: send a message using stdin 2017-02-15 08:39:03 -05:00
Michael Santos
6c4a14c712 sandbox/seccomp: fake close(2) return value
Some errors will cause the XMPP file descriptor to be closed before
xmppipe exits. Return EBADF if close is called since the process will
terminate anyway.
2017-02-14 10:23:57 -05:00
Michael Santos
f51377428f Ignore invalid base64 messages
When base64 encoding is enabled, ignore any messages that fail base64
decoding.

Previously signed-unsigned integer conversion would cause the return
value of b64_pton() on error (a negative integer) to be converted to a
large value. The attempt to allocate this value would force xmppipe to
exit.
2017-02-13 10:07:06 -05:00
Michael Santos
85917f8ec4 sandbox/seccomp: print error message using err(3) 2017-02-12 10:17:05 -05:00