[00:31] * runelind_q upgrades LDS [00:32] let's see if it blows up. === minipini is now known as Guest67672 [05:22] good morning [05:56] Good morning [07:25] * Eichu0Ku_ [09:18] Hey all [09:19] How to chroot a user correctly, so it won't move upper path ? [09:19] Can't login after adding ChrootDirectory to sshd_config for a user [09:19] Now it looks like: https://hastebin.com/xutizafebu.nginx [09:19] Ubuntu 18.04 [09:27] V7: can you login with sftp? [09:28] V7: also, there are certain rules about chrooted directories. check the ssh logs. Namely, the chroot directory must be owned by root. So it can be something like root:user ownership, and 750 mode, ie. not accessible by others. [09:29] V7: please don't crosspost, it's pretty rude and wastes other people's time [09:30] ducasse: No answer there in about 15 mins so [09:31] Thank you blackflow. sftp gives: Couldn't read packet: Connection reset by peer [09:31] V7: you posted in #linux 3-4 minutes before here [09:31] V7: and what do the server logs say? [09:32] ducasse: Please, sorry. [09:33] blackflow: YOu're right. Says bad onwership or modes for chroot [09:33] mmmh-hm. [09:33] V7: and btw, that will only allow SFTP access. You can't ssh into that account regularly. [09:34] You mean, force-command ? [09:34] if you want to ssh regularly, you'll have to populate the chroot dir with some nodes required for interactive session. see the sshd_config manage on ChrootDirectory directive. [09:34] V7: yes, force-command. [09:34] This is an achievement :) [09:34] but not just it. like I just said, if you want regular ssh access too, you need some nodes in the chroot dir. [09:35] This user mustn't use ssh [09:35] shell * [09:35] V7: it's all explained nicely under the ChrootDirectory option in the sshd_config(5) manpage. [09:35] V7: in that case, this config should suffice, assuming you have proper ownership like explained earlier. [09:35] I'm actually, already reading [09:36] Thank you very much blackflow [09:36] you're welcome. === mike-zal is now known as mike-zal-work [09:52] coreycb: I'm thinking we should move to -> python{3}- -> -common as a general pattern [09:52] so all the agent binpkgs do is provide the systemd units [09:52] osa will like that as well [11:02] blackflow: Oh dear. [11:07] Now an ownership is okay, isn't it ? https://hastebin.com/ukutogevet.coffeescript [11:07] Although, it shows an error while trying to authorize with user [11:11] V7: it's not. mustn't be writable by anyone other than root [11:11] blackflow: somedir or internals ? [11:11] somedir [11:12] So, it's not, isn't it ? 755 [11:12] try 750 [11:13] "ChrootDirectory /somedir" for a directory located at /home/user/somedir seems incorrect to me. [11:13] tomreyn: Why home/somedir ? [11:14] Oh, I see, because output, I've sent to you [11:14] "ChrootDirectory %h/somedir" would probably work [11:14] wait, is that /somedir or /.../somedir? [11:14] tomreyn: A directory is located in root [11:14] the ChrootDirectory is path outside of the directory of course [11:14] blackflow: It's in root [11:15] tomreyn: why? just chroot to user's homedir directly. [11:15] tomreyn: And output which you've seen there is little modified, so there's actually: [11:15] user@ubuntu:/$ [11:16] blackflow: that probbaly works, too. [11:16] V7: make /somedir owned by root:user and of mode 750 [11:17] blackflow: The same [11:17] V7: yeah that error is worded as if you can't have a chroot dir straight under root. Why not just make it /home/user ? [11:17] /home/user doesn't exist [11:17] why not [11:17] Also, this /somedir is for mounted device [11:18] This /somedir musn't be changed [11:18] well I don't know about chrooting to dirs straight under root, but that error message seems to imply you can't [11:18] mount it under /mnt/somedir [11:18] Okay, I've changed it to /mnt/somedir [11:21] Copied stuff and now it's: https://hastebin.com/goriqazime.coffeescript [11:21] The same [11:22] V7: please pastebin the output of ls -la /mnt/somedir . I especially want to see . and .. [11:23] and ChrootDirectory is /mnt/somedir now? (i dont think it follows symlinks if you have any) [11:24] blackflow: https://hastebin.com/ifaqotosib.rb [11:25] great, and the ChrootDirectory is /mnt/somedir/ as tomreyn asked? And you restarted sshd of course? [11:26] tomreyn: Yes, sshd_config: https://hastebin.com/wiyoguweso.nginx [11:26] V7: ugh, why password auth..... just say no! :) [11:26] blackflow: For testing [11:27] Yes, sshd was resarted [11:27] V7: so, you restarted sshd (ssh.service) just to make sure, and it still throws the same mode/ownership error? can you pastebin the error? it lists the path element it dislikes [11:27] ls -la would not output this with trailing slashes, so you must have run something else there: https://hastebin.com/ifaqotosib.rb [11:27] It says: sshd[1387]: fatal: bad ownership or modes for chroot directory component "/" [11:28] tomreyn: Yes, dir1 and dir2 has data [11:28] uh, can you pastebin the output of stat / ? [11:29] blackflow: https://hastebin.com/higetamagi.http [11:29] how did that happen :) [11:30] your root is owned by "user" [11:30] oh dear [11:30] coreycb: working ceilometer py3 (needed it for networking-odl) [11:30] root is owned. [11:30] well according to that pastebin, your root (/) is owned by "user" [11:30] tht ain't gonna work. [11:30] of course [11:30] I'll reset it now [11:31] how did that happen.... what's the ownership on other dirs under / ? [11:31] like /bin, /usr, /etc, /root/, .... ? [11:31] Already reset all stuff [11:31] Give it some time to reboot [11:32] didn't have to reboot tho' [11:32] blackflow: This will reset all changes [11:33] how? btrfs/zfs snapshot? [11:35] Just a little tar archive of root [11:40] just a little tar archive....... [11:40] Interesting [11:40] I've rebooted and the same. /'s owned by user. [11:41] This might be because of /etc/fstab [11:41] I'll check this now [11:47] blackflow: So, all directoried before chrooted one should be not writeable for a user which should be chrooted ? [11:47] s/sdirectoried/directories [11:48] So, /dir1/dir2/dir3/dir4 all should be 755 ? [11:48] it really is all neatly explained in the frist few sentences of the ChrootDirectory option in the manpage :) [11:48] If chrooting to dir4 [11:48] Yes, I've seen [11:48] aufs / aufs defaults 0 0 [11:49] "all components of the pathname are root-owned directories which are not writeable by any other user or group". That's the second sentence of the paragraph. [11:49] All components of the pathname must be root-owned directories that are not writable by any other user or group. [11:49] All components of pathname [11:49] so.... ALL compnents of the path..... ROOT owned...... not writeable by any other user or group. [11:49] This is what it mean, all units of pathname [11:49] means * [11:49] so that answers your question. :) [11:50] so, of the chroot dir. NOT the dirs UNDER the chroot. [11:50] Yup, thank you very much blackflow [11:50] oh [11:50] You mean, dir1 can be 777, but dir1/chroot should be 755 ? [11:50] yes, you can have whatever under it, but naturally, accessible/writable-where-needed to the "user" that's logging into that chroot. [11:51] V7: it can be anything, under the chroot. [11:51] Understood [11:51] Hope you'll be okay there blackflow [11:51] but chroot iself, the directory turned into "/" for that login session (aka the chroot), must be root owned, not writable by anyone else. [11:51] why wouldn't I :) [12:14] Hello I'm searching for Ubuntu server a good tool which is auto remounting samba shares. I have the problem that our Windows File Server sometimes reboots and then my mounted shares are not mounted anymore. Last time I had the problem that the Ubuntu server booted and the Windows File Server was not running. In this case it would be cool if the server is retrying to mount the share consistently [12:20] morning [12:21] Interesting [12:21] lel [12:21] Now all works. SSHD is diabled. SFTP works well, but when I'm trying to authorize via SSH it says: "Could not chdir to home directory /mnt/somedir/: No such file or directory" [12:22] ssh is diabled * [12:22] disabled ** [12:24] ... but a directory exists: https://hastebin.com/opowupehiy.scala [12:31] rbasak: hey, question about git ubuntu merge workflow [12:31] cpaelzer: you too are welcomed to chime in :) [12:31] o/ [12:33] So ChrootDirectory tries to chroot into $h/chroot rather then /chroot firstly ? [12:33] Even if ChrootDirectory /chroot is set [12:35] oh, sorry, left you hanging [12:35] ok [12:35] rbasak: what if our delta includes an upstream version bump? [12:36] rbasak: when I'm in the phase where I git reset HEAD^ and deconstruct the update into individual commits, [12:36] rbasak: I will have a lot of non-debian/ files and directories in there, reflecting the version bump [12:36] should I put all of those under "New upstream version: x.y.z"? [12:36] or just leave that particular commit as is, without deconstructing it? [12:37] Let me check the definitions to give you an answer that's consistent with documentation [12:39] I might have used "deconstruct" incorrectly, maybe it's "reconstruct". I'm never sure [12:39] it's the first old/debian rebase you do after merge start [12:42] ahasenack: which numbered step is that at https://wiki.ubuntu.com/UbuntuDevelopment/Merging/GitWorkflow please? [12:43] ahasenack: reading backlog ... [12:43] rbasak: 3.1.3-5 [12:44] Got it, thanks. [12:45] Your suggestion is right [12:45] "should I put all of those under "New upstream version: x.y.z"?" [12:45] V7: "no such file or directory" probably refers to the shell binary which doesn't exist in the chroot [12:45] Yes - stuff all changes not in debian/ into one commit (assuming 3.0 (quilt)) [12:45] rbasak: the new upstream version fixed two bugs [12:45] or is it really a version bump and not a quilt patch? [12:46] rbasak: group that all together [12:46] cpaelzer: rbasak it's a real version bump, we went ahead of debian [12:46] Yes [12:46] * New upstream version: [12:46] - Fix database corruption bug when upgrading from samba 4.6 or lower [12:46] AD controllers (LP: #1755057) [12:46] - Fix security issues: CVE-2018-1050 and CVE-2018-1057 (LP: #1755059) [12:46] Per upload, that is [12:46] Launchpad bug 1755057 in samba (Ubuntu) "Samba 4.7.4 should not be shipped as an AD DC" [High,Fix released] https://launchpad.net/bugs/1755057 [12:46] Launchpad bug 1755059 in samba (Ubuntu Bionic) "Samba [Bug 13272] [SECURITY] CVE-2018-1057" [High,Fix released] https://launchpad.net/bugs/1755059 [12:46] so stash non-debian diff under that commit? [12:46] so it is not keeping debians tarball and adding a qduilt patch and instead really bumped the versions [12:46] So for each upload, you may have up to one commit containing all non-debian/ changes [12:46] Plus the other usual ones [12:46] yes, it's a new orig tarball [12:46] yep I'd still group into one [12:47] which shoud match the diff of the two orig tarballs [12:47] y [12:47] You could split it further in theory. It wouldn't cause a problem for the workflow, but it'd be additional work to do and you don't need to go to that depth. [12:48] in case you have it split already ... [12:48] You'll be throwing away this one commit in the next step anyway [12:48] jamespage: seems to make sense. is there a package done i can look at? [12:48] like when the bump was made not from tarball but from git [12:48] then you could keep it if you want [12:48] The only purpose in keeping it now is that it means that the result of the deconstruct step can easily be checked. [12:48] but I also see coming that you'll drop it anyway ont he merge [12:49] ok, thanks guys [12:49] the only pain would be if this was bumped via git-commits and Debian moved with the upstream tarball - sometimes git!=tarball [12:49] so ensure the orig tarball matches [12:49] this is one of those fun tarballs, with an empty directory [12:49] yay [12:49] why make it easy, heh [12:50] ahasenack: are you moving even further by the merge [12:50] so if Debian was 1, we moved to 2 and he merge is now 3 ? [12:50] jamespage: i'm thinking about not merging congress. congress bundles antlr3 which is not ideal, and there's a bug open upstream. zigo modifies the orig tarball to drop all of the antlr3 code, but i'd prefer to just use the published orig tarball. [12:50] then the concerns on matching tarballs don't matter [12:50] cpaelzer: no, this one has a debian tarball [12:50] going from 4.7.x to 4.8.x [12:50] debian never released a 4.7.6, and told me they never would [12:51] they went from 4.7.4 to 4.8.x [12:51] ahasenack: but that is fine, you will now move to 4.8.x and use theirs [12:51] right [12:51] good [12:51] so the actual merge is normal [12:51] it's the deconstruct phase that had this oddball [12:51] honestly, it doesn't matter too much [12:52] as rbasak said, it is mostly to check if old/new match what they should [12:52] and later in logical to compare if all commits are retained [12:52] and exercise some muscles [12:52] but since this one will be dropped it doesn't matter if it is one or 2k [12:52] it will be a huge commit indeed [12:52] ahasenack: when I'm done with my current merge you can exercise some review msucles :-P [12:53] You can add everything and then reset out just the debian/ directory [12:53] Saves typing [12:54] rbasak: I added plenty of updates to your merge list [12:54] all that I thought worth discussing is added as comment's so it can be discussed as needed [12:54] Thanks :) [13:40] beep boop [13:41] How do you guys go about hardening new server installs? [13:41] and managing logs [13:41] Other than the usual use keys not passwords, change the ssh port to nonstandard to keep from logs getting flooded with crap [13:42] ahasenack, cpaelzer: what does Monday triage mean? Sat-Sun inclusive? [13:42] Or Mon also? [13:43] Fr/Sat/Sun [13:43] OK thanks [13:43] Definition; up to including the last workday [13:43] that works for any day [13:46] rbasak: also see check_dates in /snap/ustriage/current/lib/python3.5/site-packages/ustriage/ustriage.py [13:53] hehsec: apparmor all the things, modify services to run unprivileged wherever possible, take advantage of systemd's security features for services [13:54] Systemd comes with security features for services? [13:54] O.o? [13:56] hehsec: https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04 and then some [13:59] blackflow: damn [14:05] blackflow: I never knew I could use systemd to manage appamarmour and selinux profiles on services [14:05] Why do people hate systemd again? [14:08] Probably mostly because systemd-networkd [14:08] genii: blackflow Any suggestions for learning to automate configuration of linux machines? [14:09] I'm learning to work with tools like osquery [14:11] hehsec: ansible! [14:13] mssh sometimes is useful [14:15] blackflow: gah [14:15] genii: neat [14:43] * leosilva lunch [14:49] On an ubuntu server with no MTA currently installed, I'd like to arrange it so that regular users cannot send or receive mail, but UIDs < 1000 can send email to root (and only to root) which will be forwarded to an external address via a specified SMTP relay. What MTA would make this easiest to achieve? [14:59] lahlfors: I prefer exim for that kind of level of customisation. I'm not sure about restricting sendmail by uid though. I'd check if that is possible first. [15:00] lahlfors: I have a standard exim configuration I use for stub servers for which I only want root email sent to me and nothing else. [15:01] lahlfors: https://paste.ubuntu.com/p/TBNgvPnnfP/ is what I use [15:02] lahlfors: that should be trivial to adjust to use an SMTP relay. Not sure about the uid restriction. [15:02] That doesn't stop users from sending out via SMTP directly. [15:02] rbasak, thanks, this looks very helpful! [15:03] I think it might send _everything_ to me regardless of target address [15:03] I don't want to attempt to stop users from making outgoing SMTP connections. But I would like it to be difficult for users to arrange for any daemon on this machine to make an outgoing SMTP connection on their behalf [15:03] lahlfors: to prevent users from sending to SMTP directly: iptables -A OUTPUT -m owner --uid-owner 1000-65535 -p tcp --dport 25 -j REJECT [15:05] sdeziel, thanks, but that's not exactly what I want. I want to prevent local users from sending or receiving mail using the local MTA. Receiving should be easy (some config option). But sending? [15:06] lahlfors: that was only to prevent bypassing the MTA [15:06] lahlfors: for the MTA part, with postfix you'd use http://www.postfix.org/postconf.5.html#authorized_submit_users [15:07] sdeziel, now we're talking! That config option should do what I need if I use postfix. Thanks. [15:08] lahlfors: for other MTA, a hack would be to use to use file ACLs to prevent executing the sendmail binary itself [15:08] Is postfix a good "lightweight" option in general? I have configured lots of servers but stopped installing MTAs long ago and only ever used sendmail and qmail [15:08] lahlfors: beware that most MTA will let someone directly talk to 127.0.0.1:25 and let you relay with it [15:09] sdeziel, I'll handle that with iptables restrictions on the loopback interface. Not sure if I need to worry about a unix socket file somewhere, too [15:09] lahlfors: postfix is pretty light IMHO. You can tune it even more if you disable inet services [15:11] oh hey Landscape upgraded cleanly from 17.03 to 18.04 [15:15] lahlfors: looks like exim has $originator_uid and you can set up an ACL on that [15:16] sdeziel: I would just grab a copy of the sendmail binary from somewhere else and run that :) [15:17] rbasak, great, you beat me to it. (Was looking for exim analogue of authorized_submit_users) [15:17] rbasak: ouch :) [15:20] geeze exim ACLs are complicated. I guess mail is just fundamentally complicated. ugh [15:21] yes mail is complicated [15:21] it has its own set of chaos tied to it, especially from a security perspective. [15:22] Basically, I don't want get in the mail business anyway. But it would be nice to aggregate cron emails and other problem reports at an external address [15:23] Right now problems detected in cron jobs are just ignored because no MTA is installed. A few manually send their output via amazon SES, but I don't want to be forced to configure that on each job, so I am looking into a very restrictive MTA config [15:28] The main security issues with mail are spam and open relays [15:29] My exim config attempts to avoid that by overriding everything to me, so it shouldn't be possible for someone to route anything anywhere else. exim's router mechanism is quite clear about the outcome there so hopefully no confusion. And I turn off listening on public interfaces, so I don't have to worry about SMTP ACLs. [15:29] (even if someone did manage to get to my exim's SMTP all they'd be able to do is send emails to me since everything redirects to me) [15:30] IMHO this is the most minimal and perfectly acceptable config for servers that aren't supposed to have users logged in. [16:49] rbasak: +1. But getting everything to behave can still be tricky, when it comes to interaction with other mail servers and such [16:49] whether the config is 'perfect' or not. [17:30] teward: the point of my arrangement is that it doesn't really talk to other mail servers. Only my one :) [17:30] Well, not even "really". It just doesn't! [17:31] indeed. [19:08] so when i did a fresh install of server 18.04 and did a second reboot(had to reboot again after i left the installer usb attached. shouldnt this be aware and pass over it?) it booted up and didnt show 'server login:' it was just a blinking line. i ran 'sudo reboot now' and it then asked me to login. what im getting at is it wasnt very clear where it was at after the boot up. [19:08] https://usercontent.irccloud-cdn.com/file/VOeccHM5/image.png [19:09] not sure if that is a bug or feature request? [19:13] probably not much to be done about it [19:14] pretty sure it used to just land you at a login prompt. not just empty blinking cursor. [19:14] it did [19:14] look up at the tty1 line .. [19:14] there's your login: prompt [19:15] async tasks run during boot may emit content nearly forever.. [19:15] hmm [19:40] how do I link debian merge bugs with the report in http://reqorts.qa.ubuntu.com/reports/ubuntu-server/merges.html ? [19:40] an example is dovecot's entry there, it's pointing at https://bugs.launchpad.net/ubuntu/+source/dovecot/+bug/1771524 [19:41] Launchpad bug 1771524 in dovecot (Ubuntu) "Merge dovecot 2.3.x for Cosmic" [Undecided,Incomplete] [19:41] but that bug has no special tag about it [21:48] Right, let's see how big this Ubuntu Server thing is. [21:59] 1,162 MB (i386, 16.04.4). That's great. [21:59] I'll try 18.04 next. [22:01] ? [22:07] he's downloading over carrier pigeon [22:11] :) [22:11] RFC 1149 [22:37] carrier pigeons can transport quite a lot more than that at impressive speeds :) [22:39] e.g. if you let them carry some 256GB (and bigger capacity?) micro-SD cards [22:39] * sarnold wonders what the airspeed velocity of RAICP carrying a RAID array is..