Ticket #318 (closed defect: fixed)

Opened 5 years ago

Last modified 22 months ago

les scripts d'AlternC affichent le password root partout

Reported by: anarcat Owned by: anarcat
Priority: block Milestone: alternc-0.9.8
Component: Shell-scripts et binaires Version: alternc-0.9.4
Severity: major Keywords:
Cc:

Description (last modified by anarcat) (diff)

Plusieurs scripts d'AlternC ont des appels comme:

MYSQL_SELECT="/usr/bin/mysql -u${MYSQL_USER} -p${MYSQL_PASS} -Bs ${MYSQL_DATABASE} -e "

Ceci fait que le mot de passe MYSQL_PASS est lisible avec un simple appel 'ps', ce qui défait toute l'idée d'avoir des utilisateurs différents pour les usagers d'alternc.

Attachments

fix_318.diff (12.7 kB) - added by anarcat 2 years ago.
patch à réviser
fix_318-2.diff (12.2 kB) - added by anarcat 2 years ago.
second brain dump
fix_318-3.diff (18.9 kB) - added by anarcat 2 years ago.
third brain dump, ~500 lines unified
fix_318-5.diff (20.9 kB) - added by anarcat 2 years ago.
more brain dumping
fix_318-6.diff (21.6 kB) - added by anarcat 2 years ago.
avec cette patch, je peux faire des upgrades

Change History

Changed 5 years ago by anarcat

Ce qu'il faudrait, c'est avoir MYSQL_USER et MYSQL_PASS dans un fichier .my.cnf dans le compte root. Ceci éviterait d'avoir le mot de passe root partout.

Changed 5 years ago by benjamin

console 1 : brassens:~# mysql -usysusr -ptototititata system

console 2 : brassens:~# ps fauxw => root 3311 0.1 0.2 6032 2168 ttyp0 S+ 06:37 0:00 | \_ mysql -usysusr -px xxxxxx system

ok, mysql modifie sa propre ligne de commande, le mot de passe est non visible ;)

De plus, le premier qui arrive à faire un "ps" depuis un compte AlternC, qu'il m'appelle ...

Changed 4 years ago by OlivierH

Ne pourrait on pas, donc, fermer cette "fausse alerte" ?

Changed 4 years ago by fil@…

  • type set to defect

Oui à mon avis il faut le fermer

Changed 4 years ago by anarcat

  • priority changed from immediate to normal
  • version set to 0.9.4
  • severity changed from block to major
  • milestone set to 0.9.5

je persiste à croire que alternc pourrait utiliser /etc/mysql/debian.cnf ou un autre fichier de conf similaire.

Changed 4 years ago by joe

anarcat, tout à fait d'accord, un "race-condition", peu-importe sa probabilité est un défaut de sécurité.

Changed 4 years ago by nahuel

<Vanzetti> 1) utiliser /etc/mysql/debian.cnf
<Vanzetti> mais ce serait utiliser la conf de debian etnon celle d'alternc
<Vanzetti> mais on est sur qu'elle fonctionnera tout le temps
<Vanzetti> 2) creer un fichier de conf /etc/alternc/mysql.conf
<Vanzetti> que l'on utiliserait
<Vanzetti> et qui n'appartiendrait pas à debian
<Vanzetti> et on pourrait meme y transferer toute la conf de mysql
<Vanzetti> d'alternc
<Vanzetti> zen pensez quoi ?

Changed 4 years ago by anonymous

J'irais pour l'approche #2, ca semble plus conforme avec la politique de debian sur les fichiers de config.

Changed 4 years ago by anonymous

  • status changed from new to assigned

Changed 4 years ago by joe

  • owner changed from anonymous to joe
  • status changed from assigned to new

Changed 4 years ago by joe

  • status changed from new to assigned

Début de solution entrepris dans [998].

Changed 4 years ago by anarcat

alors "biting the bullet"? je ne l'espérait pas vraiment. :) il faudrait faire attention de ne pas dupliquer le mot de passe dans local.php pour rien. Il faudrait, tant qu'à dupliquer l'info, faire carrément un nouveau user pour le bureau. Il faudrait réviser quels sont les privilèges nécessaires dans local.php et s'ils sont différents de ceux de local.sh, faire un user séparer. Tant qu'à foutre le bordel... :)

Changed 4 years ago by anarcat

  • description modified (diff)

style

Changed 4 years ago by anarcat

  • milestone changed from 0.9.5 to 1.0

commit was reverted in [1001] because the solution wasn't complete. postponing to 1.0 since this is not critical and we're out of time (again).

Changed 2 years ago by anarcat

  • milestone changed from alternc-1.0 to alternc-0.9.8

Changed 2 years ago by anarcat

  • owner changed from joe to anarcat
  • status changed from assigned to new

grep -r MYSQL_PASS the trunk for places to fix.

Changed 2 years ago by anarcat

  • priority changed from normal to block
  • status changed from new to assigned

Changed 2 years ago by anarcat

patch à réviser

Changed 2 years ago by anarcat

second brain dump

Changed 2 years ago by anarcat

third brain dump, ~500 lines unified

Changed 2 years ago by anarcat

more brain dumping

Changed 2 years ago by anarcat

avec cette patch, je peux faire des upgrades

Changed 2 years ago by anarcat

note that the way the current patch deals with GRANTs will allow us to actually *REMOVE* the old grants when, for example, the root username changes (#601).

it also paves the way towards various my.cnf for alternc for the different services, in isolation... (#364, ...)

Changed 2 years ago by anarcat

(In [2117]) Major redesign of the MySQL backend interface to fix a security issue. See: #318.

As of now, the MySQL configuration used everywhere by AlternC is not stored in the main configuration file (/etc/alternc/local.sh) but in a MySQL configuration file in /etc/alternc/my.cnf, which enables us to call mysql without exposing the password on the commandline.

The changes here are quite invasive but will allow us to factor out the MySQL configuration better. See #364.

This includes a partial rewrite of the mysql.sh logic, which is now ran from the postinst script (and not alternc.install) which will allow us to actually change the MySQL root user properly. See #601.

This commit was tested like this:

  • clean install on etch (working)
  • upgrade from a clean 0.9.7 (working)

Changed 2 years ago by anarcat

j'attend de faire l'upgrade de notre serveur de prod avec ces fixes avant de fermer le bug.

Changed 22 months ago by anarcat

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone changed from alternc-0.9.9 to alternc-0.9.8
Note: See TracTickets for help on using tickets.