summaryrefslogtreecommitdiffstats
path: root/scripts/fedora-packager-setup.sh
blob: dbf497d3733fa3bc24ac92014b5466034383c685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/bash

set -e

function check_wget() {
    if [ ! -f /usr/bin/wget ]; then
        echo "You must have wget installed to download the required CA certificates"
        echo "Please run \"yum install wget\" as root, and re-run this script"
        exit 1
    fi
}

echo "Setting up Koji client..."

if [ ! -f ~/.fedora.cert ]; then
    echo "You need a client certificate from the Fedora Account System"
    echo "Please download one from https://admin.fedoraproject.org/accounts/gen-cert.cgi"
    echo "Save it to ~/.fedora.cert and re-run this script"
    exit 1
fi

if [ ! -f ~/.fedora-upload-ca.cert ]; then
    check_wget
    /usr/bin/wget -q "https://admin.fedoraproject.org/accounts/fedora-upload-ca.cert" -O ~/.fedora-upload-ca.cert
fi

if [ ! -f ~/.fedora-server-ca.cert ]; then
    check_wget
    /usr/bin/wget -q "https://admin.fedoraproject.org/accounts/fedora-server-ca.cert" -O ~/.fedora-server-ca.cert
fi

if [ ! -d ~/.koji ]; then
    mkdir  ~/.koji
fi

# remove existing contents of ~/.koji to avoid confusion
rm -f ~/.koji/*

cat > ~/.koji/config <<EOF
[koji]

;configuration for koji cli tool

;url of XMLRPC server
server = http://koji.fedoraproject.org/kojihub

;url of web interface
weburl = http://koji.fedoraproject.org/koji

;url of package download site
pkgurl = http://koji.fedoraproject.org/packages

;path to the koji top directory
;topdir = /mnt/koji

;configuration for SSL athentication

;client certificate
cert = ~/.fedora.cert

;certificate of the CA that issued the client certificate
ca = ~/.fedora-upload-ca.cert

;certificate of the CA that issued the HTTP server certificate
serverca = ~/.fedora-server-ca.cert

EOF

cat > ~/.koji/arm-config <<EOF
[koji]

;configuration for koji cli tool

;url of XMLRPC server
server = http://arm.koji.fedoraproject.org/kojihub

;url of web interface
weburl = http://arm.koji.fedoraproject.org/koji

;url of package download site
pkgurl = http://arm.koji.fedoraproject.org/packages

;path to the koji top directory
;topdir = /mnt/koji

;configuration for SSL athentication

;client certificate
cert = ~/.fedora.cert

;certificate of the CA that issued the client certificate
ca = ~/.fedora-upload-ca.cert

;certificate of the CA that issued the HTTP server certificate
serverca = ~/.fedora-server-ca.cert

EOF

cat > ~/.koji/sparc-config <<EOF
[koji]

;configuration for koji cli tool

;url of XMLRPC server
server = http://sparc.koji.fedoraproject.org/kojihub

;url of web interface
weburl = http://sparc.koji.fedoraproject.org/koji

;url of package download site
pkgurl = http://sparc.koji.fedoraproject.org/packages

;path to the koji top directory
;topdir = /mnt/koji

;configuration for SSL athentication

;client certificate
cert = ~/.fedora.cert

;certificate of the CA that issued the client certificate
ca = ~/.fedora-upload-ca.cert

;certificate of the CA that issued the HTTP server certificate
serverca = ~/.fedora-server-ca.cert

EOF


cat <<EOF
Creating an SSL certificate to import into your browser, to enable
user authentication at http://koji.fedoraproject.org/koji/
Choose your own passphrase, you will be prompted for this when importing the certificate.

EOF

if [ -f ~/fedora-browser-cert.p12 ]; then
    rm ~/fedora-browser-cert.p12
fi

/usr/bin/openssl pkcs12 -export -in ~/.fedora.cert -CAfile ~/.fedora-upload-ca.cert -out ~/fedora-browser-cert.p12

cat <<EOF

Browser certificate exported to ~/fedora-browser-cert.p12
To import the certificate into Firefox:

Edit -> Preferences -> Advanced
Click "View Certificates"
On "Your Certificates" tab, click "Import"
Select ~/fedora-browser-cert.p12
Type the export passphrase you chose earlier

Once imported, you should see a certificate named "Fedora Project".
Your username should appear underneath this.
 
You should now be able to click the "login" link at http://koji.fedoraproject.org/koji/ successfully.
EOF