/srv/irclogs.ubuntu.com/2018/07/22/#ubuntu-server.txt

MrCorvidHello! So, I want to make a script that, when called runs the "screen" command, which then upon creation runs the "optirun" command (from bumblebee, for controlling nvidia GPUs) which then runs the java command to run a program under optirun within the screen.01:48
MrCorvidThe issue I am having now is that when this happens, the java program crashes because it attempts to modify files that it cannot because it needs root permissions. So, I need to A) find a way to have the script give ONLY  either that optirun command OR that java command sudo privaleges (that initial script is being run with root privileges due to it being owned by the root folder, and also being accessed by systemd)01:50
MrCorvidor B) make it so that jar can access all the files it needs without root without enabling ANYONE to modify or run those files other than root and this jar01:51
DWSRHey all, just curious how to do a completely unattended install of Ubuntu 18.04 Server. It looks like the installer has changed away from d-i.01:59
sacardehi09:36
sacardeis true that: networkd contains its own in-built DHCP client implementation ?09:37
sacardecan I disable? or set static IP ?09:38
blackflowsacarde: yes, and of course.09:39
blackflowit only means you don't need dhclient or similar, if you want dhcp.09:39
sacardeI have a proble, I set in "interfaces" only a static ip09:39
sacardebut when system start it get a dhcp ip too09:40
blackflowwhich Ubuntu?09:40
sacardeubuntuserver180409:40
sacardeI remove dhcpcd dhclient pkgs09:41
blackflow18.04 no longer uses /etc/network/interfaces,  which is part of "ifupdown" package. It uses netplan, which is configuration abstraction tool that works with backend: networkd on servers, and NetworkManager on desktops.09:41
blackflowBut you don't have to use neplan either, you can configure a .network unit directly, for networkd.09:41
blackflow!netplan09:41
ubottuNetplan is a network configuration abstraction renderer which uses YAML descriptions of a network to work with either a NetworkManager or Systemd-networkd "renderer". More information at https://netplan.io/09:41
sacardecan you show me an example? static ip without dhcp09:42
blackflowsacarde: click that link09:42
sacardeah ok09:42
SlowJimmyis nfs the only way to mount a drivepartition from the server  on my client machine? or can this be done in ext4?09:47
blackflowSlowJimmy: ext4 is on-disk filesystem, nfs is network "filesystem" that works with any underlying on-disk one. One alternative to nfs is samba.09:49
SlowJimmyblackflow can i convert ext4 to nfs without harming the preexisting data?09:51
blackflowSlowJimmy: no, nfs does not exist as an on-disk format. there's no mkfs.nfs. nfs is a system that allows you to export one directory, over the network, mountable as if it was local, onto another machine09:52
blackflowit's actually more than one directory, so called "exports", but the gist is it works like that.09:53
SlowJimmyso it is similar to samba but just for real computers not just windows?09:54
SlowJimmyi see, i dont have a man page but i will just read up on nfs somewhere they are bound to talk about how i can share the ext4 partition09:55
blackflowsmb/cifs and nfs are protocols similar in functionality, yes.09:55
SlowJimmyi mean if i understand right, then i can just follow some procedure or list of steps and use nfs to make the partition available09:55
blackflowpretty much, yes.09:55
SlowJimmyman you cant imagine how invaluable your help has been09:55
blackflowyou don't have to convert anything, you just export some directories, over the network, to anotehr machine.09:56
SlowJimmythat will do wonders for my backups09:56
ducasse!nfs | SlowJimmy see this09:56
ubottuSlowJimmy see this: nfs is the network file system. See https://help.ubuntu.com/community/SettingUpNFSHowTo for information on installing and configuring NFS.09:56
blackflowSlowJimmy: note, however, there's no TLS or encryption involved, so if you're doing it over the public network, you'll need to take additional steps.09:56
SlowJimmydidnt have a man page for nfs on sys09:56
blackflow(nfsv4 can do some encryption with kerberos, but what I mean is, it's not there by default)09:57
SlowJimmyhow do i protect against somebody somehow sitting on my internal network?09:57
SlowJimmyor what if one of the clients is infected?09:58
SlowJimmythen all my data is fair game?09:58
SlowJimmycan you tell with the network conenctions and so forth if somebody is accessing your network who shouldnt be?09:58
blackflowif you don't trust your network then treat it like public internet09:59
blackflowSlowJimmy: that's why you set up authentication and encrypt connections. NFSv4 is capable of that.10:00
blackflowor use something like VPN tunneling10:00
SlowJimmyi have a question regarding authentication, if you use keypair authentication for ssh and a password is the password still cleartext?10:00
SlowJimmyoh ok i will try to set everything up that way10:00
SlowJimmybetter safe than sorry10:01
SlowJimmyalso if you got a keypair set up... how do you prevent your privatekey falling into the wrong hands?10:01
SlowJimmyi mean if it just sits on a client wont it be a risk because once that client is compromised then basically the server and withit the whole network?10:02
blackflowyou're asking overly broad questions. with ssh keys you have private and public keys. you can share the public one freely, and you protect the private one with a passphrase.10:02
blackflowyou keep that private as protected as possible, and teh passphrase is there in case of it being stolen or compromised, teh attacker would still need to know the passphrase to use that key.10:03
SlowJimmyblackflow but wont that be useless if the computer you use to conect with to the server has been compromised? i mean wouldnt they be able to just copy the private key and key log the pasphrase?10:03
blackflowso public keys are form of 2FA in itself. something you know (the passphrase to even use the key) and something you have (the key itself).10:03
blackflow"log the passphrase"? only if they somehow see you type it in.10:04
SlowJimmyso if they got my system compromised with a trojan wotn they be able to use keylogging functions of that malware to basically record the keystrokes?10:05
blackflowin theory, yes.10:05
SlowJimmyi mean if one of the clients i use to ssh in is compromised isnt then the whole system gone?10:05
SlowJimmyi mean server and all other clients?10:05
blackflowbut they'll also need to get that key in order to use it.10:05
SlowJimmybut wouldnt that be easily done with a keylogger?10:05
blackflowno. like I said, you give public keys to the machines you log into. public keys work only in conjunction with your private key, so if the public key is stolen, nothing bad happens.10:06
blackflowpubkey auth is a form of asymmetric encryption. it takes one key to encrypt and another key to decypt. one key cannot be used for both. in this particular case, the private key you keep to yourself,  protected, and the public key is given out to machines you ssh into.10:07
SlowJimmyno i know, i just am not clear how the private keys sittig on the clients isnt a huge security risk?10:07
blackflowthe private keys shouldn't be "sitting on the clients", if "clients" are machines you SSH into.10:08
SlowJimmyno i mean the clients is what i use to ssha into the server10:09
SlowJimmythe server has the public key10:09
SlowJimmyand the client has the private key10:09
blackflowyou can even do this. put your private key on usb. with ssh-agent running on your local machine, you instert the usb stick once, unlock the key (ssh agent remembers it), and you can remove the USB. that machine can now use the ssh-agent to access remote machines with that private-public key pair.10:09
SlowJimmybasically my lapto ruig ubuntu has a pricvage key and my server has the public key but if somebody takes over my desktop with the private key isnt then the whole system lost?10:10
blackflowbut yes, if tha "client" is compromised, if the ssh private key is stolen, if the passphrase for the private key is easy to guess or tortured out of you,    ur dun goof'd.10:10
SlowJimmywait but if the desktop is just in any way compromised then the private key is bound to be just simply copied by the attacker and they can easily isntall a keylogger to capture my passphrase, no?10:11
blackflowin fact, a few years ago there was an attack on servers noted on webhostingtalk forums, servers with tight security and pubkey auth were being compromised. the conclusion was (and I don't know if it was every 100% confirmed)  that there was a trojan that stole those private keys, the admins were windows users, and itw as in conjunction with how they used putty.10:12
SlowJimmyso in this keypair authentication it all hinges on the assumption that your desktop runing ubuntu is not compromised or has a trojan or whaterver they use10:12
blackflowSlowJimmy: yes, but..... balance of probabilities.10:12
blackflowin fact, this is ONE reason why I run custom AppArmor profiles that forbid any app with network access, from touching ~/.ssh/10:13
SlowJimmyand the usb thing does not help since once compromised they do not need to have access to the usb costatly only once woudl be enough...10:13
SlowJimmyand they would not have to be connected to do that either10:13
SlowJimmyblackflow› that is excellent10:14
blackflowand that is why security is hard.10:14
SlowJimmyyou prevent any connectable services from acces to the privatekey10:14
SlowJimmywhat though if one app that has no internet touches your private key and then hands it to the other buddy app that has internet10:14
blackflowthen I'm compromised.10:15
SlowJimmyso does your apparmor increase security then?10:15
SlowJimmyi mean it seams like there is a way around it10:15
blackflowit does. any intrusion vector shut down, even if not 100%, is increased security. security is not black and white, never 100%. it's a process.10:15
blackflowgiven enough time and money, there's always a "way around", even the best security in the world.    https://xkcd.com/538/10:16
SlowJimmycant one reduce any ssh activity to a life cd?10:16
blackflow"life cd"?10:17
SlowJimmylike make a custom live cd of ubuntu make sure it is md5 checksumed and all, and then put the private key on that, bur it to disk and then onyl physical access will grant them access to the private key10:17
SlowJimmywho ever them is...10:17
SlowJimmyliek you only ssh into the server with this live cd and have noother copies of the private key than on the livecd itself10:18
blackflowthat's one way to make it more secure, yes10:18
SlowJimmydoes this aproach have security holes too?10:18
blackflowbut then... openssh itself could be found (and has been in the past) vulnerable.10:18
SlowJimmyi see that if your original copy has been tempered with yes...10:18
SlowJimmybut you can md5 checksum to make sure10:18
SlowJimmysomewhat...10:18
SlowJimmyoh10:19
blackflowso your remote machine is compromised, an openssh vuln exist, you connect to that machine, poof your keys are stolen. (hypothetically, if such vuln existed)10:19
SlowJimmyi mean you cant run a server off of a livecd10:19
SlowJimmyor can you?10:19
blackflowso the bottom line is, you cover as many vectors as you can, but it's never 100%. there will alwys be something, somewhere, lurking, that can potentially compromise you.   a visit from the attacker with a $5 wrench, included.10:20
blackflowyou can run read-only stateless servers yes.10:20
SlowJimmywait why the live cd in the first place? cant you basically write a script that md5 checksum the system and asks you to sign off on any changes and maybe show those changes to you, sort of liek a firewall for making changes to the system10:20
blackflowwhich may or may not be feasible depending on what they do10:20
andolNot to mention, that there are all kinds of precautions you could take, but wouldn't neccesdarily be practical, since they would make your server less useful.10:20
SlowJimmyand if there is an unallowed change it reverts the system back with rsync10:21
blackflowandol: indeed.10:21
blackflowSlowJimmy: sure, check out AIDE10:21
blackflow!info aid10:21
blackflow!info aide10:21
ubottuPackage aid does not exist in bionic10:21
ubottuaide (source: aide): Advanced Intrusion Detection Environment - static binary. In component main, is optional. Version 0.16-3 (bionic), package size 706 kB, installed size 1986 kB10:21
SlowJimmyblackflow well i just want to be reasonably secure the guy who made the effort to physically visit me at that point i am beate10:21
SlowJimmybeate10:21
SlowJimmybeaten10:22
SlowJimmyliterally10:22
SlowJimmythis AIDE does add all kinds of paranoid security measures?10:22
SlowJimmynice!10:22
SlowJimmyblackflow what book can i read to get on top of this?10:23
blackflowno, it's essentially a database of checksums and various other file properties, and then you do frequent runs and it reports what changed about the files in the db.10:23
SlowJimmyliek to know where the weakess of my system are liek what you said earlier with the openssh vulnerabilites and such10:23
blackflowlike that md5 script you mentioned above, md5 being just one thing it does.10:23
SlowJimmyblack omg that is sweet!!!10:23
blackflowSlowJimmy: for THAT though, check out Snort.10:24
blackflow!info snort10:24
ubottusnort (source: snort): flexible Network Intrusion Detection System. In component universe, is optional. Version 2.9.7.0-5build1 (bionic), package size 678 kB, installed size 2148 kB10:24
SlowJimmycouldnt you combine this with your current ssh protection?10:24
blackflowsure10:24
SlowJimmycheck for any file changes evertime your ssh folder is accessed10:24
* andol thinks SlowJimmy would benefit more from general sysadmin understanding, and less from specific tools.10:24
blackflowSnort goes as far as monitoring traffic in real time and detecting patterns of known or potential malicious behavior10:25
* blackflow agrees with andol 10:25
SlowJimmyit is very soothing to lear about these tools though10:43
SlowJimmyto know there already is a way to deal with these issues10:44
SlowJimmyi am i the process of readig several gnu/linux server adming /network administration books10:44
tomreynfor any complex problem, there is always a more complex partial or full solution. ;)10:45
tomreynor rather multiple, so you can spend more time on finding out which one is the least bad one.10:45
SlowJimmylol10:46
SlowJimmykeeping you perpetually busy in the process10:46
tomreynunless you notice you are and break the loop. so how long have you spent on these thoughts today? ;)10:47
RoyKSlowJimmy: https://debian-handbook.info/ <-- good reading - you'll probably learn a lot - debian isn't ubuntu, but then, they're about the same (ubuntu is based on debian after all)10:59
andolYepp, great book!11:03
SlowJimmyRoyK yeah they all are so similar11:03
SlowJimmythansk man i really apreciate your help11:04
SlowJimmythanks blackflow thanks andol thanks tomreyn  thansk RoyK11:04
tomreyn:)11:05
MrCrowHey, I need some help - I want to run a script from systemd, which either operates with root privileges and has a password on it, or runs a single command with sudo16:17
MrCrowor remove the need to run that command with sudo16:17
Zahovayhello guys i need a little help. Just got a vps with 15.10. trying to install 16.04 through ssh but cant install update-manager-core21:34
Zahovayany suggestion on  it?21:34
Zahovaythe main problem during installing update-manager-core that it says "unmet dependecies: python3-update-manager21:35
Zahovayis not going to be installed"21:35
blackflow!eolupgrades | Zahovay21:35
ubottuZahovay: End-Of-Life is the time when security updates and support for an Ubuntu release stop, see https://wiki.ubuntu.com/Releases for more information. Looking to upgrade from an EOL release? See https://help.ubuntu.com/community/EOLUpgrades21:35
blackflowZahovay: so the hosting company has no modern ubuntu images?21:36
Zahovayhosting company is old as hell, its also awful but its the cheapest by far21:36
blackflowI'd still drop them if they don't support modern images. plenty of cheap but quality providers21:37
Zahovayanyway its already payed we didnt know its like that..21:38
Zahovaywhich server version u suggest?21:38
blackflowZahovay: 18.04, latest LTS21:39
Zahovaydoes it have any drawbacks?21:39
blackflowZahovay: well personally I don't like the netplan NIH but it's nothing you can't remove/ignore/not use21:41
blackflowor use it if you like it.21:41
Zahovayblackflow: and when i edit sources.list do I use old-releases with 18.04?21:42
Zahovayor archive?21:42
Zahovayoh that question is stupid im sorry21:43
blackflownot with 18.04, you use that in your existing 15.10 in order to be able to upgrade21:43
blackflowbut if I were you, and that hoster had a "rescue mode", even if debian, I'd use that and install with debootstrap. in fact that's how I alwys install remotely because of encryption.21:44
Zahovayit says kernel version not supported. (upgrading with update-manager-core) any ideas?21:52
blackflowwell, rescue mode, debootstrap21:52
blackflowZahovay: how much are you paying for that thing?21:52
Zahovayhalf a dollar / month21:53
blackflowwell, pay peanuts, get monkeys :) the "cheap but quality" providers really start at around few €/mo21:54
ZahovayI know and I told my manager that this was the worst possible choices of all21:54
blackflow"manager"? so this is for business purposes?21:54
Zahovayactually this is kind of a research labor of IOT and nobody has server side experience at all21:55
ZahovayI thought that I will try to setup the server by myself since I know c/cpp programming this setup could not take much work21:56
Zahovayshoud*21:57
blackflowprogrammers are usually the worst sysadmins :21:57
blackflowjokes aside, y'all should really consider hiring some help.21:58
Zahovaywell I want to learn this part of the life too. I want to become kind of a security expert of the IOT part of IT21:59
Zahovaylearning some server part should help me21:59
blackflowthat's perfectly fine. local VMs are best used for that.21:59
Zahovayagreed but the manager said that our work would be tracked through a website's database with visual diagrams etc.. so he choose this .. I accepted server side so i learn from it22:00
blackflowwelp, that's what grinds my gears. people wiht no experience running public servers that get compromised and turned into gbps UDP cannons for a botnet.22:01
Zahovayactually it is not going to be public server22:02
Zahovayi already restricted all ports and connections except my ssh which is not the default ssh22:02
Zahovayand database will be set to be used only from local access. (so the server program)22:02
blackflowand I hope you disabled password auth in sshd_config?22:02
Zahovayi mean publicly available but only auth users will use it22:02
blackflowwait, a db listening on public IP?22:03
Zahovaylet me have a smoke and will continue22:03
Zahovayim courius about these22:03
Zahovaycan i pm you?22:08
blackflowplease don't.22:09
Zahovayokey, so I would have a mysql database restricted to local access only with a pubic ip running a nodejs server serving connections22:10
Zahovayis this a bad idea?22:10
blackflownot per se22:11
Zahovayafter upgrading i've been dropped from sudoers file. Can I resolve it?22:17
blackflowif root has password, try     su -l      and use root's password22:19
RoyKusually root doesn't have a password on ubuntu, try "sudo -i"22:22
blackflowRoyK: "dropped from sudoers file"22:24
ZahovayWell the guy who pays the vps is not active, i could not solved this.. Thanks for you help guys22:28
RoyKblackflow: login on the console or use an usb thing22:29
blackflowZahovay: check if you have sudo priv anyway, maybe through %sudo group? or %wheel22:29
ZahovayI had sudo before upgrading. Now when I type "%sudo group" it says no such job22:30
Zahovayfor wheel it says the same22:30
blackflowZahovay: lol... %sudo   is notation for the "sudo" group in sudoers file22:30
blackflowit's not a command22:31
ZahovayI cannot "cat" the sudoers file22:31
Zahovaypermission denied22:31
blackflowright. but can you sudo anything?  sudo -i   for example?22:31
Zahovayit asks for my pw then it says im not in the sudoers file22:31
Zahovayand "its going to be reported"22:32
blackflowlol yeah, that's sudo the little snitch. you're lucky sudo on ubuntu is not compiled with insults.22:32
blackflowanyway, does that hosting company have a rescue env? if you can mount the disk in the rescue env, you can change the sudoers file or assign root pass22:32
RoyKZahovay: is this a vm somewhere out in the cloud?22:33
ZahovayWell probably has, i have to wait 'til the guy who paid and have the access to everything wakes up and give me some login infos for the vps company's site22:33
ZahovayCan I check somehow the usernames on this vm ?22:35
Zahovayi mean on the ubuntu22:35
RoyKZahovay: check /etc/passwd22:36
RoyKdon't pastebinit22:37
Zahovaycommand worked but didnt help22:37
RoyKZahovay: it's a text file, /etc/passwd - it lists the users on the system22:38
RoyKZahovay: I won't help you to hack a system, just saying how things work22:39
ZahovayActually this our own vps where I had root password on 15.10 and after upgrading to 16.04.5 (was 3 hours of work due to messed up sources.list) i lost my root priv22:40
Zahovaybut I understand your point and I do not ask you to help me in such a thing22:40
RoyKthen 'su -' should give you root acesss22:40
Zahovaywell it says auth failure22:41
Zahovaydunno why22:41
RoyKor you may have to ask the supplier of the VPS22:41
ZahovayI will have to.. tomorrow when the guy who paid woke up..22:41
Zahovaywait22:43
Zahovayim dumb22:43
Zahovayand it worked22:43
Zahovaythanks lol22:43
RoyKfine :)22:43
blackflowfor that money, I doubt the hoster would even laugh. :)22:43
Zahovayi had to wrote my username after the su22:43
Zahovayah thanks guys22:43
blackflowuh... that just started a new shell as ..... you.22:43
blackflow`whoami` will confirm22:44
RoyKor "who am i"22:44
RoyKlike looking into a mirror22:44
Zahovaylol so it did not work22:44
blackflownope. `su -l`  is to become root with root's pass.   `sudo -i` the same but with your, sudoers, pass.22:45
RoyKblackflow: or just "su -"22:45
blackflow(it essentially being the same as `sudo su -l`)22:45
blackflowRoyK: I like being explicit.22:46
blackflowbut, yes.22:46
Zahovaynot sure if I understand but "su username" then pw it runs fine without error but I do not get any root priv. (I've alsod done "su username" then pw then whoami22:48
RoyKZahovay: "su" means "switch user" - if you don't give it a username, it means root22:48
Zahovayoh lol22:49
RoyKhttps://xkcd.com/149/22:49
Zahovay:DDDDDDDDDDDDD22:50
=== havenstance1 is now known as havenstance

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!