Releases
Current version
Git/Latestdiff: 1.5.6
Latest Snapshots
Produced after each commit or rebase to new upstream version
GIT
RSBAC source code, can be unstable sometimes
Events
No events planned
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| wiki:experiences:telmich [2006/01/11 13:50] – 217.14.64.50 | wiki:experiences:telmich [2006/05/02 13:40] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== general impression ====== | ||
| + | * Looks like RSBAC is still in a stable state | ||
| + | * Looks like the documentation is still ** very to little ** | ||
| + | * motivated developers | ||
| + | * small community (still) | ||
| + | * still unknown to many people out there | ||
| + | |||
| + | ====== TODO ====== | ||
| + | |||
| + | Things I want to achieve / do with RSBAC: | ||
| + | |||
| + | - Create a new user, who | ||
| + | - may create, delete and modify other users (like a end user compatible user manager) | ||
| + | - Understand and use PM (there is no " | ||
| + | - Create a new user, who can shutdown / reboot the system | ||
| + | - use jails | ||
| + | - use rsbac_mod for apache, as soon as vhosts are supported | ||
| + | - test daemons, check whether they can run with rsbac | ||
| + | - test cinit with RSBAC | ||
| + | |||
| + | ====== common problems ====== | ||
| + | |||
| + | ===== su / setuid ===== | ||
| + | |||
| + | When you enabled ssh (see below) you may be able to **directly** login as //you// or **root**, but using __su__ | ||
| + | or __sudo__ may fail, because you are normally **not** allowed to setuid (to change) to another user. | ||
| + | |||
| + | ===== upgrading your system ===== | ||
| + | |||
| + | When you upgrade your system (especially ssh, login or pam) you may lose complete control | ||
| + | over your system. Like I did some seconds ago: | ||
| + | |||
| + | - I logged in as root | ||
| + | - I typed " | ||
| + | - I went away, shopping for the company | ||
| + | - I came back and wanted to login as " | ||
| + | - The answer was " | ||
| + | |||
| + | What happened? | ||
| + | - The update saw that there are new packages and dist-upgrade installs them | ||
| + | - The dist upgrade replaced /// | ||
| + | - The inode of /bin/login changed | ||
| + | - The old settings for /bin/login vanished | ||
| + | - I am not able to login anymore | ||
| + | - sshd also got replaced, so the connection is reseted by the rsbac host | ||
| + | |||
| + | **How to solve the problem** | ||
| + | - I am right now trying it... | ||
| + | - I rebooted the system | ||
| + | - At the grub prompt I added // | ||
| + | - Now I am able to login as rsbac_400 on the console (at least in theory it still boots) | ||
| + | - And now I can restore the standard settings: | ||
| + | - Allow /bin/login to setuid (use // | ||
| + | - Allow / | ||
| + | |||
| + | ====== HOWTO ====== | ||
| + | |||
| + | ===== Migrating ' | ||
| + | |||
| + | - get vanilla Linux kernel | ||
| + | - configure standard kernel | ||
| + | - install and test standard kernel | ||
| + | - try to add the rsbac-patch to kernel (bunzip2 // | ||
| + | - add the rsbac-patch to kernel (bunzip2 // | ||
| + | - add rsbac-common (tar xfj rsbac-common*.tar.bz2 in / | ||
| + | - configure the new kernel options (RSBAC Menu), build it | ||
| + | - Be sure to select UM (user management), | ||
| + | - extract // | ||
| + | - add special user // | ||
| + | - add the new kernel to the bootloader and add the following kernel option: // | ||
| + | - This will let you login, otherwise login is denied to do setuid (like any other program) | ||
| + | - reboot | ||
| + | - I was able to login on the prompt now :) | ||
| + | |||
| + | ==== getting sshd running ==== | ||
| + | |||
| + | Because **bruehe.schottelius.org** is my home webserver / router, I wanted to administrate it from work so I can continue to configure it with rsbac. So the first thing which had/has to run is ssh. ssh was a little bit tricky on my testing machine **dosinux**, | ||
| + | |||
| + | Anyway, we'll get more secure later. | ||
| + | |||
| + | - login as rsbac_400 | ||
| + | - call // | ||
| + | - select //AUTH May Setuid// and set it to //1 / On// | ||
| + | - now you should be able to use ssh | ||
| + | |||
| + | ==== migrating users and groups to rsbac management ==== | ||
| + | |||
| + | When converting users and groups you have to keep in mind, that you **CANNOT** convert the old passwords! They are encrypted on disk and rsbac **CANNOT** (and does not want to, it is not a password cracker) decrypt them. So you have to setup the passwords in RSBAC, after you converted the users. | ||
| + | - login as rsbac_400 (through ssh or local, does not matter) | ||
| + | - convert users: // | ||
| + | - convert groups: // | ||
| + | - setup password for **AT LEAST** root and rsbac_400 | ||
| + | - **DO THAT AS RSBAC_400, root may not have enough priviliges yet!** | ||
| + | - use // | ||
| + | - the problem is that there IS no old password, so RSBAC will **always** fail, if you omit -n | ||
| + | - When you try to use rsbac_passwd as root, the following may happen:< | ||
| + | bruehe2# dmesg -c &>/ | ||
| + | bruehe2# rsbac_passwd -n nico | ||
| + | New RSBAC password for user nico (uid 1000): | ||
| + | Repeat new password: | ||
| + | Error: Operation not permitted | ||
| + | bruehe2# dmesg | ||
| + | 0000007472|rsbac_adf_request(): | ||
| + | prog_name rsbac_passwd, | ||
| + | tid 1000, attr none, value none, result NOT_GRANTED by MAC FF RC AUTH ACL | ||
| + | </ | ||
| + | - configure / | ||
| + | - '' | ||
| + | - '' | ||
| + | - '' | ||
| + | - It should now be possible to use //ls -l /home// and see the user names, which are now coming from rsbac:< | ||
| + | bruehe2# ls -l / | ||
| + | [...] | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | [...]</ | ||
| + | - **AT THIS POINT BE SURE TO BE LOGGED IN AS ROOT AND RSBAC_400** | ||
| + | - configure pam to use rsbac: edit | ||
| + | - / | ||
| + | - / | ||
| + | - / | ||
| + | - / | ||
| + | - and replace // | ||
| + | - **MAKE SURE YOU ARE LOGGED IN AS ROOT AND RSBAC_400 BEFORE YOU DID THAT CHANGE ABOVE** | ||
| + | - Now try to login (either via ssh if configured or via login) | ||
| + | - If it works: Gratulation, | ||
| + | |||
| + | So far so fine, we've rsbac user management running. Now, to proof it, let us remove the old authentication tokens: Move away | ||
| + | - /etc/passwd | ||
| + | - /etc/shadow | ||
| + | - /etc/group | ||
| + | - / | ||
| + | |||
| + | That's how I did it: | ||
| + | < | ||
| + | bruehe2# mkdir ~/old-unix/ | ||
| + | bruehe2# mv /etc/passwd /etc/shadow /etc/group / | ||
| + | </ | ||
| + | |||
| + | And now, try to login again. Nice, isn't it? | ||
| + | |||
| + | Now, at the end, do ultimo and **remove support** for normal authentication: | ||
| + | < | ||
| + | - Rule Set Based Access Control (RSBAC) | ||
| + | - User Management | ||
| + | - [*] | ||
| + | </ | ||
| + | - recompile | ||
| + | - reinstall | ||
| + | - reboot | ||
| + | - try to login, otherwise search for help :-) (or use softmode) | ||
| + | |||
| + | ==== securing sshd ==== | ||
| + | |||
| + | After we finished migrating to in kernel user management, we'll focus on securing the sshd. | ||
| + | |||
| + | ==== configuring squid (http proxy) ==== | ||
| + | |||
| + | - try to start it, get errors in dmesg< | ||
| + | bruehe2# dmesg -c | ||
| + | bruehe2# / | ||
| + | Starting proxy server: start-stop-daemon: | ||
| + | squid. | ||
| + | bruehe2# dmesg | ||
| + | 0000007633|rsbac_adf_request(): | ||
| + | start-stop-daem, | ||
| + | attr owner, value 0, result NOT_GRANTED by AUTH | ||
| + | </ | ||
| + | - See that Debian sys-v-init scripts aren't the best thing :/ | ||
| + | - start squid manually< | ||
| + | bruehe2# / | ||
| + | bruehe2# dmesg -c | ||
| + | 0000007645|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by RC ACL | ||
| + | 0000007646|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by RC ACL | ||
| + | 0000007647|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | result NOT_GRANTED by AUTH | ||
| + | 0000007648|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by RC ACL | ||
| + | 0000007649|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | result NOT_GRANTED by AUTH | ||
| + | </ | ||
| + | - give / | ||
| + | - login as rsbac_400 | ||
| + | - call rsbac_fd_menu / | ||
| + | - go to AUTH Capability | ||
| + | - add ' | ||
| + | - call / | ||
| + | - That's how it worked here | ||
| + | |||
| + | ==== configuring apache (http server) ==== | ||
| + | [[http:// | ||
| + | |||
| + | |||
| + | |||
| + | ==== configuring openvpn (vpn server) ==== | ||
| + | |||
| + | ==== configuring screen (console " | ||
| + | |||
| + | The following will happen, if you did not configure it before: | ||
| + | < | ||
| + | bruehe2# dmesg -c &>/ | ||
| + | bruehe2# screen -l | ||
| + | [screen is terminating] | ||
| + | bruehe2# dmesg | ||
| + | 0000007473|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by AUTH | ||
| + | 0000007474|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by AUTH | ||
| + | bruehe2# ls -l / | ||
| + | -rwxr-sr-x | ||
| + | </ | ||
| + | |||
| + | Doing the same as user //nico// produces the following error: | ||
| + | |||
| + | < | ||
| + | bruehe2# dmesg | ||
| + | 0000007526|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | result NOT_GRANTED by AUTH | ||
| + | 0000007527|rsbac_adf_request(): | ||
| + | rog_file / | ||
| + | result NOT_GRANTED by AUTH | ||
| + | </ | ||
| + | |||
| + | This looks like beeing easy to solve: screen wants to setuid to the calling user. | ||
| + | |||
| + | - login as rsbac_400 | ||
| + | - call // | ||
| + | - select //AUTH Capabilities// | ||
| + | |||
| + | That's it! | ||
| + | |||
| + | ==== configuring qmail (mta) ==== | ||
| + | |||
| + | ==== configuring vsftpd (ftp server) ==== | ||
| + | |||
| + | # add user ftp, give correct homedir: < | ||
| + | rsbac_400@dosinux: | ||
| + | rsbac_400@dosinux: | ||
| + | root@dosinux# | ||
| + | root@dosinux# | ||
| + | </ | ||
| + | # now the following will happen:< | ||
| + | dosinux# telnet localhost 21 | ||
| + | Trying 127.0.0.1... | ||
| + | Connected to localhost.localdomain. | ||
| + | Escape character is ' | ||
| + | 500 OOPS: setuid | ||
| + | 500 OOPS: child died | ||
| + | |||
| + | dosinux# dmesg | ||
| + | 0000000663|rsbac_get_attr(): | ||
| + | 0000000664|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | attr owner, value 65534, result NOT_GRANTED by AUTH | ||
| + | 0000000665|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | owner, value 65534, result NOT_GRANTED by AUTH | ||
| + | 0000000666|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | owner, value 65534, result NOT_GRANTED by AUTH | ||
| + | |||
| + | </ | ||
| + | # You need to add at least the capability 65534 (nobody) | ||
| + | # I also added capability 2002 (ftp), but did not test if it works without | ||
| + | # Retest< | ||
| + | dosinux# telnet localhost 21 | ||
| + | Trying 127.0.0.1... | ||
| + | Connected to localhost.localdomain. | ||
| + | Escape character is ' | ||
| + | 220 Welcome to !eof - dosinux - RSBAC | ||
| + | USER ANONYMOUS | ||
| + | 331 Please specify the password. | ||
| + | PASS ae | ||
| + | 500 OOPS: vsftpd: refusing to run with writable anonymous root | ||
| + | 500 OOPS: cap_set_proc | ||
| + | Connection closed by foreign host. | ||
| + | dosinux# chmod u-w / | ||
| + | dosinux# mkdir / | ||
| + | dosinux# chown ftp / | ||
| + | dosinux# dmesg -c | ||
| + | 0000000668|rsbac_adf_request(): | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== configuring bind9 (dns server) ==== | ||
| + | |||
| + | - nothing to do if you want to run it as root. **YOU DO NOT WANT TO DO THAT!!**< | ||
| + | bruehe2# # this would work, but you really do not want to do that. | ||
| + | bruehe2# / | ||
| + | - What we want to do is running named as user // | ||
| + | bruehe2# dmesg -c | ||
| + | bruehe2# / | ||
| + | named: setuid(): Operation not permitted | ||
| + | bruehe2# dmesg | ||
| + | 0000007923|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by AUTH | ||
| + | </ | ||
| + | - Allow named to become user //bind// | ||
| + | - login as rsbac_400 | ||
| + | - rsbac_fd_menu / | ||
| + | - Add AUTH Capability //bind// | ||
| + | - let us retry:< | ||
| + | bruehe2# / | ||
| + | named: capset failed: Operation not permitted | ||
| + | bruehe2# dmesg | ||
| + | 0000007924|rsbac_adf_request(): | ||
| + | named, prog_file / | ||
| + | none, result NOT_GRANTED by MAC PM RC ACL | ||
| + | </ | ||
| + | - Now I read http:// | ||
| + | - After that I read http:// | ||
| + | - Now create a new Role for Bind | ||
| + | - login as rsbac_400 | ||
| + | - call rsbac_rc_role_menu | ||
| + | - press cancel | ||
| + | - scroll to bottom | ||
| + | - choose "New Role" | ||
| + | - give it some number and some name | ||
| + | - go to Type Comp SCD | ||
| + | - select capability | ||
| + | - select MODIFY_SYSTEM_DATA | ||
| + | - leave menu | ||
| + | - Now let / | ||
| + | - login as rsbac_400 | ||
| + | - call rsbac_fd_menu / | ||
| + | - choose RC Force Role and select the newly created role | ||
| + | - Now we have many new errors, which I'll have a look at after I slept ;-) | ||
| + | - those errors can be found in http:// | ||
| + | - I've found a way to remove most of them | ||
| + | - in the rc_role_menu, | ||
| + | 0000009595|rsbac_adf_request(): | ||
| + | prog_name named, prog_file / | ||
| + | none, value none, result NOT_GRANTED by MAC PM RC ACL | ||
| + | </ | ||
| + | - I was told that I should have copied the " | ||
| + | bruehe2# named -u bind | ||
| + | named: capset failed: Operation not permitted | ||
| + | named: capset failed: Operation not permitted | ||
| + | bruehe2# dmesg | ||
| + | 0000009605|rsbac_adf_request(): | ||
| + | prog_name named, prog_file / | ||
| + | none, value none, result NOT_GRANTED by RC | ||
| + | 0000009606|rsbac_adf_request(): | ||
| + | prog_name named, prog_file / | ||
| + | none, value none, result NOT_GRANTED by MAC PM RC ACL</ | ||
| + | - now I allow this role to use capability, in SCD, to MODIFY_SYSTEM_DATA; | ||
| + | bruehe2# killall named | ||
| + | bruehe2# named -u bind | ||
| + | named: capset failed: Operation not permitted | ||
| + | bruehe2# dmesg -c | ||
| + | 0000009613|rsbac_adf_request(): | ||
| + | prog_name named, prog_file / | ||
| + | none, value none, result NOT_GRANTED by MAC PM ACL | ||
| + | </ | ||
| + | - now I am a bit confused, because I do not see the differnce between the error I removed and the error still exists. Only that other modules still deny it, where RC allows it. But why do MAC, PM and ACL deny THIS request and ALLOW the one before? | ||
| + | - found the difference: the first error occurs as root, while the second occurs as user 103 (bind) | ||
| + | - I think the reason for this is: in rsbac_fd_menu I added the AUTH capability 103, that means to switch to bind | ||
| + | - Then as user bind the RC does not fit|work|is not usable anymore | ||
| + | - The question is, what is the correct way to fix it. Perhaps it is possible to add the AUTH capability to the 'named (copied)' | ||
| + | |||
| + | ==== configuring oidentd (identd server) ==== | ||
| + | |||
| + | - When starting oidentd normally, it starts, but rsbac gives the following error:< | ||
| + | 0000009630|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | result NOT_GRANTED by RC ACL</ | ||
| + | |||
| + | ==== configuring cinit (init system) | ||
| + | |||
| + | ==== configuring silcd (chat server) | ||
| + | |||
| + | - create group silc: rsbac_400@bruehe2: | ||
| + | - create user silc in group silc: rsbac_400@bruehe2: | ||
| + | - tell silcd in silcd.conf to use user silc and group silc | ||
| + | - add auth capability " | ||
| + | - now trying to start:< | ||
| + | bruehe2# / | ||
| + | bruehe2# dmesg | ||
| + | 0000009616|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | value none, result NOT_GRANTED by RC ACL | ||
| + | </ | ||
| + | - and it works perfectly, although this read is denied! | ||
| + | - now add group capability to group " | ||
| + | - this **fails** with the error RSBAC_EWRITEFAILED. I've to find out why there is this error | ||
| + | |||
| + | ==== creating a user/group administrator | ||
| + | |||
| + | ===== dosinux.schottelius.org ===== | ||
| + | |||
| + | ==== configuring apache2 (http server) ==== | ||
| + | |||
| + | - Do apt-get install apache2 before | ||
| + | - See what happens:< | ||
| + | dosinux# / | ||
| + | dosinux# dmesg | ||
| + | 0000001236|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | NOT_GRANTED by RC ACL | ||
| + | 0000001237|rsbac_adf_request(): | ||
| + | prog_file / | ||
| + | result NOT_GRANTED by RC ACL | ||
| + | 0000001238|rsbac_adf_request(): | ||
| + | apache2, prog_file / | ||
| + | value 33, result NOT_GRANTED by AUTH | ||
| + | 0000001239|rsbac_adf_request(): | ||
| + | apache2, prog_file / | ||
| + | value 33, result NOT_GRANTED by AUTH | ||
| + | 0000001240|rsbac_adf_request(): | ||
| + | apache2, prog_file / | ||
| + | value 33, result NOT_GRANTED by AUTH | ||
| + | 0000001241|rsbac_adf_request(): | ||
| + | apache2, prog_file / | ||
| + | value 33, result NOT_GRANTED by AUTH | ||
| + | 0000001242|rsbac_adf_request(): | ||
| + | apache2, prog_file / | ||
| + | value 33, result NOT_GRANTED by AUTH | ||
| + | </ | ||
| + | - Add the AUTH capability 33 (www-data), use rsbac_400 and rsbac_fd_menu / | ||
| + | - TADA, it runs:< | ||
| + | dosinux# / | ||
| + | dosinux# dmesg | ||
| + | 0000001243|rsbac_adf_request(): | ||
| + | 0000001244|rsbac_adf_request(): | ||
| + | dosinux# ps axu | grep apache2 | ||
| + | root 3693 0.8 0.9 16744 5436 ? Ss | ||
| + | www-data | ||
| + | www-data | ||
| + | www-data | ||
| + | www-data | ||
| + | www-data | ||
| + | root 3701 0.0 0.0 | ||
| + | </ | ||
| + | |||
| + | ===== Roles ===== | ||
| + | |||
| + | Roles should make life easier, currently they are just making my life more complicated. Let's see what we can do with them. | ||
| + | |||
| + | ==== creating a " | ||
| + | |||
| + | The first problem to solve with Roles is to create a user, which is able to | ||
| + | - create | ||
| + | - delete | ||
| + | - and modify other users (like a end user compatible user manager) | ||
| + | |||
| + | |||
| + | First of all, I create a user: | ||
| + | - login as rsbac_400, do < | ||
| + | - now do < | ||
| + | - login as root and do< | ||
| + | mkdir / | ||
| + | chown user_manager ~user_manager</ | ||
| + | - Now we successfully created a normal user. | ||
| + | - TOBEDONE... | ||
| + | |||
| + | ===== Backup ===== | ||
| + | |||
| + | ==== all configurations ==== | ||
| + | |||
| + | ==== users and groups ==== | ||
| + | |||
| + | ===== Maintaining ===== | ||
| + | |||
| + | ==== Problems updating the system ==== | ||
| + | |||
| + | When you update your system < | ||
| + | in Debian for instance, your RSBAC settings will party be **LOST**. | ||
| + | Why that? Files are replaced and as far as I know RSBAC remembers the file by its inode. The inode will/may change after an update, so you loose the settings. | ||
| + | |||
| + | To save your data you could first backup the settings, then update the sytem and then reply the settings. | ||
| + | |||
| + | The problem I had was that I did a dist-upgrade and then squid was unable to start, because the settings I made with rsbac_fd_menu were lost. | ||