Commit graph

280 commits

Author SHA1 Message Date
Jacob Moody 227a46e47d ip/dhcpd: quiet up syslog
the packet prints can be found
through -d now.
2022-06-16 02:29:36 +00:00
Jacob Moody df92301d8f ip/ipconfig: refactor plan9 vendor parsing
Unless ip/dhcpd is started with the -6 option,
we only receive v4 addresses. If we do see the
v6 options we should prefer them but should
also make sure we grab the v4 addresses as a fallback.

None of the v6 options should overwrite valid
overrides given at the command line.

Add our custom types to logging.
2022-06-05 20:56:57 +00:00
Jacob Moody 207d124dfe ip/dhcpd: properly skip past ipv6 addresses in addrsopt
If the first address passed happened to be an ipv6
address we would send a malformed option by never including
a ipv4 address.
2022-06-05 18:02:58 +00:00
cinap_lenrek dfa6b6c670 ip/sol: handle timeout on password entry for digest auth 2022-04-19 02:06:33 +00:00
cinap_lenrek 9993b3909e ip/torrent: fix silly readn() error check (thanks pr) 2022-04-18 21:03:40 +00:00
cinap_lenrek 1a4e03cf93 ip/sol: kvm (vnc) redirect, bring back plain authentication as a fallback (when unsupported) 2022-04-03 04:19:46 +00:00
cinap_lenrek 31294b6c1a ip/sol: use httpdigest authentication
httpdigest authentication allows one to share the key
in factotum with the amt webserver on https://target:16993
2022-04-02 21:47:00 +00:00
cinap_lenrek ca60e03c5b ip/sol: add intel AMT serial-over-lan console program 2022-04-01 21:24:42 +00:00
cinap_lenrek e83917a658 ip/dhcpd: ignore ipv6 addresses when looking up static binding 2022-03-18 19:54:23 +00:00
cinap_lenrek ca313087c1 ip(3): use flags instead of tag for 8 column route add/remove
This avoids ipconfig having to explicitely specify the tag
when we want to set route type, as the tag can be provided
implicitely thru the "tag" command.
2022-03-14 18:45:27 +00:00
cinap_lenrek 263251da75 ip/dhcpd: ignore icmp advice
should ignore advice as we are handling all connections
thru a single udp connection.
2022-03-13 20:43:16 +00:00
cinap_lenrek c8507f428f ipconfig(8): add -t flag to enable source address translation 2022-03-13 17:29:16 +00:00
cinap_lenrek fd1cfc824a snoopy: add vlan protocol (802.1q) 2022-02-27 03:33:01 +00:00
cinap_lenrek e4f30c89f4 ip/tftpd: add -m argument for name substitution using regular expressions
This allows mapping incoming filenames to a different name
using regular expressions, followed by subtitutions
of the %[ICE] format strings.

I needed this to have individual cmdline.txt files for
netbooted raspberry pi's. In this example, i map cmdline.txt
to %C, which gets substituted for /cfg/pxe/$ether of the client.
2022-02-05 01:34:22 +00:00
cinap_lenrek cdf3be65ea snoopy: dns: add caa record type, fix rrtypestr() 2021-11-03 21:44:24 +00:00
cinap_lenrek 6285c19b33 snoopy: adjust for new dns txt rr format 2021-11-03 20:21:03 +00:00
qwx 987d15e7b2 tinc: fix typo in unknown host error message 2021-10-31 22:48:20 +00:00
cinap_lenrek 96560abe44 acmed: reject -t flag when -e is given, dup stderr to stdout of -e cmd 2021-10-27 17:08:20 +00:00
cinap_lenrek 79c6a0f342 acmed: tokenize domains from subject also with spaces (fixed multidom cert) 2021-10-25 18:15:53 +00:00
cinap_lenrek 87eb9bc2b7 acmed: add external command flag -e, improvements, bugs
- allow for external command to be run to install a challenge using -e flag
- remove the challengedom argument, it is given by the subject in the csr
- fix some filedescriptor leaks in error paths
2021-10-25 16:59:29 +00:00
Ori Bernstein 4c7745b202 acmed: import acme (RFC8555) client 2021-10-15 00:32:32 +00:00
cinap_lenrek 7fd9be0f08 snoopy: ... and fix the memory leak for new dns rr types 2021-08-18 19:37:44 +00:00
cinap_lenrek 97c6a1dd52 snoopy: fix dns nil pointer crashes when formating dns packets (thanks sl)
snoopy shares ndb/dns's dns parser code, but has its own
copy of rralloc() function, which is responsible to allocating
auxiolary data structures on an RR depending on the type.

ndb/dns gained some support for some new types, but snoopy's
copy of rralloc() was not updated, resulting the auxiolary
structures to be nil, and the shared parsing routines crashes
when trying to dereference them.

this just syncs the copies, we might consider moving rralloc()
into its own file so it can be completely shared.
2021-08-18 17:59:50 +00:00
cinap_lenrek 913fdf2497 tinc: fix spelling and update manpage (thanks unobe)
Update tinc(8) man page to:
    1.  state the implementation aligns with 1.0.36 of tinc.org;
    2.  use same hostname as mentioned in usage line.
  Fix typos in tinc.c.
2021-08-15 09:54:09 +00:00
foura e72da62915 ip/ftpd: Add explict and implicit FTPS support.
Removed:
- Challenge reponse auth.
- Noworld login.
- Anonymous users writing files to /incoming.
2021-05-02 15:29:43 +01:00
cinap_lenrek 5fb37e15b6 ip/tftpd: add a syslog message about what error we return to the client on a NAK 2021-04-11 23:58:30 +02:00
cinap_lenrek a89bee7373 ip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66
The raspberry pi 4 PXE firmware insists on finding the tftp
server address by parsing dhcp option 66 as an ip address
string.
2021-04-11 20:20:41 +02:00
cinap_lenrek d9bf5d074d ip/ipconfig: ODtftpserver (dhcp option 66) is of type string 2021-04-11 20:18:03 +02:00
cinap_lenrek 27ad886c95 ip/tftpd: add -n namespace-file flag (thanks sam-d)
tftpd currently unconditionally sets its namespace via /lib/namespace
(newns("none", nil)), which stymied my attempts to pxe boot the
openbsd installer without creating a real /etc dir on 9front, which
would've been gross.

I tried working around this with -h (and -r for good measure), but
again hit issues because the namespace is rebuilt from scratch -- any
binds of /386, /amd64, /cfg/pxe, etc. into the tftp-specific directory
disappeared from tftpd's namespace and rendered my *9front* boxes
unable to boot. I could maintain copies of the needed files in the
tftp-specific directory, but that'd be kind of a drag.

The following patch adds a -n flag to allow the specification of a
namespace file in place of /lib/namespace; similar to ip/ftpd.

I thought about setting up a /lib/namespace.tftp to act as a default
rather than continuing to use /lib/namespace by default (which
security-wise is about the same as allowing 9p mounts by user none,
which I also have disabled), but I had trouble coming up with a sane
default. Maybe someone more experienced would like to try that out.

- sam-d
2021-02-23 01:47:33 +01:00
cinap_lenrek a96cf495fa ip/tftpd: use procsetuser() instead of writing #c/user 2021-02-23 01:41:09 +01:00
cinap_lenrek eb1dfed9ab libauth: change programs to use the new procsetuser() function 2020-12-19 18:02:37 +01:00
cinap_lenrek 5f2cf12f38 ip/cifsd: fix missing int return type for vpack() (thanks pr) 2020-10-29 18:26:35 +01:00
cinap_lenrek 950d970671 ip/tinc: fix reportedge()
supplying a non-ip address in ADD_EDGE crashes the unix tincd.

the reason was that we where misreporting ADD_EDGE messages;
ignoring the information from our peers; and always supplying
the Address string from our configuration instead of the
connections ip address.

now we just report the edge information as is.
2020-10-25 22:27:30 +01:00
cinap_lenrek d310da13ba ip/torrent: try harder allocating ports
we used to only allocate ports from 6881 to 6890,
which limits the maximum of parallel torrents to 9.

this change make it go up to 9000, which gives us
at best 2120 ports, which is overkill but ports might
be randomly occupied by other connections.
2020-10-12 02:03:52 +02:00
Alex Musolino 23de6808f7 ftpd: handle "allo" command by treating it as a no-op
RFC959 says:

	"The ALLO command should be treated as a NOOP (no
	operation) by those servers which do not require
	that the maximum size of the file be declared
	beforehand..."
2020-09-23 12:44:05 +09:30
Ori Bernstein 9d446410c5 ip/httpd: fix 'mk nuke' 2020-08-09 19:00:06 -07:00
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
cinap_lenrek b33773def8 ip/tinc: run script sub-shell in its own environment 2020-06-24 18:45:58 +02:00
cinap_lenrek 7c3477cb61 ip/torrent: fix size check in 64-bit "v" unpack (thanks pr) 2020-06-19 20:19:57 +02:00
cinap_lenrek 29fee6a8ed ip/6in4: request ipv4 packets only in ipmux filter 2020-06-07 16:56:54 +02:00
cinap_lenrek 8f087e019f snoopy: add ipmux pseudo protocol
the ipmux pseudo protocol handles the extra ipv6 interface address
prefixed to the ip header as used by /net/ipmux packet filter.
2020-06-07 16:48:04 +02:00
cinap_lenrek 0e97c8d1d7 ip/cifsd: add FIND_FIRST2 SMB_FIND_FILE_FULL_DIRECTORY_INFO info level 2020-05-27 00:09:46 +02:00
cinap_lenrek a54804ed24 ip/tinc: accept udp connection from any udp source port
the remote host might be behind a NAT which translates the
source port, so if no host could be found, lookup the ip
address only.
2020-05-23 23:31:11 +02:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek d0c87bada6 ip/cifsd: implement primitive per-share unix id mapping for wstat() 2020-05-02 16:53:52 +02:00
cinap_lenrek 0c7da78f45 ip/ipconfig: ignore default routes targeting ourselfs
when running ndb configuration, we might inherit the ipgw=
attribute from the ipnet pointing to our own ip address
(we are the default gateway). ignore such entries.

do not add default routes with gateway equal to our own
local (ip4) or link-local ip address (ipv6).
2020-04-11 22:36:19 +02:00
cinap_lenrek a7dab2728b ip/ipconfig: resolve ipgw to an ip address as neccesary (thanks k0ga)
ndb(6) states that ipgw needs to be an ip address,
however, attempting to resolve ipgw is not difficult
and already done by ip/dhcpd.
2020-04-11 18:09:48 +02:00
cinap_lenrek d3512f60df ip/dhcp6d: work arround non-ethernet based client duid
in ndb, we use the ethernet mac to identify the client.
in dhcpv6, there is just a uniqueue device id that
might even be generated randomly. to find the ethernet
address of a client, check the duid type and only use
it when the dudid is of type 1 (link layer) or 3 (link
layer address + time) and the link layer address type
is 1 (ethernet). otherwise, assume the source ip is
a link local address and extract it from that.

this hack works for thinkpad t495, which uses random
uuid based client duid.
2020-03-31 21:57:53 +02:00
cinap_lenrek 0b12020f10 ip/cifsd: implement SMB_SET_FILE_UNIX_BASIC for wstat 2020-01-11 14:50:52 +01:00
cinap_lenrek c739f57ac2 ip/ipconfig: keep on sending router solicitation after initial RA
avm fritzbox uses very long RA period so it effectively only
responds after a router solicitation. when there are multiple
fritzbox routers on the lan, then while configuring one prefix
of the first RA, the ip stack can drop the second router
advertisement and we would never get the second route.

packets can always get lost. so we just keep on sending router
solicitations (up to 3 times) to make sure we got all the RA's.
2020-01-04 11:49:50 +01:00