DeutschEnglish

Submenu

 - - - By CrazyStat - - -

27. March 2014

TeXworks: Compiling your main.tex from an included part

Filed under: Uncategorized — Tags: , — Christopher Kramer @ 18:31

In case you have split your LaTeX document (let’s say main.tex) into multiple parts (let’s say part01.tex, …) and use include or input to stick it back together, you cannot compile part01.tex because it misses all the header stuff. So you need to compile main.tex. But is there a way in TeXworks to compile it using the Play-Button or CTRL+T?

Yes, there is. Add this line at the top of part01.tex etc:

% !TEX root = main.tex

Then just compile your files normally. It will compile main.tex, show the main.pdf in the preview and you can even navigate nicely using the context menu from pdf to tex and back.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

18. January 2014

Linux: get members of a group / get groups of a user

Filed under: Linux,Server Administration — Tags: , , , , — Christopher Kramer @ 00:23

This might sound easy with /etc/group and /etc/passwd, but what if you use libnss-mysql for example and need to try if it works?

So just forget grepping config files. Here are the real commands:

Members of a group:

getent group GROUPNAME

Replace GROUPNAME with the group you want to check.

Groups of a user:

groups USERNAME

Replace USERNAME with the name of the user to check.

 

Checked on Debian, not sure if it works on any Linux/Unix.

23. December 2013

phpLiteAdmin: French localization available for download

Filed under: phpLiteAdmin — Christopher Kramer @ 23:05

I just received a French translation for phpLiteAdmin, the open source web gui for SQLite databases written in PHP.

Thanks a lot to Olivier Briat for his work translating phpLiteAdmin!

As always you find the localization file in the downloads section.

After Arabic, Chinese, English, German, Italian and Russian, French is the seventh language that phpLiteAdmin is localized into. Thanks a lot to all translators. We would be very pleased to see more translations! Doing your own translation is very easy – just have a look at the wiki on how to translate.

11. October 2013

Stupid Spammers posting all their spam stock at once

Filed under: Uncategorized — Tags: — Christopher Kramer @ 14:47

Today I got this spam comment with probably all the possible spam combinations this spammer uses:

spam

This is only the first part, the complete comment is about 5 times as long. I guess it’s not the best approach to give all your beautiful spam away at once. Not only because only a complete fool would not mark this as spam but also because it’s probably the best way to make sure that spam filters will detect all your stuff 😀

9. October 2013

Typo3 ts_lastupdate: Change Text

Filed under: Typo3 — Tags: , , , — Christopher Kramer @ 12:38

The Typo3 extension ts_lastupdate comes in handy when you want to automatically display the date when the page has been edited the last time. On a German Typo3 installation, what it displays looks like this:

Letzte Änderung: 09.10.2013

You can configure the date format as described in the documentation. But what I missed was a way to configure the text before the date. I wanted it to say “Letzte Aktualisierung” instead of “Letzte Änderung”. The solution I came up with might be a bit quick and dirty but it surely does the trick:

plugin.tx_tslastupdate_pi1.text.wrap =  <!--|-->Letzte Aktualisierung:

So what I do is wrap the text provided by the extension (or rather language file) in comments and place my text afterwards. If you have multiple languages, you might need to use language conditions.

[globalVar = GP:L = 2]
plugin.tx_tslastupdate_pi1.text.wrap =  <!--|-->Letzte Aktualisierung: 
[globalVar = GP:L = 3]
plugin.tx_tslastupdate_pi1.text.wrap =  <!--|-->Last update: 
[global]

If anybody finds a cleaner solution, please let me know.

26. September 2013

jQuery: check whether an element exists

Filed under: JavaScript — Tags: , , , — Christopher Kramer @ 13:47

In traditional JavaScript, to check if some element exists, you’d have done something like this:

if(document.getElementById('someID'))

Of course this still works but what about using JQuery? So you might try this:

if($('#someID'))

But this will always be true as jQuery always returns an object, no matter whether the selector matched or not.So what you can do is the following:

if($('#someID').length > 0)

This will do the trick. You can even leave out “> 0”:

if($('#someID').length)

The cool thing is you can use this also to check more complex stuff, like whether #someID has an <img> child-element:

if($('#someID img').length)

And this is where jQuery really makes life a lot easier because with traditional JavaScript, this would be a bit lengthy for what it does.

Have fun!

1. September 2013

MySQL: reset a forgotten MySQL root password

Filed under: DBMS,Linux,Security,Server Administration — Christopher Kramer @ 14:37

Just in case you don’t know the password of your MySQL root user anylonger, this is how you can set a new one.

Windows users, follow this guide.

Linux / Unix users: This is for Debian (wheezy) and MySQL 5.5, but should work more or less the same on any linux/unix:

Either do this as (linux user) root or prefix every command with sudo:

  1. Stop the MySQL server
    service mysql stop
  2. Create a init file:
    touch /etc/mysql/mysql-init
  3. Write the following into this file (adjust the PW):
    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
  4. Restart MySQL with this init-file:
    mysqld_safe --init-file=/etc/mysql/mysql-init
  5. The new password should work now. Try it:
    mysql -u root -p
  6. Restart MySQL normally:
    service mysql restart
  7. Remove the init-file
    rm /etc/mysql/mysql-init

And you’re done. I hope this helps somebody.

Note: if it does not work, it is most likely because the MySQL process cannot access the init-file (e.g. because of missing access rights). In this case check your (sys)logs for stuff like this:

mysqld: 130901 14:20:30 [ERROR] /usr/sbin/mysqld: File '/root/mysql-init' not found (Errcode: 13)

I had this problem first because I tried creating the init-file in /root where the mysql-process was not able to read it.

11. August 2013

RT Request Tracker: Migrate From SQlite to mySQL

Filed under: DBMS,Linux,Server Administration — Tags: , , , , , , — Christopher Kramer @ 23:07

I lately had to migrate an RT installation (version 4.0.4) from SQLite to MySQL. In case anyone else has to do this, here is a brief description of how it worked out.

  1. Setup a working MySQL server in case you have not already
  2. Create a MySQL user for RT (e.g. rt4)
  3. Configure RT to use MySQL using this username and a dbname (e.g. rt4) of a not yet existing db (See /etc/request-tracker4/RT_SiteConfig.pm and RT_SiteConfig.d/)
    I’d recommend to keep a copy of the SQlite-Config…
  4. Run
    rt-setup-database --action init

    to create a blank RT DB in MySQL. Check if it worked.

  5. Delete all rows from the MySQL DB, only keep the schema.
  6. Create a copy of your SQLite db
    cp rtdb mydbcopy
  7. Open the copy of the db in the sqlite shell
    sqlite3 mydbcopy
  8. For each table in the DB:
    1. Set the Output file to something like this (“Attachments” is the table name)

    .out data_Attachments

    2. Set the mode to insert (“Attachments” is again the table name)

    .mode insert Attachments

    3. Get all the data

    SELECT * FROM Attachments;

    4. Now you have a file with lots of INSERT statements for the Attachments table. Try to run it in mysql:

    mysql -u rt4 -p rt4 < data_Attachments

    (On a linux shell, not the sqlite shell of course. Here the first rt4 is the username and the second the dbname. data_Attachments is the dump file created before)
    5. In case mysql complains some NOT NULL constraints are violated:
    Go back to the sqlite shell and set these cells to the default-value (0):

    UPDATE Attachments SET someColumn=0 WHERE someColumn IS NULL;

    (Only do this on the copy, not the original db 😉 )
    Now recreate the dump and retry to insert this in mysql. Do it with all columns where NOT NULL constraints are violated.

This works table by table, there are no foreign keys that would get in the way. You can also do several tables in one output file, but you might run into problems when NOT NULL constraints are violated by one table. After all your tables are filled with your data, RT should work. Maybe restart Apache.

apache2ctl restart

This worked without problems so far for me. I first tried pumping the whole SQLite dump into MySQL (using this conversion script) but the schema that this ended up in was different, missed indexes and RT only liked it until I restarted Apache (which then refused to start). Better start with a schema created by rt-setup-database, not with one that originates from SQLite.

I hope this is of some help for somebody. Please let me know in case it helped you or if you have any comments or questions.

5. May 2013

Online-Banking: Sicherheitslücke Auftragsvorlage

Filed under: Security — Tags: , , , , — Christopher Kramer @ 15:29

Auftragsvorlagen sind eine praktische Sache: Überweist man häufiger an den gleichen Empfänger, spart man es sich, jedes mal die Bankverbindung des Empfängers heraus zu suchen. Doch die Umsetzung von Auftragsvorlagen im Online-Banking vieler Banken öffnet ein Angriffsszenario, welches es ermöglicht, das TAN-Verfahren zu umgehen. Und das unabhängig davon, ob (i)TAN-Listen, Chip-TAN oder mTAN zum Einsatz kommt.

Angriffsszenario

Angenommen ein Angreifer gelangt, z.B. durch einen Keylogger oder Phising, zu den Zugangsdaten zum Online-Banking (Nutzername + PIN). Nun kann er sich im Online-Banking einloggen und bestehende Auftragsvorlagen ändern. Dazu verlangt keine von mir getestete Bank eine TAN. Er kann beispielsweise Kontonummer und BLZ durch seine eigene Bankverbindung ersetzen. Ändert er auch den Namen des Kontoinhabers, so wird dies dem Opfer in der Regel auffallen.  Da die Banken den Kontoinhaber aber nicht überprüfen müssen, kommt das Geld auch an, wenn der Name nicht angepasst wird.
Vorzugsweise wählt der Angreifer eine Auftragsvorlage, die das Opfer häufig oder mit großen Beträgen nutzt. Welche das sind, kann er ja in der Kontoübersicht leicht einsehen.

Loggt sich das Opfer nun ins Online-Banking ein und nutzt die manipulierte Auftragsvorlage, wird es in der Regel Kontonummer und BLZ nicht überprüfen, da es nicht davon ausgeht, dass sich diese ohne eigenes Zutun verändert haben (hätte man Kontonummner und BLZ des Empfängers im Kopf, müsste man keine Auftragsvorlage anlegen). Somit autorisiert das Opfer eine Zahlung an den Angreifer durch eine TAN, ohne dies zu beabsichtigen. Bei einigen TAN-Verfahren wie chipTAN oder mTAN werden dem Opfer noch einmal die manipulierte Kontonummer angezeigt, da das Opfer diese aber i.d.R. nicht auswendig kennt und auf die Auftragsvorlage vertraut, wird es die Zahlung trotzdem bestätigen.

Gelangt das Geld auf das unter fremden Namen eröffnete Konto, kann es der Angreifer sich von diesem Konto z.B. bar auszahlen lassen.

Zusammengefasst stellt das Angriffszenario für Angreifer eine Möglichkeit dar, das TAN-Verfahren zu umgehen. Da es voraussetzt, dass es dem Angreifer gelingt, PIN und Nutzernamen des Opfers (ohne dessen Wissen) zu stehlen schätze ich das Risiko nicht all zu hoch ein.

Dennoch bedeutet es, dass ein einfacher (unbemerkter) Phishing-Angriff auf Nutzername und PIN ausreicht, um Geld zu erbeuten. Es ist nicht nötig, an TANs des Opfers zu kommen.

Lösung

Die Lösung des Problems liegt auf der Hand: Beim Anlegen, Ändern (und evtl. Löschen) einer Auftragsvorlage sollte auf jeden Fall eine TAN abgefragt werden. Wird die Vorlage im Zuge einer Überweisung erstellt, die ohnehin per TAN bestätigt wird, ist es nicht nötig eine zweite TAN abzufragen. Ich hoffe, dass den Banken mit der Veröffentlichung dieses Angriffsszenarios das Problem bewusst wird und sie ihr Online-Banking entsprechend anpassen.
So lange dies nicht geschehen ist, bleibt dem Nutzer nur, Auftragsvorlagen bei Anwendung zu überprüfen oder gar nicht erst zu verwenden. Natürlich gilt, dass man nicht leichtfertig mit seiner PIN umgehen sollte, also nicht auf Phishing-Mails reagieren, seinen Rechner frei von Schadsoftware halten und Online-Banking nicht an öffentlichen bzw. fremden Computern zu verwenden, da auf diesen Keylogger installiert sein könnten.

Update: Wie ich jetzt gelesen habe, müssen Banken den Kontoinhaber gar nicht überprüfen. Es ist also nicht nötig, ein Konto unter falschem Namen anzulegen, man sucht sich einfach eine Bank aus, welche den Kontoinhaber nicht prüft, was wohl die meisten Banken so handhaben werden. Ich habe den Artikel entsprechend angepasst.

25. April 2013

phpLiteAdmin: Italian translation available for download

Filed under: PHP,phpLiteAdmin — Tags: , , , , , — Christopher Kramer @ 18:29

We now also received an Italian translation for phpLiteAdmin! :-)Thanks a lot to Franco Tassi who posted the Italian translation in our mailing list.

We now have translations to Arabic, Chinese, German, Italian and Russian (and English of course). In our wiki, you can find the download links and install instructions.

If phpLiteAdmin is not yet translated into your language, we would be very pleased if you translated it. It is very easy and also well explained in the wiki.

Thanks to all translators!

« Newer PostsOlder Posts »