List of commits:
Subject Hash Author Date (UTC)
Added nd-cert-info tool 14447ae85aa5501d542c17f31fd6ce820267846c Catalin(ux) M. BOIE 2023-03-18 06:54:42
Mostly documentation updates fadbfe517eac4b0de3783e79d9779af57791833d Catalin(ux) M. BOIE 2023-03-17 07:17:12
Another json_object_get_uint64 replaced with int64 21f272b86ed57916d0fb7cc05de20170c36cf1cb Catalin(ux) M. BOIE 2023-03-15 20:16:13
make chown optional to not get errors when building rpm 2541f217b4ee77748d03f553ce1f6576c43c7106 Catalin(ux) M. BOIE 2023-03-15 19:00:49
Wrong path to Makefile.common in Makefile 82d474d4e825fd1afaf225518512f075ca25295f Catalin(ux) M. BOIE 2023-03-15 18:16:58
DESTDIR installation fix 5b5b7917a4b26daed48f1bb6dee826533997b518 Catalin(ux) M. BOIE 2023-03-15 12:59:22
RockyLinux 8 does not have json_object_new_uint64 function ce66611027547ca6740f36efa4f9da60f47c6132 Catalin(ux) M. BOIE 2023-03-15 12:33:18
More functions added 920cc4824df01ccfc0b04450fdfa43568910cf85 Catalin(ux) M. BOIE 2023-03-15 06:17:29
Lots of changes 8c803765a4dd6d79e7f61927c47a5f1a19e3db31 Catalin(ux) M. BOIE 2023-03-13 05:51:28
Record full path of the cert for openssl 66e89d4e0eaf638859b39c791d82d233e2d0c2c2 Catalin(ux) M. BOIE 2023-03-03 18:41:57
Improve presentation 0600fd3c6e5fcb0dd152d0e680ea85a8ae89bd86 Catalin(ux) M. BOIE 2022-12-09 17:46:09
More curl tracing info 04013af7a216e6cf7f363b3895ffcebe78859a65 Catalin(ux) M. BOIE 2022-12-09 17:45:46
Added curl support c374ad15d2d5548d168084c0e8506929803e9bf0 Catalin(ux) M. BOIE 2022-11-30 11:28:48
More Latex modules were missing ff5bec2cfba2cf77e0115f89124cdeb83dfbc73d Catalin(ux) M. BOIE 2022-11-24 16:52:48
Forgot to add beamer 1080ddc6497af77b66fd57eb7b9da0abaf75cb2a Catalin(ux) M. BOIE 2022-11-24 16:39:30
Mispelled docs 463d312e5ddc8b237e03a4d9b4cfb33524393fb0 Catalin(ux) M. BOIE 2022-11-24 16:11:45
More docs updated 83876ce8fcf9ae03c189e4fc7f354bf67f328916 Catalin(ux) M. BOIE 2022-11-24 15:59:05
Record bytes read/written on fds 428c3905bb135725ac3bd2ecfe5949e434b179b5 Catalin(ux) M. BOIE 2022-11-24 15:58:25
A lot of small fixes 9a5841916f3f0870ca091f457102c7512b21808a Catalin(ux) M. BOIE 2022-11-23 07:28:06
Added pthread_join + small fixes a5206c335f8c858d791f114da7361190196ad4a4 Catalin(ux) M. BOIE 2022-11-21 14:05:31
Commit 14447ae85aa5501d542c17f31fd6ce820267846c - Added nd-cert-info tool
Author: Catalin(ux) M. BOIE
Author date (UTC): 2023-03-18 06:54
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2023-03-18 06:54
Parent(s): fadbfe517eac4b0de3783e79d9779af57791833d
Signer:
Signing key:
Signing status: N
Tree: edc80cc03c7bbc5de9c7bb9a0ca2f525e98da3a6
File Lines added Lines deleted
tools/Makefile 4 1
tools/nd-cert-info.c 93 0
tools/nd-cert-notify.c 4 2
File tools/Makefile changed (mode: 100644) (index 106077c..33a806f)
... ... OBJS := \
9 9 ../common/tools.o ../common/info.o ../common/decode_text.o \ ../common/tools.o ../common/info.o ../common/decode_text.o \
10 10 ../common/sctools.o ../common/bin2struct.o ../common/sctools.o ../common/bin2struct.o
11 11
12 ALL_TOOLS := nd-cert-notify
12 ALL_TOOLS := nd-cert-notify nd-cert-info
13 13
14 14 all: $(ALL_TOOLS) all: $(ALL_TOOLS)
15 15
16 16 nd-cert-notify: nd-cert-notify.c Makefile $(COMMON_H) $(OBJS) nd-cert-notify: nd-cert-notify.c Makefile $(COMMON_H) $(OBJS)
17 17 $(CC) $(CFLAGS) $@.c -o $@ $(OBJS) $(CURL_LIBS) $(CC) $(CFLAGS) $@.c -o $@ $(OBJS) $(CURL_LIBS)
18 18
19 nd-cert-info: nd-cert-info.c Makefile $(COMMON_H) $(OBJS)
20 $(CC) $(CFLAGS) $@.c -o $@ $(OBJS)
21
19 22 .PHONY: clean .PHONY: clean
20 23 clean: clean:
21 24 @rm -f $(ALL_TOOLS) @rm -f $(ALL_TOOLS)
File tools/nd-cert-info.c added (mode: 100644) (index 0000000..1ce7c5a)
1 #include <libgen.h>
2 #include <stdarg.h>
3 #include <stdio.h>
4
5 #include <bin2struct.h>
6 #include <sctools.h>
7 #include <tools.h>
8
9 void xlog(const unsigned int level, const char *format, ...)
10 {
11 (void) level;
12 (void) format;
13 }
14
15 static int user_cb(const unsigned int uid, const char *user_dir)
16 {
17 glob_t certs;
18 int r, ret = 0;
19
20 fprintf(stdout, "uid=%u user_dir=[%s]\n", uid, user_dir);
21
22 r = nd_load_certs(&certs, uid);
23 if (r <= 0)
24 return 1;
25 for (unsigned int i = 0; i < certs.gl_pathc; i++) {
26 unsigned char data[4096];
27 r = load_dir_file(data, sizeof(data), certs.gl_pathv[i], "data");
28 if (r == -1) {
29 ret = 1;
30 break;
31 }
32
33 struct ninedogs_cert cert;
34 r = nd_bin2struct_cert(&cert, data, r);
35 if (r == -1) {
36 ret = 1;
37 break;
38 }
39
40 char not_before[32], not_after[32];
41 nd_ts_to_str(not_before, sizeof(not_before), cert.not_before);
42 nd_ts_to_str(not_after, sizeof(not_after), cert.not_after);
43 fprintf(stdout, " subject=[%s]"
44 "\n path=[%s]"
45 "\n issuer=[%s]"
46 "\n serial=[%s]"
47 "\n %s -> %s\n",
48 cert.subj, cert.path, cert.issuer, cert.serial, not_before, not_after);
49
50 glob_t users;
51 r = nd_load_cert_users(&users, certs.gl_pathv[i]);
52 if (r == -1) {
53 ret = 1;
54 break;
55 }
56 fprintf(stdout, " Users:\n");
57 for (unsigned j = 0; j < users.gl_pathc; j++) {
58 unsigned char data[4096];
59 int r = load_file(data, sizeof(data), users.gl_pathv[j]);
60 if (r == -1) {
61 ret = 1;
62 break;
63 }
64 struct ninedogs_app app;
65 r = nd_bin2struct_app(&app, data, r);
66 if (r == -1) {
67 ret = 1;
68 break;
69 }
70
71 char *q = dirname(users.gl_pathv[j]);
72 char *user_client_id = basename(q); q = dirname(q);
73 char cmd[4096], sts[64];
74 nd_app_nice(cmd, sizeof(cmd), app.cmdline, app.cmdline_len);
75 nd_ts_to_str(sts, sizeof(sts), app.ts / 1000);
76 fprintf(stdout, " user_client_id=[%s] last=%s"
77 "\n cmdline=[%s]\n",
78 user_client_id, sts, cmd);
79 }
80 globfree(&users);
81 fprintf(stdout, "\n");
82 if (ret == 1)
83 break;
84 }
85 globfree(&certs);
86
87 return ret;
88 }
89
90 int main(void)
91 {
92 return nd_for_each_user(user_cb);
93 }
File tools/nd-cert-notify.c changed (mode: 100644) (index 395742f..f8529de)
... ... static int user_cb(const unsigned int uid, const char *user_dir)
113 113
114 114 unsigned char data[4096]; unsigned char data[4096];
115 115 int r = load_file(data, sizeof(data), users.gl_pathv[j]); int r = load_file(data, sizeof(data), users.gl_pathv[j]);
116 if (r == -1)
117 return -1;
116 if (r == -1) {
117 ret = -1;
118 break;
119 }
118 120 struct ninedogs_app app; struct ninedogs_app app;
119 121 r = nd_bin2struct_app(&app, data, r); r = nd_bin2struct_app(&app, data, r);
120 122 if (r == -1) { if (r == -1) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/ninedogs

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/ninedogs

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/ninedogs

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main